Botan  2.4.0
Crypto and TLS for C++11
keypair.h
Go to the documentation of this file.
1 /*
2 * Keypair Checks
3 * (C) 1999-2010 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_KEYPAIR_CHECKS_H_
9 #define BOTAN_KEYPAIR_CHECKS_H_
10 
11 #include <botan/pk_keys.h>
12 
13 namespace Botan {
14 
15 namespace KeyPair {
16 
17 /**
18 * Tests whether the key is consistent for encryption; whether
19 * encrypting and then decrypting gives to the original plaintext.
20 * @param rng the rng to use
21 * @param private_key the key to test
22 * @param public_key the key to test
23 * @param padding the encryption padding method to use
24 * @return true if consistent otherwise false
25 */
26 BOTAN_PUBLIC_API(2,0) bool
27 encryption_consistency_check(RandomNumberGenerator& rng,
28  const Private_Key& private_key,
29  const Public_Key& public_key,
30  const std::string& padding);
31 
32 /**
33 * Tests whether the key is consistent for signatures; whether a
34 * signature can be created and then verified
35 * @param rng the rng to use
36 * @param private_key the key to test
37 * @param public_key the key to test
38 * @param padding the signature padding method to use
39 * @return true if consistent otherwise false
40 */
41 BOTAN_PUBLIC_API(2,0) bool
42 signature_consistency_check(RandomNumberGenerator& rng,
43  const Private_Key& private_key,
44  const Public_Key& public_key,
45  const std::string& padding);
46 
47 /**
48 * Tests whether the key is consistent for encryption; whether
49 * encrypting and then decrypting gives to the original plaintext.
50 * @param rng the rng to use
51 * @param key the key to test
52 * @param padding the encryption padding method to use
53 * @return true if consistent otherwise false
54 */
55 inline bool
57  const Private_Key& key,
58  const std::string& padding)
59  {
60  return encryption_consistency_check(rng, key, key, padding);
61  }
62 
63 /**
64 * Tests whether the key is consistent for signatures; whether a
65 * signature can be created and then verified
66 * @param rng the rng to use
67 * @param key the key to test
68 * @param padding the signature padding method to use
69 * @return true if consistent otherwise false
70 */
71 inline bool
73  const Private_Key& key,
74  const std::string& padding)
75  {
76  return signature_consistency_check(rng, key, key, padding);
77  }
78 
79 }
80 
81 }
82 
83 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: bigint.h:635
bool encryption_consistency_check(RandomNumberGenerator &rng, const Private_Key &private_key, const Public_Key &public_key, const std::string &padding)
Definition: keypair.cpp:19
bool signature_consistency_check(RandomNumberGenerator &rng, const Private_Key &private_key, const Public_Key &public_key, const std::string &padding)
Definition: keypair.cpp:49
Definition: alg_id.cpp:13