Coverage Report

Created: 2019-12-03 15:21

/src/botan/build/include/botan/emsa1.h
Line
Count
Source
1
/*
2
* EMSA1
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_EMSA1_H_
9
#define BOTAN_EMSA1_H_
10
11
#include <botan/emsa.h>
12
#include <botan/hash.h>
13
14
BOTAN_FUTURE_INTERNAL_HEADER(emsa1.h)
15
16
namespace Botan {
17
18
/**
19
* EMSA1 from IEEE 1363
20
* Essentially, sign the hash directly
21
*/
22
class BOTAN_PUBLIC_API(2,0) EMSA1 final : public EMSA
23
   {
24
   public:
25
      /**
26
      * @param hash the hash function to use
27
      */
28
1.70k
      explicit EMSA1(HashFunction* hash) : m_hash(hash) {}
29
30
      EMSA* clone() override;
31
32
      std::string name() const override;
33
34
      AlgorithmIdentifier config_for_x509(const Private_Key& key,
35
                                          const std::string& cert_hash_name) const override;
36
   private:
37
679
      size_t hash_output_length() const { return m_hash->output_length(); }
38
39
      void update(const uint8_t[], size_t) override;
40
      secure_vector<uint8_t> raw_data() override;
41
42
      secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>& msg,
43
                                         size_t output_bits,
44
                                         RandomNumberGenerator& rng) override;
45
46
      bool verify(const secure_vector<uint8_t>& coded,
47
                  const secure_vector<uint8_t>& raw,
48
                  size_t key_bits) override;
49
50
      std::unique_ptr<HashFunction> m_hash;
51
   };
52
53
}
54
55
#endif