mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-27 02:16:16 +02:00
fixed GH #622: Crypto: RSATest::testSign() should verify with public key only
This commit is contained in:
parent
ccf0e78b6a
commit
c7e9067fde
@ -146,7 +146,7 @@ void RSATest::testSign()
|
||||
std::string pubKey = strPub.str();
|
||||
std::istringstream iPub(pubKey);
|
||||
RSAKey keyPub(&iPub);
|
||||
RSADigestEngine eng2(key);
|
||||
RSADigestEngine eng2(keyPub);
|
||||
eng2.update(msg.c_str(), static_cast<unsigned>(msg.length()));
|
||||
assert (eng2.verify(sig));
|
||||
}
|
||||
@ -167,7 +167,7 @@ void RSATest::testSignSha256()
|
||||
std::string pubKey = strPub.str();
|
||||
std::istringstream iPub(pubKey);
|
||||
RSAKey keyPub(&iPub);
|
||||
RSADigestEngine eng2(key,"SHA256");
|
||||
RSADigestEngine eng2(keyPub, "SHA256");
|
||||
eng2.update(msg.c_str(), static_cast<unsigned>(msg.length()));
|
||||
assert (eng2.verify(sig));
|
||||
}
|
||||
@ -189,7 +189,7 @@ void RSATest::testSignManipulated()
|
||||
std::string pubKey = strPub.str();
|
||||
std::istringstream iPub(pubKey);
|
||||
RSAKey keyPub(&iPub);
|
||||
RSADigestEngine eng2(key);
|
||||
RSADigestEngine eng2(keyPub);
|
||||
eng2.update(msgManip.c_str(), static_cast<unsigned>(msgManip.length()));
|
||||
assert (!eng2.verify(sig));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user