iotaledger / identity.rs

Implementation of the Decentralized Identity standards such as DID and Verifiable Credentials by W3C for the IOTA Tangle.
https://www.iota.org
Apache License 2.0
303 stars 87 forks source link

Add a `verify_prehashed` method to `identity.rs`'s JWS verifiers #1420

Closed UMR1352 closed 2 weeks ago

UMR1352 commented 1 month ago

Description of change

Enable pre-hash verification for EcDSA verifier. Small refactor for JWS verifiers.

Links to any relevant issues

Fixes issue #1418

Type of change

How the change has been tested

Ran tests

Change checklist

UMR1352 commented 1 month ago

Unfortunately implementing pre-hash verification for for our EdDSA verifier is not as straight forward. At the moment there's only one Rust crate that allows Ed2219 pre-hash verification - i.e. ed25519-dalek but the requirements to call its validate_prehashed are way too strict.

The data to be verified must be passed to the function as a type D: Digest where Digest requires 4 more traits in order to be implemented.

UMR1352 commented 2 weeks ago

After some discussion with the team we decided to ditch this feature as we want the JWS verifiers we provide with the library to only support verification of spec-compliant signatures (e.g. ES256 -> P256 + SHA256 and no other hashing algorithm). We still do support the verification of custom signatures through our JwsSigner trait.