SSL_CIPHER_GET_NAME(3ossl)
π SSL_CIPHER_GET_NAME β get SSL_CIPHER properties
okay so this is the 3ossl manual page, and it's literally the group chat for every function that tells you stuff about an SSL_CIPHER β its name, its bits, its version, its NIDs, all of it. bestie, get comfy, there's like fifteen functions here and every single one is a baddie in her own way π
β¨ 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);
uint16_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c);
πΈ DESCRIPTION πΈ
okay, going one by one, no skips, we're doing the whole roster π
SSL_CIPHER_get_name() β hands you back a pointer to the name of cipher. and if cipher is NULL? you get "(NONE)". that's it, that's the whole vibe. π«Ά
SSL_CIPHER_standard_name() β same deal but it's the standard RFC name of cipher. NULL cipher β "(NONE)". but if the cipher genuinely has no standard name, it returns NULL (not the same thing, bestie, don't mix them up π). also, if the cipher was defined in both SSLv3 and TLS, you get the TLS name. slay.
OPENSSL_cipher_name() β the reverse direction, glow-up edition β¨: give it stdname and it hands back the OpenSSL name. if stdname is NULL, or stdname just has no corresponding OpenSSL name, you get "(NONE)". and where both exist, stdname should be the TLS name rather than the SSLv3 name. iykyk.
SSL_CIPHER_get_bits() β the number of secret bits used for cipher. cipher is NULL β 0. that's the whole function, she's short and she's iconic.
SSL_CIPHER_get_version() β returns a string indicating the SSL/TLS protocol version that first defined the cipher. cipher is NULL β "(NONE)". π¦
SSL_CIPHER_get_cipher_nid() β the cipher NID for c. but if there's no cipher (think: cipher suites with no encryption), you get NID_undef. not me getting a whole NID for nothing π
SSL_CIPHER_get_digest_nid() β the digest NID for the MAC that c uses during record encryption/decryption. no digest (like, for AEAD cipher suites)? NID_undef. periodt.
SSL_CIPHER_get_handshake_digest() β returns an EVP_MD for the digest used during the SSL/TLS handshake when using the SSL_CIPHER c. β οΈ heads up though: this may be different from the digest used to calculate the MAC for encrypted records. main character digest β side character digest, got it.
SSL_CIPHER_get_kx_nid() β the key exchange NID for the method c uses. no key exchange β NID_undef. but if any appropriate key exchange algorithm can be used (as with TLS 1.3 cipher suites), you get NID_kx_any. examples (not comprehensive, so don't come for me):
NID_kx_rsa
NID_kx_ecdhe
NID_kx_dhe
NID_kx_psk
SSL_CIPHER_get_auth_nid() β the authentication NID for the method c uses. no authentication β NID_undef. if any appropriate authentication algorithm can be used (again, TLS 1.3 cipher suites, she's flexible π
) β NID_auth_any. examples (not comprehensive):
NID_auth_rsa
NID_auth_ecdsa
NID_auth_psk
SSL_CIPHER_is_aead() β 1 if cipher c is AEAD (like GCM or ChaCha20/Poly1305), 0 if it's not. binary queen. π
SSL_CIPHER_find() β returns an SSL_CIPHER structure whose cipher ID is stored in ptr. the ptr param is a two element array of char holding the two-byte TLS cipher ID (as allocated by IANA) in network byte order. usually you grab this from a TLS packet using functions like SSL_client_hello_get0_ciphers(3). returns NULL if an error occurs or the indicated cipher is not found. π₯
SSL_CIPHER_get_id() β the OpenSSL-specific ID of cipher c. and ngl, that ID is not the same as the IANA-specific ID. do not confuse them, i'm begging π
SSL_CIPHER_get_protocol_id() β the two-byte ID used in the TLS protocol for cipher c. that's the other one, the one that matches the wire.
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 least 128 bytes. if buf is NULL it'll be allocated using OPENSSL_malloc(). and if the provided buffer is too small, or the allocation fails β NULL. no mercy. π
π§ the description string, field by field
the string from SSL_CIPHER_description() is several fields separated by whitespace, and here's the whole lineup:
<ciphername>β textual representation of the cipher name.<protocol version>β the minimum protocol version that the ciphersuite supports, likeTLSv1.2. β οΈ note that this isn't always the same as the protocol version in which the ciphersuite was first defined, because some ciphersuites are backwards compatible with earlier protocol versions. the way this trips people upβ¦ π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
look at those aligned columns, she ate and left absolutely no crumbs π
β 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()β 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()β the NID value, orNID_undefif an error occurred.SSL_CIPHER_get_handshake_digest()β a validEVP_MDstructure, orNULLif an error occurred.SSL_CIPHER_is_aead()β1if the cipher is AEAD,0otherwise.SSL_CIPHER_find()β a validSSL_CIPHERstructure, orNULLif an error occurred.SSL_CIPHER_get_id()β a 4-byte integer representing the OpenSSL-specific ID.SSL_CIPHER_get_protocol_id()β 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 lore, bestie, keep up:
SSL_CIPHER_get_version()was updated to always return the correct protocol string in OpenSSL 1.1.0.SSL_CIPHER_description()was changed to returnNULLon error, rather than a fixed string, in OpenSSL 1.1.0. (yes she used to return a whole fixed string on error, we don't talk about it π)SSL_CIPHER_get_handshake_digest()was added in OpenSSL 1.1.1.SSL_CIPHER_standard_name()was globally available in OpenSSL 1.1.1. before that, tracing (theenable-ssl-traceargument to Configure) was required to enable this function. yeah. you had to enable it. wild.OPENSSL_cipher_name()was added in OpenSSL 1.1.1.
π COPYRIGHT π
Copyright 2000-2025 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>.
okay that's the whole page, you're officially educated β¨ mwah π β this was OpenSSL 3.5.6, dated 2026-04-07, signing off from the SSL_CIPHER_GET_NAME(3ossl) manual. go read ssl(7) next, i believe in you π«Άπ
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms