RustCrypto / hashes

Collection of cryptographic hash functions written in pure Rust
1.75k stars 238 forks source link

sha2: provide support for `spki::AlgorithmIdentifier` #586

Open baloo opened 1 month ago

baloo commented 1 month ago

This implements AlgorithmIdentifier according to RFC5754 section 2

Depends on https://github.com/RustCrypto/traits/pull/1575

baloo commented 1 month ago

From the RFC:

   The AlgorithmIdentifier parameters field is OPTIONAL.
   Implementations MUST accept SHA2 AlgorithmIdentifiers with absent
   parameters.  Implementations MUST accept SHA2 AlgorithmIdentifiers
   with NULL parameters.  Implementations MUST generate SHA2
   AlgorithmIdentifiers with absent parameters.

This implementation generates AlgorithmIdentifier with parameters absent, but it would be nice if we could also provide a PartialEq that accepted NULL parameters.

(same situation exists in https://www.rfc-editor.org/rfc/rfc3370#section-2.1 for Sha1)

cc @carl-wallace