Botan 3.5.0
Crypto and TLS for C&
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
13namespace 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*/
24bool 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*/
38bool 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 key the key to test
48* @param padding the encryption padding method to use
49* @return true if consistent otherwise false
50*/
51inline bool encryption_consistency_check(RandomNumberGenerator& rng, const Private_Key& key, std::string_view padding) {
52 return encryption_consistency_check(rng, key, key, padding);
53}
54
55/**
56* Tests whether the key is consistent for signatures; whether a
57* signature can be created and then verified
58* @param rng the rng to use
59* @param key the key to test
60* @param padding the signature padding method to use
61* @return true if consistent otherwise false
62*/
63inline bool signature_consistency_check(RandomNumberGenerator& rng, const Private_Key& key, std::string_view padding) {
64 return signature_consistency_check(rng, key, key, padding);
65}
66
67} // namespace Botan::KeyPair
68
69#endif
bool signature_consistency_check(RandomNumberGenerator &rng, const Private_Key &private_key, const Public_Key &public_key, std::string_view padding)
Definition keypair.cpp:49
bool encryption_consistency_check(RandomNumberGenerator &rng, const Private_Key &private_key, const Public_Key &public_key, std::string_view padding)
Definition keypair.cpp:18