X509_STORE_NEW(3) | Library Functions Manual | X509_STORE_NEW(3)

# NAME

`X509_STORE_new`, `X509_STORE_up_ref`, `X509_STORE_free` — allocate and free X.509 certificate stores

# SYNOPSIS

library “libcrypto”
`#include <openssl/x509_vfy.h>`

X509_STORE *
`X509_STORE_new`(void);

int
`X509_STORE_up_ref`(X509_STORE *store);

void
`X509_STORE_free`(X509_STORE *store);

# DESCRIPTION

`X509_STORE_new`() allocates and initializes an empty X.509 certificate store and sets its reference count to 1.

`X509_STORE_up_ref`() increments the reference count of store by 1.

`X509_STORE_free`() decrements the reference count of store by 1. If the reference count reaches 0, all resources used by the store, including all certificates contained in it, are released and store itself is freed. If store is a `NULL` pointer, no action occurs.

# RETURN VALUES

`X509_STORE_new`() returns a newly created X509_STORE object or `NULL` if an error occurs.

`X509_STORE_up_ref`() returns 1 for success and 0 for failure.

# SEE ALSO

PKCS7_verify(3), SSL_CTX_set_cert_store(3), X509_load_cert_file(3), X509_LOOKUP_hash_dir(3), X509_OBJECT_get0_X509(3), X509_STORE_CTX_new(3), X509_STORE_get_ex_new_index(3), X509_STORE_load_locations(3), X509_STORE_set1_param(3), X509_STORE_set_verify_cb(3), X509_verify_cert(3)

# HISTORY

`X509_STORE_new`() and `X509_STORE_free`() first appeared in SSLeay 0.8.0 and have been available since OpenBSD 2.4.

`X509_STORE_up_ref`() first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 6.3.

June 8, 2025 | Debian