When using DecodingKey::from_ec_der with the rust-crypto provider, it internally parses using from_sec1_bytes, instead of from_public_key_der.
|
<$verifying_key>::from_sec1_bytes(decoding_key.as_bytes()) |
So this, which is expected to work, fails:
let key: p384::ecdsa::VerifyingKey = ...;
let decoding_key = DecodingKey::from_ec_der(key.to_public_key_der().unwrap().as_bytes());
But this succeeds:
let key: p384::ecdsa::VerifyingKey = ...;
let decoding_key = DecodingKey::from_ec_der(&key.to_sec1_bytes());
When using
DecodingKey::from_ec_derwith therust-cryptoprovider, it internally parses usingfrom_sec1_bytes, instead offrom_public_key_der.jsonwebtoken/src/crypto/rust_crypto/ecdsa.rs
Line 60 in 9934c7f
So this, which is expected to work, fails:
But this succeeds: