Let's pretend we create a passphrase protected PEM file using openssl:

$ openssl genrsa -aes256 -passout pass:password -out sample.pem 2048

And then extract the private key in DER format:

$ openssl rsa -in sample.pem -out sample.prv.der -outform DER

Is sample.prv.der still encrypted using the passphrase?

  • 2
    $\begingroup$ OpenSSL's 'legacy' privatekey formats, including PKCS1 for RSA, cannot be encrypted in DER form. If you want DER and encryption (PBE), use PKCS8. Or possibly PKCS12, although commandline can create PKCS12 only with both privatekey and cert/chain; doing privatekey alone requires writing a few lines of code. $\endgroup$ Commented Aug 21, 2016 at 16:24

1 Answer 1


No, it will output the PKCS#1 compatible encoding of the private key, try this:

openssl asn1parse -inform DER -in sample.prv.der

it will output an ASN.1 sequence of:

  • a version number (00);
  • the modulus;
  • the public exponent;
  • the private exponent;
  • the CRT parameters.

It did ask you for the password, right?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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