X509_STORE_C...ET_BY_SUBJECT(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… X509_STORE_C...ET_BY_SUBJECT(3ossl) β€” bestie, let's go look things up

okay so first things first: yes, the title up there is literally truncated with ... in the middle, that's not a typo on my end, that's just how the page is named. iykyk. This is the 3ossl manual, and it's giving "i need to find an X509 or an X509_CRL in a store, and i need it now" energy. Let's get into it πŸŽ€


✨ NAME ✨

X509_STORE_CTX_get_by_subject, X509_STORE_CTX_get_obj_by_subject β€” the X509 and X509_CRL lookup functions, aka the "bestie, go find me that object" duo πŸ¦‹


🌸 SYNOPSIS 🌸

#include <openssl/x509_vfy.h>

int X509_STORE_CTX_get_by_subject(const X509_STORE_CTX *vs,
                                  X509_LOOKUP_TYPE type,
                                  const X509_NAME *name, X509_OBJECT *ret);
X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs,
                                               X509_LOOKUP_TYPE type,
                                               const X509_NAME *name);

two functions, both taking a store context, a type, and a name. one fills in a pointer you gave it, one just hands you the object directly. choose your fighter πŸ’…


πŸ”₯ DESCRIPTION πŸ”₯

X509_STORE_CTX_get_by_subject() β€” the "put it in this box" one

X509_STORE_CTX_get_by_subject() tries to find an object of given type, which may be X509_LU_X509 or X509_LU_CRL, and subject name from the store in the provided store context vs.

and like, the way that it actually works: if it's found and ret is not NULL, it increments the reference count and stores the looked up object in ret. so it's not just pointing at something and running away β€” it's doing the responsible refcount-incrementing thing. we love a function with manners 🫢

X509_STORE_CTX_get_obj_by_subject() β€” the "just give me the thing" one

X509_STORE_CTX_get_obj_by_subject() is like X509_STORE_CTX_get_by_subject() but returns the found object on success, else NULL.

that's literally it. same lookup, different delivery method. one says "here, i filled in your ret for you," the other says "catch." ⭐

little detail that matters: notice the first function takes a const X509_STORE_CTX *vs and the second takes a non-const X509_STORE_CTX *vs. that's not me being sloppy, that's exactly how they're declared in the synopsis. copy it as-is, bestie 😭

πŸ‘‘ RETURN VALUES πŸ‘‘

  • X509_STORE_CTX_get_by_subject() β€” returns 1 if the lookup was successful, else 0. classic int-return behaviour, no surprises 🌈
  • X509_STORE_CTX_get_obj_by_subject() β€” returns an object on success, else NULL. so like, check it before you dereference it, obviously πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

go read these next, they're the vibe-adjacent ones:


Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


pink legal note incoming, do not skip it: the license text above is verbatim and it means what it means β€” if you're not complying with the License, you're not allowed to use this file. periodt. πŸŽ€


and that's the whole page, mwah πŸ’‹ this was OpenSSL 3.5.6, dated 2026-04-0X, and yes the date in the original footer is literally cut off like that β€” 2026-04-0X β€” so i'm passing it to you exactly as written, character for character. go look up your subjects, bestie, you've got this 🧚✨

πŸ“¦ where this page comes from