Botan 3.0.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 {
14
15namespace 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*/
26bool
27encryption_consistency_check(RandomNumberGenerator& rng,
28 const Private_Key& private_key,
29 const Public_Key& public_key,
30 std::string_view 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*/
41bool
42signature_consistency_check(RandomNumberGenerator& rng,
43 const Private_Key& private_key,
44 const Public_Key& public_key,
45 std::string_view 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*/
55inline bool
57 const Private_Key& key,
58 std::string_view 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*/
71inline bool
73 const Private_Key& key,
74 std::string_view padding)
75 {
76 return signature_consistency_check(rng, key, key, padding);
77 }
78
79}
80
81}
82
83#endif
bool signature_consistency_check(RandomNumberGenerator &rng, const Private_Key &private_key, const Public_Key &public_key, std::string_view padding)
Definition: keypair.cpp:47
bool encryption_consistency_check(RandomNumberGenerator &rng, const Private_Key &private_key, const Public_Key &public_key, std::string_view padding)
Definition: keypair.cpp:17
Definition: alg_id.cpp:12