Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

eckcdsa.h
Go to the documentation of this file.
1 /*
2 * ECKCDSA (ISO/IEC 14888-3:2006/Cor.2:2009)
3 * (C) 2016 René Korthaus, Sirrix AG
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_ECKCDSA_KEY_H__
9 #define BOTAN_ECKCDSA_KEY_H__
10
11 #include <botan/ecc_key.h>
12
13 namespace Botan {
14
15 /**
16 * This class represents ECKCDSA public keys.
17 */
18 class BOTAN_DLL ECKCDSA_PublicKey : public virtual EC_PublicKey
19 {
20 public:
21
22 /**
23 * Construct a public key from a given public point.
24 * @param dom_par the domain parameters associated with this key
25 * @param public_point the public point defining this key
26 */
27 ECKCDSA_PublicKey(const EC_Group& dom_par,
28 const PointGFp& public_point) :
29 EC_PublicKey(dom_par, public_point) {}
30
31 /**
32 * Load a public key.
33 * @param alg_id the X.509 algorithm identifier
34 * @param key_bits DER encoded public key bits
35 */
36 ECKCDSA_PublicKey(const AlgorithmIdentifier& alg_id,
37 const std::vector<uint8_t>& key_bits) :
38 EC_PublicKey(alg_id, key_bits) {}
39
40 /**
41 * Get this keys algorithm name.
42 * @result this keys algorithm name ("ECGDSA")
43 */
44 std::string algo_name() const override { return "ECKCDSA"; }
45
46 size_t message_parts() const override { return 2; }
47
48 size_t message_part_size() const override
49 { return domain().get_order().bytes(); }
50
51 std::unique_ptr<PK_Ops::Verification>
52 create_verification_op(const std::string& params,
53 const std::string& provider) const override;
54 protected:
55 ECKCDSA_PublicKey() = default;
56 };
57
58 /**
59 * This class represents ECKCDSA private keys.
60 */
61 class BOTAN_DLL ECKCDSA_PrivateKey : public ECKCDSA_PublicKey,
62 public EC_PrivateKey
63 {
64 public:
65
66 /**
67 * Load a private key.
68 * @param alg_id the X.509 algorithm identifier
69 * @param key_bits ECPrivateKey bits
70 */
71 ECKCDSA_PrivateKey(const AlgorithmIdentifier& alg_id,
72 const secure_vector<uint8_t>& key_bits) :
73 EC_PrivateKey(alg_id, key_bits, true) {}
74
75 /**
76 * Create a private key.
77 * @param rng a random number generator
78 * @param domain parameters to used for this key
79 * @param x the private key (if zero, generate a new random key)
80 */
81 ECKCDSA_PrivateKey(RandomNumberGenerator& rng,
82 const EC_Group& domain,
83 const BigInt& x = 0) :
84 EC_PrivateKey(rng, domain, x, true) {}
85
86 bool check_key(RandomNumberGenerator& rng, bool) const override;
87
88 std::unique_ptr<PK_Ops::Signature>
89 create_signature_op(RandomNumberGenerator& rng,
90 const std::string& params,
91 const std::string& provider) const override;
92 };
93
94 }
95
96 #endif
Botan::BigInt
Definition: bigint.h:23
Botan::ECKCDSA_PrivateKey::ECKCDSA_PrivateKey
ECKCDSA_PrivateKey(RandomNumberGenerator &rng, const EC_Group &domain, const BigInt &x=0)
Definition: eckcdsa.h:81
Botan::ECKCDSA_PublicKey::ECKCDSA_PublicKey
ECKCDSA_PublicKey(const EC_Group &dom_par, const PointGFp &public_point)
Definition: eckcdsa.h:27
Botan::PointGFp
Definition: point_gfp.h:41
Botan::RandomNumberGenerator
Definition: rng.h:25
Botan::ECKCDSA_PublicKey::message_parts
size_t message_parts() const override
Definition: eckcdsa.h:46
Botan::ECKCDSA_PublicKey::message_part_size
size_t message_part_size() const override
Definition: eckcdsa.h:48
Botan::EC_PublicKey
Definition: ecc_key.h:29
Botan::EC_PrivateKey
Definition: ecc_key.h:110
Botan::ECKCDSA_PublicKey
Definition: eckcdsa.h:18
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan
Definition: alg_id.cpp:13
Botan::EC_Group
Definition: ec_group.h:31
Botan::ECKCDSA_PublicKey::ECKCDSA_PublicKey
ECKCDSA_PublicKey(const AlgorithmIdentifier &alg_id, const std::vector< uint8_t > &key_bits)
Definition: eckcdsa.h:36
Botan::AlgorithmIdentifier
Definition: alg_id.h:20
Botan::ECKCDSA_PrivateKey
Definition: eckcdsa.h:61
Botan::ECKCDSA_PublicKey::algo_name
std::string algo_name() const override
Definition: eckcdsa.h:44
Botan::ECKCDSA_PrivateKey::ECKCDSA_PrivateKey
ECKCDSA_PrivateKey(const AlgorithmIdentifier &alg_id, const secure_vector< uint8_t > &key_bits)
Definition: eckcdsa.h:71