RustCrypto / hashes

Collection of cryptographic hash functions written in pure Rust
1.88k stars 253 forks source link

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

Closed baloo closed 3 months ago

baloo commented 6 months ago

This implements AlgorithmIdentifier according to RFC5754 section 2

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

baloo commented 6 months 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