D2I_X509_EXTENSION(3)
π D2I_X509_EXTENSION(3) β Library Functions Manual π
okay bestie, so this is a page from the Library Functions Manual and it's literally all about d2i_X509_EXTENSION, i2d_X509_EXTENSION, d2i_X509_EXTENSIONS, and i2d_X509_EXTENSIONS β the little decode/encode squad for X.509 Extensions. stick with me, it's giving very much "DER bytes go in, struct comes out" energy β¨
πΈ NAME πΈ
d2i_X509_EXTENSION,i2d_X509_EXTENSION,d2i_X509_EXTENSIONS,i2d_X509_EXTENSIONSβ decode and encode X.509 Extensions. that's the whole vibe. π¦
β¨ SYNOPSIS β¨
the library is βlibcryptoβ and you get all of this from #include <openssl/x509.h> π
X509_EXTENSION *
d2i_X509_EXTENSION(X509_EXTENSION **val_out,
const unsigned char **der_in, long length);
int
i2d_X509_EXTENSION(X509_EXTENSION *val_in, unsigned char **der_out);
X509_EXTENSIONS *
d2i_X509_EXTENSIONS(X509_EXTENSIONS **val_out,
const unsigned char **der_in, long length);
int
i2d_X509_EXTENSIONS(X509_EXTENSIONS *val_in, unsigned char **der_out);
π DESCRIPTION π
so here's the tea π΅ β d2i_X509_EXTENSION() and i2d_X509_EXTENSION() are your decode-and-encode duo for an ASN.1 Extension structure, and that structure is defined in RFC 5280 section 4.1. iconic behavior, no notes.
then we've got d2i_X509_EXTENSIONS() and i2d_X509_EXTENSIONS(), which decode and encode an ASN.1 Extensions structure β also from RFC 5280 section 4.1 β and bestie that one is literally a SEQUENCE OF Extension. a whole little group chat of extensions, fr fr. π
π«Ά RETURN VALUES π«Ά
d2i_X509_EXTENSION()hands you back anX509_EXTENSIONobject, orNULLif something goes wrong πd2i_X509_EXTENSIONS()hands you back anX509_EXTENSIONSobject, orNULLif something goes wrong, same deal πi2d_X509_EXTENSION()andi2d_X509_EXTENSIONS()return the number of bytes successfully encoded, or a negative value if an error occurs. so if you see a negative number, that's your vibe check failing π
π SEE ALSO π
go read these next, iyk yk:
β STANDARDS β
RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile β yes that's the full name, she's fancy like that π
π¦ HISTORY π¦
d2i_X509_EXTENSION()andi2d_X509_EXTENSION()first appeared in SSLeay 0.6.2 and have been available since OpenBSD 2.4. ancient. vintage. lowkey elder emoji π§d2i_X509_EXTENSIONS()andi2d_X509_EXTENSIONS()first appeared in OpenSSL 0.9.8h and have been available since OpenBSD 4.5. a slightly younger icon β¨
and that's the whole page, bestie β this edition came from Debian, dated June 8, 2025, slay ππ see you in the next manpage π«Ά
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2016 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