Skip to content

Commit c7e9067

Browse files
committed
fixed GH pocoproject#622: Crypto: RSATest::testSign() should verify with public key only
1 parent ccf0e78 commit c7e9067

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Crypto/testsuite/src/RSATest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void RSATest::testSign()
146146
std::string pubKey = strPub.str();
147147
std::istringstream iPub(pubKey);
148148
RSAKey keyPub(&iPub);
149-
RSADigestEngine eng2(key);
149+
RSADigestEngine eng2(keyPub);
150150
eng2.update(msg.c_str(), static_cast<unsigned>(msg.length()));
151151
assert (eng2.verify(sig));
152152
}
@@ -156,7 +156,7 @@ void RSATest::testSignSha256()
156156
{
157157
std::string msg("Test this sign message");
158158
RSAKey key(RSAKey::KL_2048, RSAKey::EXP_LARGE);
159-
RSADigestEngine eng(key,"SHA256");
159+
RSADigestEngine eng(key, "SHA256");
160160
eng.update(msg.c_str(), static_cast<unsigned>(msg.length()));
161161
const Poco::DigestEngine::Digest& sig = eng.signature();
162162
std::string hexDig = Poco::DigestEngine::digestToHex(sig);
@@ -167,7 +167,7 @@ void RSATest::testSignSha256()
167167
std::string pubKey = strPub.str();
168168
std::istringstream iPub(pubKey);
169169
RSAKey keyPub(&iPub);
170-
RSADigestEngine eng2(key,"SHA256");
170+
RSADigestEngine eng2(keyPub, "SHA256");
171171
eng2.update(msg.c_str(), static_cast<unsigned>(msg.length()));
172172
assert (eng2.verify(sig));
173173
}
@@ -189,7 +189,7 @@ void RSATest::testSignManipulated()
189189
std::string pubKey = strPub.str();
190190
std::istringstream iPub(pubKey);
191191
RSAKey keyPub(&iPub);
192-
RSADigestEngine eng2(key);
192+
RSADigestEngine eng2(keyPub);
193193
eng2.update(msgManip.c_str(), static_cast<unsigned>(msgManip.length()));
194194
assert (!eng2.verify(sig));
195195
}

0 commit comments

Comments
 (0)