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

# libressl-X509\_load\_cert\_file(3)

read, decode, and cache certificates and CRLs

## NAME

**X509\_load\_cert\_file**, **X509\_load\_crl\_file**, **X509\_load\_cert\_crl\_file** – read, decode, and cache certificates and CRLs

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/x509\_vfy.h\>**

*int*\

**X509\_load\_cert\_file**(*X509\_LOOKUP \*ctx*, *const char \*file*, *int type*);

*int*\

**X509\_load\_crl\_file**(*X509\_LOOKUP \*ctx*, *const char \*file*, *int type*);

*int*\

**X509\_load\_cert\_crl\_file**(*X509\_LOOKUP \*ctx*, *const char \*file*, *int type*);

## DESCRIPTION

**X509\_load\_cert\_file**() with a *type* of X509\_FILETYPE\_PEM reads one or more certificates in PEM format from the given *file* using PEM\_read\_bio\_X509\_AUX(3); with a type of X509\_FILETYPE\_ASN1, if reads one certificate in DER format using d2i\_X509\_bio(3). The certificates read are added to the *X509\_STORE* memory cache object associated with the given *ctx* using X509\_STORE\_add\_cert(3).

**X509\_load\_crl\_file**() with a *type* of X509\_FILETYPE\_PEM reads one or more certificate revocation lists in PEM format from the given *file* using PEM\_read\_bio\_X509\_CRL(3); with a type of X509\_FILETYPE\_ASN1, if reads one certificate revocation lists in DER format using d2i\_X509\_CRL\_bio(3). The certificate revocation lists read are added to the *X509\_STORE* memory cache object associated with the given *ctx* using X509\_STORE\_add\_crl(3).

**X509\_load\_cert\_crl\_file**() with a *type* of X509\_FILETYPE\_PEM read one or more certificates and/or certificate revocation lists in PEM format from the given *file* using PEM\_X509\_INFO\_read\_bio(3) and adds them to the *X509\_STORE* memory cache object associated with the given *ctx* using X509\_STORE\_add\_cert(3) and X509\_STORE\_add\_crl(3), respectively.

**X509\_load\_cert\_crl\_file**() with a *type* of X509\_FILETYPE\_ASN1 is equivalent to **X509\_load\_cert\_file**() and cannot be used to read a certificate revocation list.

## RETURN VALUES

These functions return the number of objects loaded or 0 on error.

## SEE ALSO

d2i\_X509\_bio(3), PEM\_read\_PrivateKey(3), X509\_LOOKUP\_new(3), X509\_OBJECT\_get0\_X509(3), X509\_STORE\_load\_locations(3), X509\_STORE\_new(3)

## HISTORY

**X509\_load\_cert\_file**() first appeared in SSLeay 0.8.0 and **X509\_load\_crl\_file**() in SSLeay 0.9.0. These functions have been available since OpenBSD 2.4.

**X509\_load\_cert\_crl\_file**() first appeared in OpenSSL 0.9.5 and has been available since OpenBSD 2.7.
