[openssl-users] get type of PEM data

Matt Caswell matt at openssl.org
Wed Mar 28 19:04:30 UTC 2018

Take a look at the new STORE functions in 1.1.1. They do something like
what you are describing. They can take a URI and load whatever objects
it finds there using the right kind of loader based on the PEM type. You
can also search for particular objects in your store. See:



On 28/03/18 16:02, Jordan Brown wrote:
> I'm finding that it would be helpful to have a function that would,
> given PEM data (in memory or in a file) return an indication of what
> kind of object it represents:  a certificate, a private key, et cetera. 
> The ideal function would basically tell me which PEM_read_bio_foobar
> function I would use to read the PEM data (and thus what C type it
> represents).  It would lump all private key formats into one type, since
> PEM_read_PrivateKey would work on all of them and return an EVP_PKEY.
> Does such a function already exist?  Any thoughts?
> -- 
> Jordan Brown, Oracle Solaris

More information about the openssl-users mailing list