Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    $\begingroup$ OpenSSL supports 'generic' PKCS8 private and X.509/PKIX/SPKI public formats for all algorithms and 'traditional' format(s) for some algorithms: for RSA it uses PKCS1 both private and public, for DSA (and DH) something Eric invented for private only, for ECDSA/ECDH SECG SEC1 (aka rfc5915) for private only, and for Bernstein algorithms there is no traditional. Only private keys are encrypted (except PKCS12 which OpenSSL commandline can export or import but not use directly); PKCS8 in either PEM or DER but traditional only in PEM. $\endgroup$ Commented Jan 5, 2023 at 2:28
  • $\begingroup$ @dave_thompson_085 Would you agree the first pic in my OP is PKCS#8 and the last pic is PKCS#1? $\endgroup$ Commented Jan 5, 2023 at 2:31
  • $\begingroup$ Also the default formats written vary for different subcommands in openssl commandline, and in some case have changed over time, so you need to be clear what version(s) you did or will use. $\endgroup$ Commented Jan 5, 2023 at 2:33
  • $\begingroup$ Yes, and that's why the PEM labels are BEGIN/END PRIVATE KEY (= PKCS8 unencrypted) and BEGIN/END RSA PRIVATE KEY (=PKCS1, either unencrypted or encrypted but in your case unencrypted). $\endgroup$ Commented Jan 5, 2023 at 2:35
  • 1
    $\begingroup$ No, the generic (= AlgId + BITSTRING) public format is as I referenced the 'SPKI' (SubjectPublicKeyInfo) portion of X.509/PKIX defined e.g. in rfc5280 4.1 and 4.1.2.7 which for RSA contains the structure that actually is PKCS1 RSAPublicKey although rfc3279 2.3.1 referenced by Maarten doesn't call it by that name. $\endgroup$ Commented Jan 5, 2023 at 7:04