The difference between cert and key is more significant than between PEM and DER. If you have a (X.509) cert in PEM and want publickey *in X.509 form* in DER (the SubjectPublicKeyInfo defined by X.509 and used by openssl as PUBKEY, and maybe others but not necessarily all) openssl x509 -in cert.pem -pubkey -noout -out pubkey.pem openssl rsa -in pubkey.pem -pubin -out pubkey.der -outform der Note that this works for only the first cert (and pubkey) in a file. If you have several in PEM, split them into separate files. Although DER is in fact selfdelimiting, almost never is more than one DER in a file supported. openssl can also support the 'legacy' RSA-only PKCS#1 form; ask if you want that.
_____ From: [email protected] [mailto:[email protected]] On Behalf Of Gibbs, Pierce M (IS) (Contr) Sent: Wednesday, 20 March, 2013 13:43 To: [email protected] Subject: extracting public key in DER format from PEM cert I have certificates in PEM format and my code is expecting DER formatted keys. How can I covert from PEM to DER in my code? thanks
