X509_FIND_BY_SUBJECT(3)

πŸ“¦ version 4.1.0, in opensuse-leap 16.0

πŸ’… 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:

  • sk is NULL, or
  • sk doesn't contain a matching certificate 😭

so yeah, check for NULL before you go dereferencing like a menace. be so fr. πŸ’€


πŸ¦‹ SEE ALSO πŸ¦‹

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