Open yahyazadeh opened 3 years ago
Thanks @yahyazadeh,
I'll have to do some digging into this issue. Sometimes sharp edges surface because of the standard used in the library, like P1363 or ANSI X.9 versus the RFCs.
That PKCS#1 v1.5 signing code has been around since the late 1990s or early 2000s.
(The signing code was probably present at Crypto++ 1.0 in 1995, but it got removed when RSA Data Security Inc. asserted their patent for RSA. It was probably re-added at Crypto++ 2.3 in 1998. If you will recall, RSA DSI's patent was set to expire in 1999 or 2000, so RSA put the algorithm in public domain about a year before expiration.).
I was testing PKCS#1 v1.5 signature verification as implemented in cryptopp 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