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

Hash algorithm in signature.Signer/Verifier ignored #249

Open
tri-adam opened this issue Dec 9, 2022 · 0 comments
Open

Hash algorithm in signature.Signer/Verifier ignored #249

tri-adam opened this issue Dec 9, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@tri-adam
Copy link
Member

tri-adam commented Dec 9, 2022

The signature.Signer and signature.Verifier types are structured in a way that allows the caller to specify the hash algorithm that will be used to sign/verify. For example, once can use signature.LoadSigner to obtain a signature.Signer, and must specify a crypto.Hash.

The current implementation of the integrity package always uses the crypto.SHA256 algorithm when signing, and the algorithm specified in the signature descriptor when verifying. This is reasonable when signing with PGP, since the arguments to OptSignWithEntity/OptVerifyWithKeyRing do not have a way to express a desired hash algorithm. On the other hand, the arguments to OptSignWithSigner/OptVerifyWithVerifier are able to express a desired hash algorithm, but the current implementation ignores those values.

When OptSignWithSigner/OptVerifyWithVerifier are specified, I propose that we utilize the hash algorithm specified in the arguments, and store the value used in the signature descriptor.

@tri-adam tri-adam added the bug Something isn't working label Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant