MCPcopy Create free account
hub / github.com/LUX-Core/lux / CryptoSystemValidate

Function CryptoSystemValidate

src/cryptopp/validat2.cpp:179–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179bool CryptoSystemValidate(PK_Decryptor &priv, PK_Encryptor &pub, bool thorough = false)
180{
181 bool pass = true, fail;
182
183 fail = !pub.GetMaterial().Validate(GlobalRNG(), thorough ? 3 : 2) || !priv.GetMaterial().Validate(GlobalRNG(), thorough ? 3 : 2);
184 pass = pass && !fail;
185
186 cout << (fail ? "FAILED " : "passed ");
187 cout << "cryptosystem key validation\n";
188
189 const byte *message = (byte *)"test message";
190 const int messageLen = 12;
191 SecByteBlock ciphertext(priv.CiphertextLength(messageLen));
192 SecByteBlock plaintext(priv.MaxPlaintextLength(ciphertext.size()));
193
194 pub.Encrypt(GlobalRNG(), message, messageLen, ciphertext);
195 fail = priv.Decrypt(GlobalRNG(), ciphertext, priv.CiphertextLength(messageLen), plaintext) != DecodingResult(messageLen);
196 fail = fail || memcmp(message, plaintext, messageLen);
197 pass = pass && !fail;
198
199 cout << (fail ? "FAILED " : "passed ");
200 cout << "encryption and decryption\n";
201
202 return pass;
203}
204
205bool SimpleKeyAgreementValidate(SimpleKeyAgreementDomain &d)
206{

Callers 8

ValidateRSAFunction · 0.85
ValidateElGamalFunction · 0.85
ValidateDLIESFunction · 0.85
ValidateLUCFunction · 0.85
ValidateLUC_DLFunction · 0.85
ValidateRabinFunction · 0.85
ValidateECPFunction · 0.85
ValidateEC2NFunction · 0.85

Calls 5

DecodingResultFunction · 0.85
ValidateMethod · 0.45
sizeMethod · 0.45
EncryptMethod · 0.45
DecryptMethod · 0.45

Tested by

no test coverage detected