That is, would you ever find a PEM file which starts:
-----BEGIN DH PRIVATE KEY-----
or:
-----BEGIN DH PUBLIC KEY-----
?
And if so, what is its structure?
I know static DH keys are an oddity, and perhaps even extinct. And i know you can put a DH private key inside a PKCS#8 wrapper, and that you can put a DH public key in an X.509 certificate, or have it as a loose X.509-style public key - or at least, than OpenSSL knows how to do it! But i can't find any reference to anyone ever using the older format for static DH keys.
The reason i ask is that i'm writing some code that takes keys as input, and i'd like to support a wide a range of keys as possible. I can handle keys for the RSA, DSA, EC and DH algorithms. As for formats, i support:
- PKCS#8 format for private keys
- X.509 PublicKeyInfo format (as produced by
openssl pkey
) for public keys - PKCS#1 for RSA private keys
- PKCS#1-like for DSA private keys (as produced by
openssl dsaparam -genkey
) - PKCS#1-like for EC private keys (as produced by
openssl ecparam -genkey
)
I'm trying to work out of there's a PKCS#1-like format for DH private keys as well, because if there is, i should support it.