Skip to content

Incorrect behavior when using from_ec_der with rust-crypto provider #497

Description

@OmniacDev

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());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions