Add test data from bug report (GH #876)
parent
f78c3c00d2
commit
72f2b72920
17
validat8.cpp
17
validat8.cpp
|
|
@ -22,6 +22,9 @@
|
|||
#include "xtrcrypt.h"
|
||||
#include "eccrypto.h"
|
||||
|
||||
#include "hex.h"
|
||||
#include "base64.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
|
@ -302,6 +305,20 @@ bool ValidateElGamal()
|
|||
{
|
||||
std::cout << "\nElGamal validation suite running...\n\n";
|
||||
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";
|
||||
StringSource decodedPublicKey(encodedPublicKey, true, new Base64Decoder);
|
||||
|
||||
ElGamal::PublicKey publicKey;
|
||||
publicKey.Load(decodedPublicKey);
|
||||
|
||||
pass = publicKey.Validate(GlobalRNG(), 3) && pass;
|
||||
}
|
||||
{
|
||||
FileSource fc(DataDir("TestData/elgc1024.dat").c_str(), true, new HexDecoder);
|
||||
ElGamalDecryptor privC(fc);
|
||||
|
|
|
|||
Loading…
Reference in New Issue