---
name: "libressl-SSL_get_certificate"
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_certificate"
---

# libressl-SSL\_get\_certificate(3)

get SSL certificate and private key

## NAME

**SSL\_get\_certificate**, **SSL\_get\_privatekey** – get SSL certificate and private key

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

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

*X509* *\**\

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

*EVP\_PKEY* *\**\

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

## DESCRIPTION

These functions retrieve certificate and key data from an *SSL* object. They return internal pointers that must not be freed by the application program.

## RETURN VALUES

**SSL\_get\_certificate**() returns the active X.509 certificate currently used by *ssl* or NULL if none is active.

**SSL\_get\_privatekey**() returns the active private key currently used by *ssl* or NULL if none is active.

## SEE ALSO

[ssl(3)](/ssl/3.md), SSL\_check\_private\_key(3), SSL\_use\_certificate(3)

## HISTORY

**SSL\_get\_certificate**() first appeared in SSLeay 0.5.2a. **SSL\_get\_privatekey**() first appeared in SSLeay 0.8.0. Both functions have been available since OpenBSD 2.4.
