SSL_GET_CURRENT_CIPHER(3ossl)
π SSL_GET_CURRENT_CIPHER(3ossl) π
okay bestie, so this is a page from the OpenSSL manual (that's the 3ossl bit, iykyk) and it's all about peeking at which cipher your TLS connection is out here actually using. the star of the show is SSL_get_current_cipher, but she brought her whole friend group: SSL_get_cipher_name, SSL_get_cipher, SSL_get_cipher_bits, SSL_get_cipher_version, and SSL_get_pending_cipher. their whole job? get the SSL_CIPHER of a connection. periodt. β¨
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
const SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl);
const SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl);
const char *SSL_get_cipher_name(const SSL *s);
const char *SSL_get_cipher(const SSL *s);
int SSL_get_cipher_bits(const SSL *s, int *np);
const char *SSL_get_cipher_version(const SSL *s);
π¦ DESCRIPTION π¦
SSL_get_current_cipher() hands you back a pointer to an SSL_CIPHER object, and that object is literally the description of the cipher that is actually being used on a connection that got established with the ssl object. and bestie, ssl MUST NOT be NULL, like fr fr do not do that. for more deets, go see SSL_CIPHER_get_name(3). π
SSL_get_cipher_name() grabs the name of the cipher that's currently in use. and SSL_get_cipher()? identical to SSL_get_cipher_name(), no cap, same thing. SSL_get_cipher_bits() is a macro that gets you the number of secret/algorithm bits being used, and SSL_get_cipher_version() returns the protocol name. πΈ
SSL_get_pending_cipher() gives you a pointer to an SSL_CIPHER object holding the description of the cipher (if there even is one) that's been negotiated for future use on the connection established with the ssl object β but is not yet in use. this can happen during handshake processing, when control flow can get handed back to the application through any of several callback methods. and okay, listen: the internal sequencing of handshake processing and callback invocation is not guaranteed to be stable from release to release, so don't get attached. at present, only the callback set by SSL_CTX_set_alpn_select_cb() is guaranteed to have a non-NULL return value. other callbacks may get added to this list over time, so stay tuned. π
π RETURN VALUES π
SSL_get_current_cipher()β returns the cipher actually used, orNULLif no session has been established. πSSL_get_pending_cipher()β returns the cipher to be used at the next change of cipher suite, orNULLif no such cipher is known. π
π NOTES π
SSL_get_cipher, SSL_get_cipher_bits, SSL_get_cipher_version, and SSL_get_cipher_name are all implemented as macros. so like, they're not real functions, they're macros. iconic behavior honestly. β¨
π SEE ALSO π
π COPYRIGHT π
Copyright 2000-2018 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 vibe, bestie π«Ά this page is from OpenSSL version 3.5.9, dated 2026-09-29, and it's the SSL_GET_CURRENT_CIPHER(3ossl) manual. go forth and check your ciphers, mwah π
π
π¦ 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