Export openssl cert public key to DER format

androidapache-2.2exportimportopenssl

i'm looking for a way to export my openssl certificate (the public part) used by apache2 (.pem file) to import it to an android device's credential storage (Settings menu> Security > Credential storage > Install from device storage) as explained here http://davdroid.bitfire.at/configuration#c77

what's the proper openssl command line to export it in the desired format (DER)?

Best Answer

OpenSSL maintains a hints page for this:

https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them :

PEM to DER

openssl x509 -in cert.crt -outform der -out cert.der