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

# libressl-SSL\_get\_current\_cipher(3)

get SSL\_CIPHER of a connection

## NAME

**SSL\_get\_current\_cipher**, **SSL\_get\_cipher**, **SSL\_get\_cipher\_name**, **SSL\_get\_cipher\_bits**, **SSL\_get\_cipher\_version** – get SSL\_CIPHER of a connection

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

**#include \<openssl/ssl.h\>**

*const* *SSL\_CIPHER* *\**\

**SSL\_get\_current\_cipher**(*const SSL \*ssl*);

*const* *char* *\**\

**SSL\_get\_cipher**(*const SSL \*ssl*);

*const* *char* *\**\

**SSL\_get\_cipher\_name**(*const SSL \*ssl*);

*int*\

**SSL\_get\_cipher\_bits**(*const SSL \*ssl*, *int \*np*);

*char* *\**\

**SSL\_get\_cipher\_version**(*const SSL \*ssl*);

## 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. 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**() obtains the number of secret/algorithm bits used and **SSL\_get\_cipher\_version**() returns the protocol name.

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

## RETURN VALUES

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

## SEE ALSO

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

## HISTORY

**SSL\_get\_cipher**() appeared in SSLeay 0.4 or earlier. **SSL\_get\_cipher\_bits**() first appeared in SSLeay 0.6.4. **SSL\_get\_cipher\_name**() and **SSL\_get\_cipher\_version**() first appeared in SSLeay 0.8.0. **SSL\_get\_current\_cipher**() first appeared in SSLeay 0.8.1. These functions have been available since OpenBSD 2.4.
