If there is both private key and certificate in a file and it is read by calling PEM_read_bio_PrivateKey() and then PEM_read_bio_X509(), the X509 decoding will fail with the current master because when decoding the key the file is completely read and the X509 decoding does not have any data to read.