Botan 3.0.0-alpha0
Crypto and TLS for C&
gost_3410.h
Go to the documentation of this file.
1/*
2* GOST 34.10-2001
3* (C) 2007 Falko Strenzke, FlexSecure GmbH
4* Manuel Hartl, FlexSecure GmbH
5* (C) 2008-2010 Jack Lloyd
6*
7* Botan is released under the Simplified BSD License (see license.txt)
8*/
9
10#ifndef BOTAN_GOST_3410_KEY_H_
11#define BOTAN_GOST_3410_KEY_H_
12
13#include <botan/ecc_key.h>
14
15namespace Botan {
16
17/**
18* GOST-34.10 Public Key
19*/
21 {
22 public:
23
24 /**
25 * Construct a public key from a given public point.
26 * @param dom_par the domain parameters associated with this key
27 * @param public_point the public point defining this key
28 */
30 const PointGFp& public_point) :
31 EC_PublicKey(dom_par, public_point) {}
32
33 /**
34 * Load a public key.
35 * @param alg_id the X.509 algorithm identifier
36 * @param key_bits DER encoded public key bits
37 */
39 const std::vector<uint8_t>& key_bits);
40
41 /**
42 * Get this keys algorithm name.
43 * @result this keys algorithm name
44 */
45 std::string algo_name() const override;
46
47 AlgorithmIdentifier algorithm_identifier() const override;
48
49 std::vector<uint8_t> public_key_bits() const override;
50
51 size_t message_parts() const override { return 2; }
52
53 size_t message_part_size() const override
54 { return domain().get_order().bytes(); }
55
57 { return IEEE_1363; }
58
59 std::unique_ptr<PK_Ops::Verification>
60 create_verification_op(const std::string& params,
61 const std::string& provider) const override;
62
63 protected:
65 };
66
67/**
68* GOST-34.10 Private Key
69*/
72 {
73 public:
74 /**
75 * Load a private key.
76 * @param alg_id the X.509 algorithm identifier
77 * @param key_bits ECPrivateKey bits
78 */
80 const secure_vector<uint8_t>& key_bits) :
81 EC_PrivateKey(alg_id, key_bits) {}
82
83 /**
84 * Generate a new private key
85 * @param rng a random number generator
86 * @param domain parameters to used for this key
87 * @param x the private key; if zero, a new random key is generated
88 */
90 const EC_Group& domain,
91 const BigInt& x = BigInt::zero());
92
93 std::unique_ptr<Public_Key> public_key() const override;
94
97
98 std::unique_ptr<PK_Ops::Signature>
99 create_signature_op(RandomNumberGenerator& rng,
100 const std::string& params,
101 const std::string& provider) const override;
102 };
103
104}
105
106#endif
static BigInt zero()
Definition: bigint.h:45
AlgorithmIdentifier algorithm_identifier() const override
Definition: ecc_key.cpp:70
GOST_3410_PrivateKey(const AlgorithmIdentifier &alg_id, const secure_vector< uint8_t > &key_bits)
Definition: gost_3410.h:79
AlgorithmIdentifier pkcs8_algorithm_identifier() const override
Definition: gost_3410.h:95
Signature_Format default_x509_signature_format() const override
Definition: gost_3410.h:56
size_t message_parts() const override
Definition: gost_3410.h:51
GOST_3410_PublicKey(const EC_Group &dom_par, const PointGFp &public_point)
Definition: gost_3410.h:29
size_t message_part_size() const override
Definition: gost_3410.h:53
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Definition: alg_id.cpp:13
Signature_Format
Definition: pk_keys.h:23
@ IEEE_1363
Definition: pk_keys.h:23
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65