SSL_CIPHER_GET_NAME(3ossl)
π SSL_CIPHER_GET_NAME β the manual, bestie edition π
okay so this is the 3ossl manual page, aka the OpenSSL one, and it's literally all about how you pull info out of an SSL_CIPHER struct. every single one of these lil functions is here to spill the tea about a cipher: its name, its bits, its version, its NIDs, whether it's AEAD, all of it. slay. π
β¨ NAME β¨
SSL_CIPHER_get_name, SSL_CIPHER_standard_name, OPENSSL_cipher_name, SSL_CIPHER_get_bits, SSL_CIPHER_get_version, SSL_CIPHER_description, SSL_CIPHER_get_cipher_nid, SSL_CIPHER_get_digest_nid, SSL_CIPHER_get_handshake_digest, SSL_CIPHER_get_kx_nid, SSL_CIPHER_get_auth_nid, SSL_CIPHER_is_aead, SSL_CIPHER_find, SSL_CIPHER_get_id, SSL_CIPHER_get_protocol_id β get SSL_CIPHER properties π«Ά
πΈ 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 π
SSL_CIPHER_get_name() hands you back a pointer to the name of cipher. and if cipher is NULL? it gives you "(NONE)". no name, no problem. π
SSL_CIPHER_standard_name() returns a pointer to the standard RFC name of cipher. if cipher is NULL, you get "(NONE)" again. if cipher has no standard name at all, it returns NULL. and if cipher got defined in both SSLv3 and TLS, it returns the TLS name. TLS stays winning. π
OPENSSL_cipher_name() returns a pointer to the OpenSSL name of stdname. if stdname is NULL, or stdname has no matching OpenSSL name, it returns "(NONE)". and where both exist, stdname should be the TLS name rather than the SSLv3 name β fr fr.
SSL_CIPHER_get_bits() returns the number of secret bits used for cipher. if cipher is NULL, it's 0.
SSL_CIPHER_get_version() returns a string indicating the SSL/TLS protocol version that first defined the cipher. if cipher is NULL, it's "(NONE)".
SSL_CIPHER_get_cipher_nid() returns the cipher NID corresponding to c. if there's no cipher (think cipher suites with no encryption), then NID_undef comes back at you.
SSL_CIPHER_get_digest_nid() returns the digest NID corresponding to the MAC that c uses during record encryption/decryption. if there's no digest (hi, AEAD cipher suites), then NID_undef is what you get.
SSL_CIPHER_get_handshake_digest() returns an EVP_MD for the digest used during the SSL/TLS handshake when you're using the SSL_CIPHER c. and heads up bestie, this may be different to the digest used to calculate the MAC for encrypted records. two different jobs, two different digests. π
SSL_CIPHER_get_kx_nid() returns the key exchange NID corresponding to the method used by c. no key exchange? NID_undef. and if any appropriate key exchange algorithm can be used (looking at you, TLS 1.3 cipher suites) you get NID_kx_any back. examples (and this is not comprehensive, okay):
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. no authentication? NID_undef. if any appropriate authentication algorithm can be used (again, TLS 1.3 cipher suites), NID_auth_any is returned. examples (still not comprehensive, iykyk):
NID_auth_rsa
NID_auth_ecdsa
NID_auth_psk
SSL_CIPHER_is_aead() returns 1 if the cipher c is AEAD (so like GCM or ChaCha20/Poly1305), and 0 if it is not AEAD. simple as. β¨
SSL_CIPHER_find() returns an SSL_CIPHER structure which has the cipher ID stored in ptr. the ptr parameter is a two element array of char, and it 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 like SSL_client_hello_get0_ciphers(3). and SSL_CIPHER_find() returns NULL if an error happens or if the indicated cipher just isn't 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. do not confuse them, i am begging. π
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, dropped into the buffer buf of length len that you 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 is returned. no cap.
the string returned by SSL_CIPHER_description() is made of several fields separated by whitespace, and each one is giving very specific vibes:
<ciphername>β textual representation of the cipher name.<protocol version>β the minimum protocol version that the ciphersuite supports, likeTLSv1.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() and SSL_CIPHER_description() all 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, or 0 if an error occurred.
SSL_CIPHER_get_cipher_nid(), SSL_CIPHER_get_digest_nid(), SSL_CIPHER_get_kx_nid() and SSL_CIPHER_get_auth_nid() return the NID value, or NID_undef if an error occurred.
SSL_CIPHER_get_handshake_digest() returns a valid EVP_MD structure, or NULL if an error occurred.
SSL_CIPHER_is_aead() returns 1 if the cipher is AEAD or 0 otherwise.
SSL_CIPHER_find() returns a valid SSL_CIPHER structure, or NULL if 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 π
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.SSL_CIPHER_get_handshake_digest()was added in OpenSSL 1.1.1.SSL_CIPHER_standard_name()became globally available in OpenSSL 1.1.1. before OpenSSL 1.1.1, tracing (enable-ssl-traceargument to Configure) was required to enable this function.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>.
lowkey the legal stuff is the only part you actually can't vibe your way around, so read it fr fr π
okay that's the whole thing bestie, every last crumb of it π. this page is from version 3.5.9, dated 2026-09-29, and it's the SSL_CIPHER_GET_NAME(3ossl) page from the OpenSSL manual. go forth and get those cipher properties, you absolute icon πβ¨π«Ά
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms