diff --git a/src/RsaVerify.sol b/src/RsaVerify.sol index d7fe501..1741ba8 100644 --- a/src/RsaVerify.sol +++ b/src/RsaVerify.sol @@ -71,19 +71,19 @@ library RsaVerify { // } bool hasNullParam; - uint hashAlgoWithParamLen; + uint digestAlgoWithParamLen; if (uint8(decipher[decipherlen-50])==0x31) { hasNullParam = true; - hashAlgoWithParamLen = sha256ExplicitNullParam.length; + digestAlgoWithParamLen = sha256ExplicitNullParam.length; } else if (uint8(decipher[decipherlen-48])==0x2f) { hasNullParam = false; - hashAlgoWithParamLen = sha256ImplicitNullParam.length; + digestAlgoWithParamLen = sha256ImplicitNullParam.length; } else { return false; } - uint paddingLen = decipherlen - 5 - hashAlgoWithParamLen - 32 ; + uint paddingLen = decipherlen - 5 - digestAlgoWithParamLen - 32 ; if (decipher[0] != 0 || decipher[1] != 0x01) { return false; @@ -97,22 +97,31 @@ library RsaVerify { return false; } - if (hashAlgoWithParamLen == sha256ExplicitNullParam.length) { - for (uint i = 0;i