-
Notifications
You must be signed in to change notification settings - Fork 15
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
RSA PKCS#1 v1.5 signature scheme verification incompatibility issue #9
Comments
The problem is that the RFC does not define a container format for the input structure + signature, how do we know which way of encoding the input structure was used ? The API only accept naked signature. It seems wrong that the input structure is not deterministic. |
Not completely if we believe OpenSSL. I still don't understand how to validate naked signatures. |
Hi,
Actually it does. Since you're doing what's known as construction-based (i.e., encoding-based) signature verification, what needs to happen is preparing two versions of the signatures (based on the given hash, and hash function) and validate it if the given signature value matches any of these two. More explicitly, you need to add the prefixes for implicit NULL parameter cases to
And comparing to the explicit NULL parameter version, it does not have Let me know if you have any question. --Daniel |
I accept pull requests if you know the solution :) |
I was testing PKCS#1 v1.5 signature verification as implemented in python-pkcs1 and noticed it rejects valid signature whose encoded message uses an implicit NULL parameter for hash algorithm (where digestAlgorithm ANS.1 der encoded does not have NULL parameter TLV; that is,
0x0500
is absent).According to RFC4055, pg.5 and RFC8017, pg. 64, for SHA-1, and the SHA-2 family, the algorithm parameter has to be NULL and both explicit NULL parameter and implicit NULL parameter (ie, absent NULL parameter) are considered to be legal and equivalent. However, this implementation does not accept a valid PKCS input with implicit NULL parameter.
Reference notation and concrete values
N
: public modulus|N|
: length of public modulusd
: private exponente
: public exponentH
: hash functionm
: messageI
: to-be-singed RSA PKCS#1 v1.5 signature scheme input structureS
: signature value obtained byI^d mod N
The text was updated successfully, but these errors were encountered: