On Thu, Jul 24, 2014 at 06:13:45AM -0700, phildoch wrote:

> I currently have a short program that converts a certificate from pem format
> to der format.

PEM and DER are strictly speaking encodings, not formats.  The
underlying data is identical, an ASN.1 DER X.509v3 certificate,
which in the PEM case is converted to base64 and enclosed in
"-----BEGIN CERTIFICATE" ... "-----END CERTIFICATE" armour.

> I would like to do the same, i.e. convert from pem to der, for a private key
> file.

This is a more complex question, because now you really need to
think about formats.  Private keys can be in algorithm-specific
PEM formats, algorithm neutral PKCS8 format, PKCS12 format (key +
certificate chain, and other metadata) Microsoft's PVK format, ...

So you need to decide on the right format first, and then worry
about which encodinds (PEM vs. binary ASN.1 DER) that format
supports.

What key format is needed by the system that will be using the key?

-- 
        Viktor.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to