10

I tried using one and it failed. Converting it to PEM works fine. Our users upload the certificates to our server, and we are wondering if we can configure nginx so that it supports both. If not, is there a way to programmatically determine if the certificate file is in DER or PEM format?

8

Nginx doesn't support DER format.

If not, is there a way to programmatically determine if the certificate file is in DER or PEM format?

You can use command file to determine certificate format

# file www.example.net.der
www.example.net.der: data

# file www.example.net.pem
www.example.net.pem: ASCII text

PEM are Base64 encoded ASCII files while DER format is simply a binary form of a certificate instead of the ASCII PEM format

You can convert DER -> PEM with openssl

# openssl x509 -inform DER -in www.example.net.der -outform PEM -out www.example.net.pem
  • You can also use openssl command line to determine if the cert file is in DER or PEM format. 'CERT_TYPE='Unknown' ; openssl x509 -in certificate.der -inform der -text -noout && CERT_TYPE='DER' – Rik Schneider Aug 30 '13 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.