aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/keypair/keypair.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-21 21:54:47 +0000
committerlloyd <[email protected]>2010-03-21 21:54:47 +0000
commitc23ae85c0529071b3170e88d361342d6a792f417 (patch)
tree5f731b328266809df9fd82cd1e1e5d4dc6c8e88b /src/pubkey/keypair/keypair.h
parent8b0d3575e794073f6e6658544d8167e399762ce0 (diff)
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
Diffstat (limited to 'src/pubkey/keypair/keypair.h')
-rw-r--r--src/pubkey/keypair/keypair.h44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/pubkey/keypair/keypair.h b/src/pubkey/keypair/keypair.h
index 22dcca0ea..c7b128e53 100644
--- a/src/pubkey/keypair/keypair.h
+++ b/src/pubkey/keypair/keypair.h
@@ -1,44 +1,44 @@
/*
* Keypair Checks
-* (C) 1999-2007 Jack Lloyd
+* (C) 1999-2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
-#ifndef BOTAN_KEYPAIR_H__
-#define BOTAN_KEYPAIR_H__
+#ifndef BOTAN_KEYPAIR_CHECKS_H__
+#define BOTAN_KEYPAIR_CHECKS_H__
-#include <botan/pubkey.h>
+#include <botan/pk_keys.h>
namespace Botan {
namespace KeyPair {
/**
-* Tests whether the specified encryptor and decryptor are related to each other,
-* i.e. whether encrypting with the encryptor and consecutive decryption leads to
-* the original plaintext.
+* Tests whether the key is consistent for encryption; whether
+* encrypting and then decrypting gives to the original plaintext.
* @param rng the rng to use
-* @param enc the encryptor to test
-* @param dec the decryptor to test
-* @throw Self_Test_Failure if the arguments are not related to each other
+* @param key the key to test
+* @param padding the encryption padding method to use
+* @return true if consistent otherwise false
*/
-BOTAN_DLL void check_key(RandomNumberGenerator& rng,
- PK_Encryptor& enc,
- PK_Decryptor& dec);
+BOTAN_DLL bool
+encryption_consistency_check(RandomNumberGenerator& rng,
+ const Private_Key& key,
+ const std::string& padding);
/**
-* Tests whether the specified signer and verifier are related to each other,
-* i.e. whether a signature created with the signer and can be
-* successfully verified with the verifier.
+* Tests whether the key is consistent for signatures; whether a
+* signature can be created and then verified
* @param rng the rng to use
-* @param sig the signer to test
-* @param ver the verifier to test
-* @throw Self_Test_Failure if the arguments are not related to each other
+* @param key the key to test
+* @param padding the signature padding method to use
+* @return true if consistent otherwise false
*/
-BOTAN_DLL void check_key(RandomNumberGenerator& rng,
- PK_Signer& sig,
- PK_Verifier& ver);
+BOTAN_DLL bool
+signature_consistency_check(RandomNumberGenerator& rng,
+ const Private_Key& key,
+ const std::string& padding);
}