X509_STORE_C...ET_BY_SUBJECT(3ossl)
π 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 aconst X509_STORE_CTX *vsand the second takes a non-constX509_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()β returns1if the lookup was successful, else0. classic int-return behaviour, no surprises πX509_STORE_CTX_get_obj_by_subject()β returns an object on success, elseNULL. so like, check it before you dereference it, obviously π
π¦ SEE ALSO π¦
go read these next, they're the vibe-adjacent ones:
π COPYRIGHT π
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
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms