PEM_X509_INFO_READ_BIO_EX(3ossl)
π PEM_X509_INFO_READ_BIO_EX(3ossl) π
okay so bestie, welcome to the <openssl/pem.h> chapter of your life β this is the family of functions that slurps PEM-encoded stuff out of a file or a BIO and hands you back a whole stack of X509_INFO objects. yes, that X509_INFO. the glow-up container. let's get into it β¨
πΈ 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 π
π¦ 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);
π DESCRIPTION π
PEM_X509_INFO_read_ex()β loads theX509_INFOobjects out of a file,fp. file girlies rise πPEM_X509_INFO_read()β literally the same vibe asPEM_X509_INFO_read_ex(), except it rolls with the default (NULL) library contextlibctxand an empty property querypropq. the no-frills edition.PEM_X509_INFO_read_bio_ex()β loads theX509_INFOobjects using abio(that's theBIO *bioin the synopsis, bestie, keep up π«Ά).PEM_X509_INFO_read_bio()β same energy asPEM_X509_INFO_read_bio_ex(), but again with the default (NULL) library contextlibctxand empty property querypropq.
π so what's actually in an X509_INFO?
Each of the loaded X509_INFO objects can hold a CRL, a certificate, and/or a private key β like, all the things π₯
The elements get read sequentially, and as far as they're of a different type than the elements read before them, they get combined into the same X509_INFO object. The idea behind this is that if, for instance, a certificate is followed by a private key, the private key is supposed to correspond to the certificate. it's giving soulmate matching ngl π
π§ the input stack sk
If the input stack sk is NULL, a new stack gets allocated. otherwise? the given stack is extended. either way you eat π
π the password callback: cb and u
The optional cb and u parameters can be used for providing a pass phrase needed for decrypting encrypted PEM structures (normally only private keys). see PEM_read_bio_PrivateKey(3) and passphrase-encoding(7) for the deets, iykyk.
π the fancy provider bits: libctx and propq
The library context libctx and property query propq are used for fetching algorithms from providers. very main character energy of them.
β 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 π
fr fr, always check for that NULL. do not be out here dereferencing a failed read, bestie. that's not the slay you think it is π
π SEE ALSO π
πΈ HISTORY πΈ
The functions PEM_X509_INFO_read_ex() and PEM_X509_INFO_read_bio_ex() were added in OpenSSL 3.0. the OGs remember before that π
π 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>.
π¦ that's the whole page, bestie! go read some PEM files responsibly β¨
OpenSSL 3.5.0 Β· 2026-09-25 Β· mwah π thanks for reading, you ate π
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms