From c23ae85c0529071b3170e88d361342d6a792f417 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sun, 21 Mar 2010 21:54:47 +0000 Subject: KeyPair::check_key's behavior of throwing an exception upon failure was not useful; in all cases, we immediately caught it and then returned false. Modify as follows: - Create the pubkey objects inside the checking code, so calling code doesn't need to do it. - Return true/false for pass/fail Also add consistency checking for ECDSA keys --- src/pubkey/elgamal/elgamal.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'src/pubkey/elgamal/elgamal.cpp') diff --git a/src/pubkey/elgamal/elgamal.cpp b/src/pubkey/elgamal/elgamal.cpp index 5640a4400..a264d209b 100644 --- a/src/pubkey/elgamal/elgamal.cpp +++ b/src/pubkey/elgamal/elgamal.cpp @@ -64,21 +64,7 @@ bool ElGamal_PrivateKey::check_key(RandomNumberGenerator& rng, if(!strong) return true; - try - { - PK_Encryptor_EME this_encryptor(*this, "EME1(SHA-1)"); - PK_Decryptor_EME this_decryptor(*this, "EME1(SHA-1)"); - - KeyPair::check_key(rng, - this_encryptor, - this_decryptor); - } - catch(Self_Test_Failure) - { - return false; - } - - return true; + return KeyPair::encryption_consistency_check(rng, *this, "EME1(SHA-1)"); } ElGamal_Encryption_Operation::ElGamal_Encryption_Operation(const ElGamal_PublicKey& key) -- cgit v1.2.3