mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2025-02-17 03:48:38 +00:00
Add private key test data for ElGamal
This commit is contained in:
parent
e06e3bd7a9
commit
90b0699edd
15
validat8.cpp
15
validat8.cpp
@ -307,8 +307,6 @@ bool ValidateElGamal()
|
||||
bool pass = true;
|
||||
{
|
||||
// Data from https://github.com/weidai11/cryptopp/issues/876.
|
||||
// The interesting thing about this data is, the public key
|
||||
// has 3 ASN.1 Integer types, and not 4 Integer types.
|
||||
const std::string encodedPublicKey =
|
||||
"MHYwTwYGKw4HAgEBMEUCIQDebUvQDd9UPMmD27BJ ovZSIgWfexL0SWkfJQPMLsJvMwIgDy/kEthwO6Q+"
|
||||
"L8XHnzumnEKs+txH8QkQD+M/8u82ql0DIwACIAY6 rfW+BTcRZ9QAJovgoB8DgNLJ8ocqOeF4nEBB0DHH";
|
||||
@ -316,9 +314,20 @@ bool ValidateElGamal()
|
||||
|
||||
ElGamal::PublicKey publicKey;
|
||||
publicKey.Load(decodedPublicKey);
|
||||
|
||||
pass = publicKey.Validate(GlobalRNG(), 3) && pass;
|
||||
}
|
||||
{
|
||||
// Data from https://github.com/weidai11/cryptopp/issues/876.
|
||||
const std::string encodedPrivateKey =
|
||||
"MHkCAQAwTwYGKw4HAgEBMEUCIQDebUvQDd9UPMmD 27BJovZSIgWfexL0SWkfJQPMLsJvMwIgDy/kEthw"
|
||||
"O6Q+L8XHnzumnEKs+txH8QkQD+M/8u82ql0EIwIh AJb0S4TZLvApTVjXZyocPJ5tUgWgRqScXm5vNqu2"
|
||||
"YqdM";
|
||||
StringSource decodedPrivateKey(encodedPrivateKey, true, new Base64Decoder);
|
||||
|
||||
ElGamal::PrivateKey privateKey;
|
||||
privateKey.Load(decodedPrivateKey);
|
||||
pass = privateKey.Validate(GlobalRNG(), 3) && pass;
|
||||
}
|
||||
{
|
||||
FileSource fc(DataDir("TestData/elgc1024.dat").c_str(), true, new HexDecoder);
|
||||
ElGamalDecryptor privC(fc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user