---
name: "libressl-SSL_CTX_set_cert_store"
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_CTX_set_cert_store"
---

# libressl-SSL\_CTX\_set\_cert\_store(3)

manipulate X509 certificate verification storage

## NAME

**SSL\_CTX\_set\_cert\_store**, **SSL\_CTX\_set1\_cert\_store**, **SSL\_CTX\_get\_cert\_store** – manipulate X509 certificate verification storage

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

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

*void*\

**SSL\_CTX\_set\_cert\_store**(*SSL\_CTX \*ctx*, *X509\_STORE \*store*);

*void*\

**SSL\_CTX\_set1\_cert\_store**(*SSL\_CTX \*ctx*, *X509\_STORE \*store*);

*X509\_STORE* *\**\

**SSL\_CTX\_get\_cert\_store**(*const SSL\_CTX \*ctx*);

## DESCRIPTION

**SSL\_CTX\_set\_cert\_store**() sets the verification storage of *ctx* to or replaces it with *store*. If another *X509\_STORE* object is currently set in *ctx*, it will be freed.

**SSL\_CTX\_set1\_cert\_store**() sets the verification storage of *ctx* to or replaces it with *store*. The *store*'s reference count is incremented.

**SSL\_CTX\_get\_cert\_store**() returns a pointer to the current certificate verification storage.

In order to verify the certificates presented by the peer, trusted CA certificates must be accessed. These CA certificates are made available via lookup methods, handled inside the *X509\_STORE*. From the *X509\_STORE* the *X509\_STORE\_CTX* used when verifying certificates is created.

Typically the trusted certificate store is handled indirectly via using SSL\_CTX\_load\_verify\_locations(3). Using the **SSL\_CTX\_set\_cert\_store**() and **SSL\_CTX\_get\_cert\_store**() functions it is possible to manipulate the *X509\_STORE* object beyond the SSL\_CTX\_load\_verify\_locations(3) call.

Currently no detailed documentation on how to use the *X509\_STORE* object is available. Not all members of the *X509\_STORE* are used when the verification takes place. So will, for example, the **verify\_callback**() be overridden with the **verify\_callback**() set via the SSL\_CTX\_set\_verify(3) family of functions. This document must therefore be updated when documentation about the *X509\_STORE* object and its handling becomes available.

## RETURN VALUES

**SSL\_CTX\_get\_cert\_store**() returns the current setting.

## SEE ALSO

[ssl(3)](/ssl/3.md), SSL\_CTX\_load\_verify\_locations(3), SSL\_CTX\_set\_verify(3), X509\_STORE\_new(3)

## HISTORY

**SSL\_CTX\_set\_cert\_store**() and **SSL\_CTX\_get\_cert\_store**() first appeared in SSLeay 0.8.1 and have been available since OpenBSD 2.4.

**SSL\_CTX\_set1\_cert\_store**() first appeared in OpenSSL 1.1.1 and has been available since OpenBSD 7.6.
