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

verifySignature: always use the certificate's algorithm #28

Closed
wants to merge 1 commit into from
Closed

verifySignature: always use the certificate's algorithm #28

wants to merge 1 commit into from

Conversation

mariusae
Copy link

VerifySignature previously hardcoded x509.SHA1WithRSA as the
verification signature. As of Go 1.10, the x509 package verifies that
the requested algorithm matches the certificate's public key type.
VerifySignature would then fail for certificates with DSA keys, such
as AWS's EC2 instance identity documents.

Fix this by always using the certificate's algorithm directly.

VerifySignature previously hardcoded x509.SHA1WithRSA as the 
verification signature. As of Go 1.10, the x509 package verifies that 
the requested algorithm matches the certificate's public key type.
VerifySignature would then fail for certificates with DSA keys, such
as AWS's EC2 instance identity documents.

Fix this by always using the certificate's algorithm directly.
msiebeling pushed a commit to sggms/pkcs7 that referenced this pull request Nov 25, 2019
Since Go 1.10, the SignatureAlgorithm is now validated against the public key type. It was "working" before because the Amazon key used DSA with SHA1, and so the RSA/DSA mismatch didn't matter since the SHA1 hash type did.

This uses some unexported code from `crypto/x509` that looks up a signature algorithm for a given `pxix.AlgorithmIdentifier`

Fixes fullsailor#27
Fixes fullsailor#28
Fixes fullsailor#29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant