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

# libressl-X509\_STORE\_new(3)

allocate and free X.509 certificate stores

## NAME

**X509\_STORE\_new**, **X509\_STORE\_up\_ref**, **X509\_STORE\_free** – allocate and free X.509 certificate stores

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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