---
name: "SSL_get_current_cipher"
section: "3ssl"
platform: "linux"
package: "openssl"
version: "3.6.5-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/SSL_get_current_cipher"
---

# SSL\_get\_current\_cipher(3ssl)

get SSL\_CIPHER of a connection

## NAME

SSL\_get\_current\_cipher, SSL\_get\_cipher\_name, SSL\_get\_cipher, SSL\_get\_cipher\_bits, SSL\_get\_cipher\_version, SSL\_get\_pending\_cipher - get SSL\_CIPHER of a connection

## 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()** returns a pointer to an SSL\_CIPHER object containing the description of the actually used cipher of a connection established with the **ssl** object. **ssl** **MUST NOT** be NULL. See **SSL\_CIPHER\_get\_name**(3) for more details.

**SSL\_get\_cipher\_name()** obtains the name of the currently used cipher. **SSL\_get\_cipher()** is identical to **SSL\_get\_cipher\_name()**. **SSL\_get\_cipher\_bits()** is a macro to obtain the number of secret/algorithm bits used and **SSL\_get\_cipher\_version()** returns the protocol name.

**SSL\_get\_pending\_cipher()** returns a pointer to an SSL\_CIPHER object containing the description of the cipher (if any) that has been negotiated for future use on the connection established with the **ssl** object, but is not yet in use. This may be the case during handshake processing, when control flow can be returned to the application via any of several callback methods.  The internal sequencing of handshake processing and callback invocation is not guaranteed to be stable from release to release, and 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 be added to this list over time.

## RETURN VALUES

**SSL\_get\_current\_cipher()** returns the cipher actually used, or NULL if no session has been established.

**SSL\_get\_pending\_cipher()** returns the cipher to be used at the next change of cipher suite, or NULL if no such cipher is known.

## NOTES

SSL\_get\_cipher, SSL\_get\_cipher\_bits, SSL\_get\_cipher\_version, and SSL\_get\_cipher\_name are implemented as macros.

## SEE ALSO

[**ssl**(7)](/ssl/7.md), **SSL\_CIPHER\_get\_name**(3)

## 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\>.
