Tests whether the key is consistent for encryption; whether encrypting and then decrypting gives to the original plaintext.
22 PK_Encryptor_EME encryptor(key, padding);
23 PK_Decryptor_EME decryptor(key, padding);
29 if(encryptor.maximum_input_size() == 0)
32 SecureVector<byte> plaintext =
33 rng.random_vec(encryptor.maximum_input_size() - 1);
35 SecureVector<byte> ciphertext = encryptor.encrypt(plaintext, rng);
36 if(ciphertext == plaintext)
39 SecureVector<byte> decrypted = decryptor.decrypt(ciphertext);
41 return (plaintext == decrypted);