PEM_read_bio_X509 does not read TRUSTED CERTIFICATE PEM blocks despite documentation
Author: abzalovCreated Sep 28, 2026Updated Sep 28, 2026
Labelsissue: bug report
The documentation (https://docs.openssl.org/master/man3/PEM_read_bio_PrivateKey/) for the PEM_read_bio_X509 function says: The X509 functions process an X509 certificate using an X509 structure. They will also process a trusted X509 certificate but any trust settings are discarded.
However, PEM_read_bio_X509 returns NULL when the input contains a single valid -----BEGIN TRUSTED CERTIFICATE----- block. The error queue reports "error:0480006C:PEM routines::no start line". Reading the same input file with PEM_read_bio_X509_AUX succeeds.
The paragraph in the documentation states that the trust certificate will be successfully read, with the exception of its auxiliary trust settings. But that isn’t happening.
- OpenSSL version: OpenSSL 3.6.0 1 Oct 2025 (Library: OpenSSL 3.6.0 1 Oct 2025) built on: Wed Oct 8 20:29:58 2025 UTC platform: VC-WIN64A options: bn(64,64) compiler: cl /Z7 /Fdossl_static.pdb /Gs0 /GF /Gy /MD /W3 /wd4090 /nologo /O2 -DL_ENDIAN -DOPENSSL_PIC -D"OPENSSL_BUILDING_OPENSSL" -D"OPENSSL_SYS_WIN32" -D"WIN32_LEAN_AND_MEAN" -D"UNICODE" -D"_UNICODE" -D"_CRT_SECURE_NO_DEPRECATE" -D"_WINSOCK_DEPRECATED_NO_WARNINGS" -D"NDEBUG" -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32_WINNT=0x0502
- Platform: Windows
Source: openssl/openssl