smimesign
smimesign copied to clipboard
Use appropriate digest algorithm during signature creation
Pass the public key instead of the marshalled public key to
digestAlgorithmForPublicKey in SignedData.AddSignerInfo.
Previously, the marshalled public key was passed instead of the actual public key. The result is that always SHA256 was being selected, even for ECDSA where the hash algorithm should be selected based on the curve.
Hi @lgarron
What can I do to move this forward?
I'm not qualified to review this, but @vcsjones may be!
I see:
https://github.com/github/smimesign/blob/e650daf6eaadf85c763fa06dcfb0e4d794d293dc/ietf-cms/protocol/protocol.go#L755-L766
Since we're passing in something that is not an ecdsa.PublicKey, none of the if checks match and it defaults to SHA256.
I think this change looks good, but it would be great to get some test coverage that indeed the right digest algorithm is used for the curve. Would you be able to add some test coverage for this, @oncilla?
@vcsjones sure. I will have look tomorrow