-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix digest algorithm selection when hash func != cert hash.
Previously, this was deriving the hash to be used in the TSA response from the hash of the cert. But these are not guaranteed to be the same! Signers can choose to use different hash algorithms than their certs - e.g. if my cert is signed with sha384, I can still choose to sign the TSA request w/ sha256. This is typically passed through to the signer via crypto.SignerOpts. This somewhat obfuscated in the pkcs7 encoding, but this ultimately gets pulled out when signed here: https://github.com/digitorus/pkcs7/blob/3a137a8743524b3683ca4e11608d0dde37caee99/sign.go#L214-L217 To fix this, a new func CreateResponseWithOpts that passes in the SignerOpts so that we can encode them to be used in signing later. To keep backwards compatibility with previous behavior before 6c67f27, CreateResponse defaults to SHA256.
- Loading branch information
Showing
1 changed file
with
35 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters