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

# libressl-X509\_find\_by\_subject(3)

search an array of X.509 certificates

## NAME

**X509\_find\_by\_subject**, **X509\_find\_by\_issuer\_and\_serial** – search an array of X.509 certificates

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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

*X509* *\**\

**X509\_find\_by\_subject**(*STACK\_OF(X509) \*sk*, *X509\_NAME \*subject*);

*X509* *\**\

**X509\_find\_by\_issuer\_and\_serial**(*STACK\_OF(X509) \*sk*, *X509\_NAME \*issuer*, *ASN1\_INTEGER \*serial*);

## DESCRIPTION

**X509\_find\_by\_subject**() searches the variable-sized array *sk* for a certificate with a matching *subject* name.

**X509\_find\_by\_issuer\_and\_serial**() searches the array for a certificate where both the *issuer* name and the *serial* number match the arguments.

## RETURN VALUES

These functions return a pointer to the first matching certificate or NULL if *sk* is NULL or does not contain a matching certificate.

## SEE ALSO

ASN1\_INTEGER\_new(3), STACK\_OF(3), X509\_cmp(3), X509\_get\_serialNumber(3), X509\_get\_subject\_name(3), X509\_NAME\_new(3), X509\_new(3)

## HISTORY

These functions first appeared in SSLeay 0.8.1 and have been available since OpenBSD 2.4.
