Files
swift-certificates/Sources/X509/CryptographicMessageSyntax
Nicolas BachschmidtandCory Benfield 88ced31d9d Use proper hash when computing message digest in signed attributes (#219)
Per [RFC 5652 §
11.2](https://datatracker.ietf.org/doc/html/rfc5652#section-11.2):

"For signed-data, the message digest is computed using the signer's
message digest algorithm."

Currently, when computing the signed attributes' message digest,
`CMS.sign` assumes the digest algorithm is SHA256, which is incorrect.
The behavior of `CMS.isValid` is already correct and doesn't need
updating. I've made `Digest` conform to `Sequence` to facilitate the
conversion/comparison of the message digest.

---------

Co-authored-by: Cory Benfield <lukasa@apple.com>
2025-01-16 16:41:23 +00:00
..