I wonder how I can use openssl to output PEM or DER formatted keys that Ed25519KeyPair::from_pkcs8 can read as input. I've tried openssl genpkey -algorithm ED25519 but that gives me a WrongAlgorithm error. The RSA key documentation has an openssl command listed, but none is listed for ed25519.
Ed25519KeyPair::from_pkcs8_maybe_unchecked should be able to read OpenSSL-generated keys (PKCS#8 v1).
Ed25519KeyPair::from_pkcs8 can read the PKCS#8 v2 keys generated by Ed25519KeyPair::generate_pkcs8.
To clarify further, Ed25519KeyPair::from_pkcs8_maybe_unchecked can read both v1 and v2 keys. Ed25519KeyPair::from_pkcs8 can only read v2 keys because only v2 keys have the public key for the consistency check.
@briansmith yes, that's what the docs say. It would be helpful though to state that openssl genpkey -algorithm ED25519 generates v1 keys.
One can use kt to generate PKCS#8 v2 keys:
cargo install kt
kt generate ed25519 --out ed25519.k8
Addressed in b29699ca0d78b07186d6d4f9c3a83d62faa1b242.
@briansmith Where can I find the kt repository? Was the code migrated to another project?
Most helpful comment
One can use kt to generate PKCS#8 v2 keys: