X509_CRL_GET0_BY_SERIAL(3ossl)

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

πŸŽ€ X509_CRL_GET0_BY_SERIAL πŸŽ€

okay so this is the 3ossl page, and bestie, it's literally all about CRL revoked entry utility functions β€” the lil' squad of calls that let you poke at the revoked-entries list inside a CRL without setting anything on fire πŸ”₯. Think of it as the group chat where certificates get left on read.


✨ NAME ✨

The whole friend group, no cap:

  • X509_CRL_get0_by_serial
  • X509_CRL_get0_by_cert
  • X509_CRL_get_REVOKED
  • X509_REVOKED_get0_serialNumber
  • X509_REVOKED_get0_revocationDate
  • X509_REVOKED_set_serialNumber
  • X509_REVOKED_set_revocationDate
  • X509_CRL_add0_revoked
  • X509_CRL_sort

collectively known as the CRL revoked entry utility functions. iconic behavior honestly πŸ’…


🌸 SYNOPSIS 🌸

#include <openssl/x509.h>

int X509_CRL_get0_by_serial(X509_CRL *crl,
                            X509_REVOKED **ret, const ASN1_INTEGER *serial);
int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);

STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl);

const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *r);
const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *r);

int X509_REVOKED_set_serialNumber(X509_REVOKED *r, ASN1_INTEGER *serial);
int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);

int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);

int X509_CRL_sort(X509_CRL *crl);

πŸ¦‹ DESCRIPTION πŸ¦‹

⚠️ heads up before we go anywhere: this whole page is borrowed pointers city. get0 and add0 are not vibing with your free() calls, bestie. read the ownership notes fr fr.
  • X509_CRL_get0_by_serial() β€” tries to find a revoked entry in crl for the serial number serial. If it slays (i.e. succeeds), it sets *ret to the internal pointer of the matching entry. And because it's an internal pointer, *ret MUST NOT be freed after the call. it's not yours, it's the CRL's 😭
  • X509_CRL_get0_by_cert() β€” similar to X509_get0_by_serial() (yes, that's literally what the page says πŸ’€) except it looks for a revoked entry using the serial number of certificate x.
  • X509_CRL_get_REVOKED() β€” hands you an internal pointer to a STACK of all revoked entries for crl. the whole roster, no filter 🫢
  • X509_REVOKED_get0_serialNumber() β€” returns an internal pointer to the serial number of r.
  • X509_REVOKED_get0_revocationDate() β€” returns an internal pointer to the revocation date of r.
  • X509_REVOKED_set_serialNumber() β€” sets the serial number of r to serial. the supplied serial pointer is not used internally, so you should free it after use. it did its job, let it go ✨
  • X509_REVOKED_set_revocationDate() β€” sets the revocation date of r to tm. the supplied tm pointer is not used internally, so it should be freed after use too.
  • X509_CRL_add0_revoked() β€” appends revoked entry rev to CRL crl. the pointer rev is used internally, so it MUST NOT be freed after the call β€” it gets freed when the parent CRL is freed. it's adopted now, it lives there 🏑
  • X509_CRL_sort() β€” sorts the revoked entries of crl into ascending serial number order. tidy queen behavior πŸ‘‘

πŸ’œ NOTES πŸ’œ

Applications can figure out how many revoked entries X509_CRL_get_REVOKED() handed back by using sk_X509_REVOKED_num(), and then examine each one in turn with sk_X509_REVOKED_value(). loop girlies rise up πŸŒ€


πŸ”₯ RETURN VALUES πŸ”₯

  • X509_CRL_get0_by_serial() and X509_CRL_get0_by_cert() return 0 for failure, 1 on success β€” except if the revoked entry has the reason "removeFromCRL" (8), in which case 2 is returned. yeah. three whole outcomes. read the number, don't assume 😭
  • X509_CRL_get_REVOKED() returns a STACK of revoked entries.
  • X509_REVOKED_get0_serialNumber() returns an ASN1_INTEGER structure.
  • X509_REVOKED_get0_revocationDate() returns an ASN1_TIME structure.
  • X509_REVOKED_set_serialNumber(), X509_REVOKED_set_revocationDate(), X509_CRL_add0_revoked() and X509_CRL_sort() return 1 for success and 0 for failure. classic 1-or-0 situation, very demure πŸ’…

🌈 SEE ALSO 🌈

the extended universe, go read these next (iykyk):


Copyright 2015-2020 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>.


okay that's the whole page bestie, go forth and don't free the internal pointers πŸ’– this gem is from OpenSSL 3.5.6, dated 2026-04-07 β€” signed, sealed, and delivered with love πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from