D2I_X509_EXTENSION(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’… 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 an X509_EXTENSION object, or NULL if something goes wrong 😭
  • d2i_X509_EXTENSIONS() hands you back an X509_EXTENSIONS object, or NULL if something goes wrong, same deal πŸ’€
  • i2d_X509_EXTENSION() and i2d_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() and i2d_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() and i2d_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