SSL_CIPHER_GET_NAME(3ossl)
πΈ NAME πΈ
okay so bestie, this is the SSL_CIPHER_GET_NAME(3ossl) page β an OpenSSL manual page β and it's literally the βget SSL_CIPHER propertiesβ squad. no cap, the whole crew is here:
SSL_CIPHER_get_nameSSL_CIPHER_standard_nameOPENSSL_cipher_nameSSL_CIPHER_get_bitsSSL_CIPHER_get_versionSSL_CIPHER_descriptionSSL_CIPHER_get_cipher_nidSSL_CIPHER_get_digest_nidSSL_CIPHER_get_handshake_digestSSL_CIPHER_get_kx_nidSSL_CIPHER_get_auth_nidSSL_CIPHER_is_aeadSSL_CIPHER_findSSL_CIPHER_get_idSSL_CIPHER_get_protocol_id
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher);
const char *SSL_CIPHER_standard_name(const SSL_CIPHER *cipher);
const char *OPENSSL_cipher_name(const char *stdname);
int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits);
const char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher);
char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int size);
int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c);
int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c);
const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c);
int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c);
int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c);
int SSL_CIPHER_is_aead(const SSL_CIPHER *c);
const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr);
uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c);
uint32_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c);
π DESCRIPTION π
okay so hereβs the tea on every single one of these little functions:
SSL_CIPHER_get_name()β returns a pointer to the name of cipher. if cipher isNULL, it returns"(NONE)".SSL_CIPHER_standard_name()β returns a pointer to the standard RFC name of cipher. if cipher isNULL, it returns"(NONE)". if the cipher has no standard name, it returnsNULL. if cipher was defined in both SSLv3 and TLS, it returns the TLS name. periodt.OPENSSL_cipher_name()β returns a pointer to the OpenSSL name of stdname. if stdname isNULL, or stdname has no corresponding OpenSSL name, it returns"(NONE)". where both exist, stdname should be the TLS name rather than the SSLv3 name.SSL_CIPHER_get_bits()β returns the number of secret bits used for cipher. if cipher isNULL,0is returned.SSL_CIPHER_get_version()β returns a string which indicates the SSL/TLS protocol version that first defined the cipher. it returns"(NONE)"if cipher isNULL.SSL_CIPHER_get_cipher_nid()β returns the cipher NID corresponding to c. if there is no cipher (e.g. for cipher suites with no encryption) thenNID_undefis returned.SSL_CIPHER_get_digest_nid()β returns the digest NID corresponding to the MAC used by c during record encryption/decryption. if there is no digest (e.g. for AEAD cipher suites) thenNID_undefis returned.SSL_CIPHER_get_handshake_digest()β returns anEVP_MDfor the digest used during the SSL/TLS handshake when using theSSL_CIPHERc. note that this may be different to the digest used to calculate the MAC for encrypted records. lowkey important.SSL_CIPHER_get_kx_nid()β returns the key exchange NID corresponding to the method used by c. if there is no key exchange, thenNID_undefis returned. if any appropriate key exchange algorithm can be used (as in the case of TLS 1.3 cipher suites)NID_kx_anyis returned. examples (not comprehensive):
NID_kx_rsa
NID_kx_ecdhe
NID_kx_dhe
NID_kx_psk
SSL_CIPHER_get_auth_nid()β returns the authentication NID corresponding to the method used by c. if there is no authentication, thenNID_undefis returned. if any appropriate authentication algorithm can be used (as in the case of TLS 1.3 cipher suites)NID_auth_anyis returned. examples (not comprehensive):
NID_auth_rsa
NID_auth_ecdsa
NID_auth_psk
SSL_CIPHER_is_aead()β returns1if the cipher c is AEAD (e.g. GCM or ChaCha20/Poly1305), and0if it is not AEAD.SSL_CIPHER_find()β returns aSSL_CIPHERstructure which has the cipher ID stored in ptr. the ptr parameter is a two element array ofchar, which stores the two-byte TLS cipher ID (as allocated by IANA) in network byte order. this parameter is usually retrieved from a TLS packet by using functions likeSSL_client_hello_get0_ciphers(3).SSL_CIPHER_find()returnsNULLif an error occurs or the indicated cipher is not found.SSL_CIPHER_get_id()β returns the OpenSSL-specific ID of the given cipher c. that ID is not the same as the IANA-specific ID. donβt get it twisted.SSL_CIPHER_get_protocol_id()β returns the two-byte ID used in the TLS protocol of the given cipher c.SSL_CIPHER_description()β returns a textual description of the cipher used into the buffer buf of length len provided. if buf is provided, it must be at least128bytes. if buf isNULLit will be allocated usingOPENSSL_malloc(). if the provided buffer is too small, or the allocation fails,NULLis returned.
π the fields inside SSL_CIPHER_description() π
the string returned by SSL_CIPHER_description() consists of several fields separated by whitespace:
<ciphername>β textual representation of the cipher name.<protocol version>β the minimum protocol version that the ciphersuite supports, such asTLSv1.2. note that this is not always the same as the protocol version in which the ciphersuite was first defined because some ciphersuites are backwards compatible with earlier protocol versions.Kx=<key exchange>β key exchange method such asRSA,ECDHE, etc.Au=<authentication>β authentication method such asRSA,None, etc..Noneis the representation of anonymous ciphers.Enc=<symmetric encryption method>β encryption method, with number of secret bits, such asAESGCM(128).Mac=<message authentication code>β message digest, such asSHA256.
some examples for the output of SSL_CIPHER_description():
ECDHE-RSA-AES256-GCM-SHA256 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD
RSA-PSK-AES256-CBC-SHA384 TLSv1.0 Kx=RSAPSK Au=RSA Enc=AES(256) Mac=SHA384
π RETURN VALUES π
SSL_CIPHER_get_name(),SSL_CIPHER_standard_name(),OPENSSL_cipher_name(),SSL_CIPHER_get_version()andSSL_CIPHER_description()return the corresponding value in a NUL-terminated string for a specific cipher or"(NONE)"if the cipher is not found.SSL_CIPHER_get_bits()returns a positive integer representing the number of secret bits or0if an error occurred.SSL_CIPHER_get_cipher_nid(),SSL_CIPHER_get_digest_nid(),SSL_CIPHER_get_kx_nid()andSSL_CIPHER_get_auth_nid()return the NID value orNID_undefif an error occurred.SSL_CIPHER_get_handshake_digest()returns a validEVP_MDstructure orNULLif an error occurred.SSL_CIPHER_is_aead()returns1if the cipher is AEAD or0otherwise.SSL_CIPHER_find()returns a validSSL_CIPHERstructure orNULLif an error occurred.SSL_CIPHER_get_id()returns a 4-byte integer representing the OpenSSL-specific ID.SSL_CIPHER_get_protocol_id()returns a 2-byte integer representing the TLS protocol-specific ID.
π¦ SEE ALSO π¦
ssl(7), SSL_get_current_cipher(3), SSL_get_ciphers(3), openssl-ciphers(1)
π HISTORY π
- the
SSL_CIPHER_get_version()function was updated to always return the correct protocol string in OpenSSL 1.1.0. - the
SSL_CIPHER_description()function was changed to returnNULLon error, rather than a fixed string, in OpenSSL 1.1.0. - the
SSL_CIPHER_get_handshake_digest()function was added in OpenSSL 1.1.1. - the
SSL_CIPHER_standard_name()function was globally available in OpenSSL 1.1.1. before OpenSSL 1.1.1, tracing (enable-ssl-traceargument to Configure) was required to enable this function. - the
OPENSSL_cipher_name()function was added in OpenSSL 1.1.1.
π COPYRIGHT π
Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and thatβs the whole page, bestie π«Ά this one comes from OpenSSL 3.5.0, dated 2026-09-25 β now go get those cipher properties, you icon π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms