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?
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