Jwk::from_encoding_key returns `InvalidEddsaKey` for an Ed25519 private key in PKCS#8 v2 format. In `src/jwk.rs`, the EdDSA branch of `Jwk::from_encoding_key` works out the curve from the length of the whole PKCS#8 DER document: ```rust let curve_type: EllipticCurve = match key.as_bytes().len() { // 16 byte header + 32 byte Ed25519 key 48 => Ok(EllipticCurve::Ed25519), _ => Err(Error::from(ErrorKind::InvalidEddsaKey)), }?; ``` A v1 Ed25519 key is exactly 48 bytes. A v2 key is longer because it includes the public key field, so it fails this check.
Activity
test: use pkcs#8 v1 for EdDSA `sk_pem`
[-]Jwk::from_encoding_key rejects PKCS#8 v2 (RFC 5958) Ed25519 private keys[/-][+]`Jwk::from_encoding_key` rejects PKCS#8 v2 (RFC 5958) Ed25519 private keys[/+]arckoor commentedon Sep 28, 2026
Yup, see discussion here
test: use pkcs#8 v1 for EdDSA `sk_pem`
test: use pkcs#8 v1 for EdDSA `sk_pem`