X509_FIND_BY_SUBJECT(3)
π X509_FIND_BY_SUBJECT(3) π
okay so bestie, welcome to X509_FIND_BY_SUBJECT(3), the little corner of the library that's literally just certificate searching and honestly? it eats. β¨
so picture this: you've got a whole stack of X.509 certs and you're like "which one of u is the one i want π" β that's the whole vibe here. two functions, both absolute main character energy, both doing the find-y thing. π
β¨ SYNOPSIS β¨
#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);
like yes, that's the whole thing, no cap π«Ά
πΈ DESCRIPTION πΈ
X509_find_by_subject()
searches the variable-sized array sk for a certificate with a matching subject name. that's it, that's the function. it's giving simple, effective, iconic. π
X509_find_by_issuer_and_serial()
searches the array for a certificate where both the issuer name and the serial number match the arguments. two conditions, no shortcuts, she's thorough. π
ok but lowkey important: it wants a match on both things, not one or the other. don't come for her with a half-match, she will not accept it π
β RETURN VALUES β
these functions return a pointer to the first matching certificate π₯
or NULL if:
skisNULL, orskdoesn't contain a matching certificate π
so yeah, check for NULL before you go dereferencing like a menace. be so fr. π
π¦ 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)
all the besties in the friend group, go say hi π«Άβ¨
π HISTORY π
these functions first appeared in SSLeay 0.8.1 and have been available since OpenBSD 2.4. so they're basically vintage, which honestly just makes them cooler. iykyk π
and that's the page, bestie!! πβ¨ this lil doc came to you from the Debian squad, dated July 4, 2021 β like, go off, iconic date, hope you had a nice one πΈπ now go find those certificates, you absolute legend π
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· 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