X509_FIND_BY_SUBJECT(3)
π X509_FIND_BY_SUBJECT(3) π
ok so bestie, this is a page from the Library Functions Manual for a couple of cert-hunting functions in libcrypto. No preamble needed, we're jumping straight in π«Ά
β¨ NAME β¨
X509_find_by_subject, X509_find_by_issuer_and_serial β search an array of X.509 certificates ππ
πΈ SYNOPSIS πΈ
First thing's first, you gotta link the library and pull in the header, like:
library βlibcryptoβ
#include <openssl/x509.h>
Then, the two icons themselves:
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 π¦
Okay so picture this: you've got a whole variable-sized array sk full of certificates, and you need one of them. That's literally the whole plot π
X509_find_by_subject()β it goes throughsklooking for a certificate whose subject name matches. That's it, that's the mission. subject match = found bestie πX509_find_by_issuer_and_serial()β this one's pickier. It searches the array for a certificate where both the issuer name and the serial number match the arguments. Two boxes to tick, no shortcuts β¨
π RETURN VALUES π
Both of these cuties return a pointer to the first matching certificate β first one wins, no queue-jumping π
And if sk is NULL? Or the array just doesn't have a match? You get NULL back. That's the whole vibe check. π
π SEE ALSO π
Go read these next, iykyk:
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. absolute elders, we respect them π«‘π
and that's the page!! mwah π this one's from Debian, dated June 8, 2025 β ty for reading, go find those certificates bestie π§ββοΈππ
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms