PEM_X509_INFO_READ_BIO_EX(3ossl)
π PEM_X509_INFO_READ_BIO_EX π
okay so bestie, this one's from the OpenSSL manual, section 3ossl, and it's literally all about the PEM β¨info readingβ¨ girlies: PEM_X509_INFO_read_ex, PEM_X509_INFO_read, PEM_X509_INFO_read_bio_ex, and PEM_X509_INFO_read_bio. four functions, one job, and that job is pulling PEM-encoded stuff out of a file or a BIO and turning it into one or more X509_INFO objects. no cap. π
πΈ NAME πΈ
PEM_X509_INFO_read_ex, PEM_X509_INFO_read, PEM_X509_INFO_read_bio_ex, PEM_X509_INFO_read_bio β read PEM-encoded data structures into one or more X509_INFO objects. that's it, that's the whole vibe π
π¦ SYNOPSIS π¦
#include <openssl/pem.h>
STACK_OF(X509_INFO) *PEM_X509_INFO_read_ex(FILE *fp, STACK_OF(X509_INFO) *sk,
pem_password_cb *cb, void *u,
OSSL_LIB_CTX *libctx,
const char *propq);
STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
pem_password_cb *cb, void *u);
STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio_ex(BIO *bio,
STACK_OF(X509_INFO) *sk,
pem_password_cb *cb, void *u,
OSSL_LIB_CTX *libctx,
const char *propq);
STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,
pem_password_cb *cb, void *u);
like, look at those return types. STACK_OF(X509_INFO) *. we love a pointer to a stack, it's giving organized π
β¨ DESCRIPTION β¨
so here's the tea, bestie π
PEM_X509_INFO_read_ex()β loads theX509_INFOobjects from a filefp. that's the whole thing, it just reads the file, iconic behavior.PEM_X509_INFO_read()β basically the same asPEM_X509_INFO_read_ex()except it uses the default (that'sNULL) library contextlibctxand an empty property querypropq. the no-frills version, lowkey.PEM_X509_INFO_read_bio_ex()β loads theX509_INFOobjects using a biobp. yes, BIO girlies get their own function, we stay fed π«ΆPEM_X509_INFO_read_bio()β same energy asPEM_X509_INFO_read_bio_ex()except again: default (that'sNULL) library contextlibctx, empty property querypropq.
now the actual juicy part π
Each of the loaded X509_INFO objects can contain a CRL, a certificate, and/or a private key. yes, and/or. the elements get read sequentially, and as long as they're a different type than the elements read before them, they get combined into the same X509_INFO object. the reasoning behind this? say it with me: if a certificate is followed by a private key, then the private key is supposed to correspond to the certificate. it's a matching set, bestie, it's giving couple goals π
about the input stack sk:
- if
skisNULLβ a new stack gets allocated, fresh out the box β¨ - if
skis notNULLβ the given stack gets extended, no replacement, just growth π±
and the optional cb and u parameters? those are for providing a pass phrase when you need to decrypt encrypted PEM structures (normally that's only private keys, iykyk π). for the full deets, go see PEM_read_bio_PrivateKey(3) and passphrase-encoding(7).
last but not least: the library context libctx and the property query propq are used for fetching algorithms from providers. periodt.
π₯ RETURN VALUES π₯
PEM_X509_INFO_read_ex(), PEM_X509_INFO_read(), PEM_X509_INFO_read_bio_ex() and PEM_X509_INFO_read_bio() return a stack of X509_INFO objectsβ¦ or NULL on failure π. that's the whole deal. if you get NULL, something went wrong, and no amount of manifesting will fix it. check your inputs.
π SEE ALSO π
go read those too, they're part of the lore π
π HISTORY π
the functions PEM_X509_INFO_read_ex() and PEM_X509_INFO_read_bio_ex() were added in OpenSSL 3.0. so yeah, they're the newer siblings, the _ex girlies came later and we're obsessed π
π COPYRIGHT π
Copyright 2020-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>.
okay that's the page bestie, go forth and read your PEM structures πΈ
this was OpenSSL 3.5.9, dated 2026-09-29, and the manual page is PEM_X509_INFO_READ_BIO_EX(3ossl) β mwah, slay, bye π
β¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms