Blame doc/man3/SSL_CIPHER_get_name.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
SSL_CIPHER_get_name,
Packit c4476c
SSL_CIPHER_standard_name,
Packit c4476c
OPENSSL_cipher_name,
Packit c4476c
SSL_CIPHER_get_bits,
Packit c4476c
SSL_CIPHER_get_version,
Packit c4476c
SSL_CIPHER_description,
Packit c4476c
SSL_CIPHER_get_cipher_nid,
Packit c4476c
SSL_CIPHER_get_digest_nid,
Packit c4476c
SSL_CIPHER_get_handshake_digest,
Packit c4476c
SSL_CIPHER_get_kx_nid,
Packit c4476c
SSL_CIPHER_get_auth_nid,
Packit c4476c
SSL_CIPHER_is_aead,
Packit c4476c
SSL_CIPHER_find,
Packit c4476c
SSL_CIPHER_get_id,
Packit c4476c
SSL_CIPHER_get_protocol_id
Packit c4476c
- get SSL_CIPHER properties
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/ssl.h>
Packit c4476c
Packit c4476c
 const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher);
Packit c4476c
 const char *SSL_CIPHER_standard_name(const SSL_CIPHER *cipher);
Packit c4476c
 const char *OPENSSL_cipher_name(const char *stdname);
Packit c4476c
 int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits);
Packit c4476c
 char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher);
Packit c4476c
 char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int size);
Packit c4476c
 int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c);
Packit c4476c
 int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c);
Packit c4476c
 const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c);
Packit c4476c
 int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c);
Packit c4476c
 int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c);
Packit c4476c
 int SSL_CIPHER_is_aead(const SSL_CIPHER *c);
Packit c4476c
 const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr);
Packit c4476c
 uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c);
Packit c4476c
 uint32_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
SSL_CIPHER_get_name() returns a pointer to the name of B<cipher>. If the
Packit c4476c
B<cipher> is NULL, it returns "(NONE)".
Packit c4476c
Packit c4476c
SSL_CIPHER_standard_name() returns a pointer to the standard RFC name of
Packit c4476c
B<cipher>. If the B<cipher> is NULL, it returns "(NONE)". If the B<cipher>
Packit c4476c
has no standard name, it returns B<NULL>. If B<cipher> was defined in both
Packit c4476c
SSLv3 and TLS, it returns the TLS name.
Packit c4476c
Packit c4476c
OPENSSL_cipher_name() returns a pointer to the OpenSSL name of B<stdname>.
Packit c4476c
If the B<stdname> is NULL, or B<stdname> has no corresponding OpenSSL name,
Packit c4476c
it returns "(NONE)". Where both exist, B<stdname> should be the TLS name rather
Packit c4476c
than the SSLv3 name.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_bits() returns the number of secret bits used for B<cipher>.
Packit c4476c
If B<cipher> is NULL, 0 is returned.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_version() returns string which indicates the SSL/TLS protocol
Packit c4476c
version that first defined the cipher.  It returns "(NONE)" if B<cipher> is NULL.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_cipher_nid() returns the cipher NID corresponding to B<c>.
Packit c4476c
If there is no cipher (e.g. for cipher suites with no encryption) then
Packit c4476c
B<NID_undef> is returned.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_digest_nid() returns the digest NID corresponding to the MAC
Packit c4476c
used by B<c> during record encryption/decryption. If there is no digest (e.g.
Packit c4476c
for AEAD cipher suites) then B<NID_undef> is returned.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_handshake_digest() returns an EVP_MD for the digest used during
Packit c4476c
the SSL/TLS handshake when using the SSL_CIPHER B<c>. Note that this may be
Packit c4476c
different to the digest used to calculate the MAC for encrypted records.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_kx_nid() returns the key exchange NID corresponding to the method
Packit c4476c
used by B<c>. If there is no key exchange, then B<NID_undef> is returned.
Packit c4476c
If any appropriate key exchange algorithm can be used (as in the case of TLS 1.3
Packit c4476c
cipher suites) B<NID_kx_any> is returned. Examples (not comprehensive):
Packit c4476c
Packit c4476c
 NID_kx_rsa
Packit c4476c
 NID_kx_ecdhe
Packit c4476c
 NID_kx_dhe
Packit c4476c
 NID_kx_psk
Packit c4476c
Packit c4476c
SSL_CIPHER_get_auth_nid() returns the authentication NID corresponding to the method
Packit c4476c
used by B<c>. If there is no authentication, then B<NID_undef> is returned.
Packit c4476c
If any appropriate authentication algorithm can be used (as in the case of
Packit c4476c
TLS 1.3 cipher suites) B<NID_auth_any> is returned. Examples (not comprehensive):
Packit c4476c
Packit c4476c
 NID_auth_rsa
Packit c4476c
 NID_auth_ecdsa
Packit c4476c
 NID_auth_psk
