/src/botan/build/include/internal/botan/internal/keypair.h
Line | Count | Source (jump to first uncovered line) |
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::KeyPair { |
14 | | |
15 | | /** |
16 | | * Tests whether the key is consistent for encryption; whether |
17 | | * encrypting and then decrypting gives to the original plaintext. |
18 | | * @param rng the rng to use |
19 | | * @param private_key the key to test |
20 | | * @param public_key the key to test |
21 | | * @param padding the encryption padding method to use |
22 | | * @return true if consistent otherwise false |
23 | | */ |
24 | | bool encryption_consistency_check(RandomNumberGenerator& rng, |
25 | | const Private_Key& private_key, |
26 | | const Public_Key& public_key, |
27 | | std::string_view padding); |
28 | | |
29 | | /** |
30 | | * Tests whether the key is consistent for signatures; whether a |
31 | | * signature can be created and then verified |
32 | | * @param rng the rng to use |
33 | | * @param private_key the key to test |
34 | | * @param public_key the key to test |
35 | | * @param padding the signature padding method to use |
36 | | * @return true if consistent otherwise false |
37 | | */ |
38 | | bool signature_consistency_check(RandomNumberGenerator& rng, |
39 | | const Private_Key& private_key, |
40 | | const Public_Key& public_key, |
41 | | std::string_view padding); |
42 | | |
43 | | /** |
44 | | * Tests whether the key is consistent for encryption; whether |
45 | | * encrypting and then decrypting gives to the original plaintext. |
46 | | * @param rng the rng to use |
47 | | * @param sk the key to test |
48 | | * @param padding the encryption padding method to use |
49 | | * @return true if consistent otherwise false |
50 | | */ |
51 | 0 | inline bool encryption_consistency_check(RandomNumberGenerator& rng, const Private_Key& sk, std::string_view padding) { |
52 | 0 | auto pk = sk.public_key(); |
53 | 0 | return encryption_consistency_check(rng, sk, *pk, padding); |
54 | 0 | } |
55 | | |
56 | | /** |
57 | | * Tests whether the key is consistent for signatures; whether a |
58 | | * signature can be created and then verified |
59 | | * @param rng the rng to use |
60 | | * @param sk the key to test |
61 | | * @param padding the signature padding method to use |
62 | | * @return true if consistent otherwise false |
63 | | */ |
64 | 0 | inline bool signature_consistency_check(RandomNumberGenerator& rng, const Private_Key& sk, std::string_view padding) { |
65 | 0 | auto pk = sk.public_key(); |
66 | 0 | return signature_consistency_check(rng, sk, *pk, padding); |
67 | 0 | } |
68 | | |
69 | | } // namespace Botan::KeyPair |
70 | | |
71 | | #endif |