Re: [openssl-users] get type of PEM data

2018-03-30 Thread Jordan Brown
On 3/29/2018 1:08 AM, Richard Levitte wrote: > In message <1ce93d56-6fa4-1bae-d440-5ab843900...@jordan.maileater.net> on > Wed, 28 Mar 2018 17:10:40 -0700, Jordan Brown > said: > > openssl> Matt: Indeed, looks very promising. Now if only we were on > openssl> 1.1.1

Re: [openssl-users] get type of PEM data

2018-03-29 Thread Jakob Bohm
On 29/03/2018 10:08, Richard Levitte wrote: In message <1ce93d56-6fa4-1bae-d440-5ab843900...@jordan.maileater.net> on Wed, 28 Mar 2018 17:10:40 -0700, Jordan Brown said: openssl> Matt: Indeed, looks very promising. Now if only we were on openssl> 1.1.1 :-(. I'm a

Re: [openssl-users] get type of PEM data

2018-03-29 Thread Richard Levitte
In message <1ce93d56-6fa4-1bae-d440-5ab843900...@jordan.maileater.net> on Wed, 28 Mar 2018 17:10:40 -0700, Jordan Brown said: openssl> Matt: Indeed, looks very promising. Now if only we were on openssl> 1.1.1 :-(. I'm a little surprised that it doesn't read from a

Re: [openssl-users] get type of PEM data

2018-03-28 Thread Jordan Brown
Thanks, all. Michael:  Yeah, that was my fallback idea, but I really didn't want my application to have to know about every "---BEGIN" line for every type of private key.  (And similarly if there's more than one kind of certificate, but I don't think there is.) Viktor, Richard:  PEM_read_bio

Re: [openssl-users] get type of PEM data

2018-03-28 Thread Richard Levitte
In message on Wed, 28 Mar 2018 08:02:37 -0700, Jordan Brown said: openssl> I'm finding that it would be helpful to have a function that openssl> would, given PEM data (in memory or in a file) return an

Re: [openssl-users] get type of PEM data

2018-03-28 Thread Matt Caswell
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:

Re: [openssl-users] get type of PEM data

2018-03-28 Thread Viktor Dukhovni
> On Mar 28, 2018, at 11:02 AM, 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,

Re: [openssl-users] get type of PEM data

2018-03-28 Thread Michael Wojcik
enum pem_type { PEM_TYPE_NONE = 0, PEM_TYPE_CERTIFICATE, PEM_TYPE_RSA_PRIVATE }; struct pem_map { enum pem_type type; const char *pem_string; }; #include enum pem_type identify_pem(const char *pem) { static const struct pem_map map[] = {