Botan 2.19.2
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
14
15namespace Botan {
16
17namespace KeyPair {
18
19/**
20* Tests whether the key is consistent for encryption; whether
21* encrypting and then decrypting gives to the original plaintext.
22* @param rng the rng to use
23* @param private_key the key to test
24* @param public_key the key to test
25* @param padding the encryption padding method to use
26* @return true if consistent otherwise false
27*/
28BOTAN_PUBLIC_API(2,0) bool
29encryption_consistency_check(RandomNumberGenerator& rng,
30 const Private_Key& private_key,
31 const Public_Key& public_key,
32 const std::string& padding);
33
34/**
35* Tests whether the key is consistent for signatures; whether a
36* signature can be created and then verified
37* @param rng the rng to use
38* @param private_key the key to test
39* @param public_key the key to test
40* @param padding the signature padding method to use
41* @return true if consistent otherwise false
42*/
43BOTAN_PUBLIC_API(2,0) bool
44signature_consistency_check(RandomNumberGenerator& rng,
45 const Private_Key& private_key,
46 const Public_Key& public_key,
47 const std::string& padding);
48
49/**
50* Tests whether the key is consistent for encryption; whether
51* encrypting and then decrypting gives to the original plaintext.
52* @param rng the rng to use
53* @param key the key to test
54* @param padding the encryption padding method to use
55* @return true if consistent otherwise false
56*/
57inline bool
59 const Private_Key& key,
60 const std::string& padding)
61 {
62 return encryption_consistency_check(rng, key, key, padding);
63 }
64
65/**
66* Tests whether the key is consistent for signatures; whether a
67* signature can be created and then verified
68* @param rng the rng to use
69* @param key the key to test
70* @param padding the signature padding method to use
71* @return true if consistent otherwise false
72*/
73inline bool
75 const Private_Key& key,
76 const std::string& padding)
77 {
78 return signature_consistency_check(rng, key, key, padding);
79 }
80
81}
82
83}
84
85#endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:136
bool encryption_consistency_check(RandomNumberGenerator &rng, const Private_Key &key, const std::string &padding)
Definition: keypair.h:58
bool signature_consistency_check(RandomNumberGenerator &rng, const Private_Key &key, const std::string &padding)
Definition: keypair.h:74
Definition: alg_id.cpp:13
Definition: bigint.h:1143