Packit c4476c
Packit c4476c
SSL_CIPHER_is_aead() returns 1 if the cipher B<c> is AEAD (e.g. GCM or
Packit c4476c
ChaCha20/Poly1305), and 0 if it is not AEAD.
Packit c4476c
Packit c4476c
SSL_CIPHER_find() returns a B<SSL_CIPHER> structure which has the cipher ID stored
Packit c4476c
in B<ptr>. The B<ptr> parameter is a two element array of B<char>, which stores the
Packit c4476c
two-byte TLS cipher ID (as allocated by IANA) in network byte order. This parameter
Packit c4476c
is usually retrieved from a TLS packet by using functions like
Packit c4476c
L<SSL_client_hello_get0_ciphers(3)>.  SSL_CIPHER_find() returns NULL if an
Packit c4476c
error occurs or the indicated cipher is not found.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_id() returns the OpenSSL-specific ID of the given cipher B<c>. That ID is
Packit c4476c
not the same as the IANA-specific ID.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_protocol_id() returns the two-byte ID used in the TLS protocol of the given
Packit c4476c
cipher B<c>.
Packit c4476c
Packit c4476c
SSL_CIPHER_description() returns a textual description of the cipher used
Packit c4476c
into the buffer B<buf> of length B<len> provided.  If B<buf> is provided, it
Packit c4476c
must be at least 128 bytes, otherwise a buffer will be allocated using
Packit c4476c
OPENSSL_malloc().  If the provided buffer is too small, or the allocation fails,
Packit c4476c
B<NULL> is returned.
Packit c4476c
Packit c4476c
The string returned by SSL_CIPHER_description() consists of several fields
Packit c4476c
separated by whitespace:
Packit c4476c
Packit c4476c
=over 4
Packit c4476c
Packit c4476c
=item <ciphername>
Packit c4476c
Packit c4476c
Textual representation of the cipher name.
Packit c4476c
Packit c4476c
=item <protocol version>
Packit c4476c
Packit c4476c
The minimum protocol version that the ciphersuite supports, such as B<TLSv1.2>.
Packit c4476c
Note that this is not always the same as the protocol version in which the
Packit c4476c
ciphersuite was first defined because some ciphersuites are backwards compatible
Packit c4476c
with earlier protocol versions.
Packit c4476c
Packit c4476c
=item Kx=<key exchange>
Packit c4476c
Packit c4476c
Key exchange method such as B<RSA>, B<ECDHE>, etc.
Packit c4476c
Packit c4476c
=item Au=<authentication>
Packit c4476c
Packit c4476c
Authentication method such as B<RSA>, B<None>, etc.. None is the
Packit c4476c
representation of anonymous ciphers.
Packit c4476c
Packit c4476c
=item Enc=<symmetric encryption method>
Packit c4476c
Packit c4476c
Encryption method, with number of secret bits, such as B<AESGCM(128)>.
Packit c4476c
Packit c4476c
=item Mac=<message authentication code>
Packit c4476c
Packit c4476c
Message digest, such as B<SHA256>.
Packit c4476c
Packit c4476c
=back
Packit c4476c
Packit c4476c
Some examples for the output of SSL_CIPHER_description():
Packit c4476c
Packit c4476c
 ECDHE-RSA-AES256-GCM-SHA256 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD
Packit c4476c
 RSA-PSK-AES256-CBC-SHA384 TLSv1.0 Kx=RSAPSK   Au=RSA  Enc=AES(256)  Mac=SHA384
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
SSL_CIPHER_get_name(), SSL_CIPHER_standard_name(), OPENSSL_cipher_name(),
Packit c4476c
SSL_CIPHER_get_version() and SSL_CIPHER_description() return the corresponding
Packit c4476c
value in a null-terminated string for a specific cipher or "(NONE)"
Packit c4476c
if the cipher is not found.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_bits() returns a positive integer representing the number of
Packit c4476c
secret bits or 0 if an error occurred.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_cipher_nid(), SSL_CIPHER_get_digest_nid(),
Packit c4476c
SSL_CIPHER_get_kx_nid() and SSL_CIPHER_get_auth_nid() return the NID value or
Packit c4476c
B<NID_undef> if an error occurred.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_handshake_digest() returns a valid B<EVP_MD> structure or NULL
Packit c4476c
if an error occurred.
Packit c4476c
Packit c4476c
SSL_CIPHER_is_aead() returns 1 if the cipher is AEAD or 0 otherwise.
Packit c4476c
Packit c4476c
SSL_CIPHER_find() returns a valid B<SSL_CIPHER> structure or NULL if an error
Packit c4476c
occurred.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_id() returns a 4-byte integer representing the OpenSSL-specific ID.
Packit c4476c
Packit c4476c
SSL_CIPHER_get_protocol_id() returns a 2-byte integer representing the TLS
Packit c4476c
protocol-specific ID.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<ssl(7)>, L<SSL_get_current_cipher(3)>,
Packit c4476c
L<SSL_get_ciphers(3)>, L<ciphers(1)>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
The SSL_CIPHER_get_version() function was updated to always return the
Packit c4476c
correct protocol string in OpenSSL 1.1.0.
Packit c4476c
Packit c4476c
The SSL_CIPHER_description() function was changed to return B<NULL> on error,
Packit c4476c
rather than a fixed string, in OpenSSL 1.1.0.
Packit c4476c
Packit c4476c
The SSL_CIPHER_get_handshake_digest() function was added in OpenSSL 1.1.1.
Packit c4476c
Packit c4476c
The SSL_CIPHER_standard_name() function was globally available in OpenSSL 1.1.1.
Packit c4476c
 Before OpenSSL 1.1.1, tracing (B<enable-ssl-trace> argument to Configure) was
Packit c4476c
required to enable this function.
Packit c4476c
Packit c4476c
The OPENSSL_cipher_name() function was added in OpenSSL 1.1.1.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut