Coverage Report

Created: 2021-02-21 07:20

/src/botan/build/include/botan/gost_3410.h
Line
Count
Source (jump to first uncovered line)
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
15
namespace Botan {
16
17
/**
18
* GOST-34.10 Public Key
19
*/
20
class BOTAN_PUBLIC_API(2,0) GOST_3410_PublicKey : public virtual EC_PublicKey
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
      */
29
      GOST_3410_PublicKey(const EC_Group& dom_par,
30
                          const PointGFp& public_point) :
31
0
         EC_PublicKey(dom_par, public_point) {}
Unexecuted instantiation: Botan::GOST_3410_PublicKey::GOST_3410_PublicKey(Botan::EC_Group const&, Botan::PointGFp const&)
Unexecuted instantiation: Botan::GOST_3410_PublicKey::GOST_3410_PublicKey(Botan::EC_Group const&, Botan::PointGFp const&)
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
      */
38
      GOST_3410_PublicKey(const AlgorithmIdentifier& alg_id,
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
0
      size_t message_parts() const override { return 2; }
52
53
      size_t message_part_size() const override
54
0
         { return domain().get_order().bytes(); }
55
56
      Signature_Format default_x509_signature_format() const override
57
0
         { 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:
64
0
      GOST_3410_PublicKey() = default;
65
   };
66
67
/**
68
* GOST-34.10 Private Key
69
*/
70
class BOTAN_PUBLIC_API(2,0) GOST_3410_PrivateKey final :
71
   public GOST_3410_PublicKey, public EC_PrivateKey
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
      */
79
      GOST_3410_PrivateKey(const AlgorithmIdentifier& alg_id,
80
                           const secure_vector<uint8_t>& key_bits) :
81
0
         EC_PrivateKey(alg_id, key_bits) {}
Unexecuted instantiation: Botan::GOST_3410_PrivateKey::GOST_3410_PrivateKey(Botan::AlgorithmIdentifier const&, std::__1::vector<unsigned char, Botan::secure_allocator<unsigned char> > const&)
Unexecuted instantiation: Botan::GOST_3410_PrivateKey::GOST_3410_PrivateKey(Botan::AlgorithmIdentifier const&, std::__1::vector<unsigned char, Botan::secure_allocator<unsigned char> > const&)
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
      */
89
      GOST_3410_PrivateKey(RandomNumberGenerator& rng,
90
                           const EC_Group& domain,
91
                           const BigInt& x = 0);
92
93
      std::unique_ptr<Public_Key> public_key() const override;
94
95
      AlgorithmIdentifier pkcs8_algorithm_identifier() const override
96
0
         { return EC_PublicKey::algorithm_identifier(); }
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