Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix digest algorithm selection when hash func != cert hash. #19

Merged
merged 2 commits into from
Sep 2, 2023

Commits on Aug 30, 2023

  1. 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.
    wlynch committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    995024f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    57b30ee View commit details
    Browse the repository at this point in the history