Вот соответствующая часть из ссылки @Reinier Torenbeek:
STACK_OF(X509_INFO) *certstack;
const char ca_filestr[] = "./cabundle.pem";
stackbio = BIO_new(BIO_s_file());
outbio = BIO_new_fp(stdout, BIO_NOCLOSE);
/* ---------------------------------------------------------- *
* Load the file with the list of certificates in PEM format *
* ---------------------------------------------------------- */
if (BIO_read_filename(stackbio, ca_filestr) <= 0) {
BIO_printf(outbio, "Error loading cert bundle into memory\n");
exit(-1);
}
certstack = PEM_X509_INFO_read_bio(stackbio, NULL, NULL, NULL);