Botan
1.11.15
|
00001 /* 00002 * EMSA1 00003 * (C) 1999-2007 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_EMSA1_H__ 00009 #define BOTAN_EMSA1_H__ 00010 00011 #include <botan/emsa.h> 00012 #include <botan/hash.h> 00013 00014 namespace Botan { 00015 00016 /** 00017 * EMSA1 from IEEE 1363 00018 * Essentially, sign the hash directly 00019 */ 00020 class BOTAN_DLL EMSA1 : public EMSA 00021 { 00022 public: 00023 /** 00024 * @param hash the hash function to use 00025 */ 00026 EMSA1(HashFunction* hash) : m_hash(hash) {} 00027 00028 protected: 00029 size_t hash_output_length() const { return m_hash->output_length(); } 00030 private: 00031 void update(const byte[], size_t); 00032 secure_vector<byte> raw_data(); 00033 00034 secure_vector<byte> encoding_of(const secure_vector<byte>& msg, 00035 size_t output_bits, 00036 RandomNumberGenerator& rng); 00037 00038 bool verify(const secure_vector<byte>& coded, 00039 const secure_vector<byte>& raw, 00040 size_t key_bits); 00041 00042 std::unique_ptr<HashFunction> m_hash; 00043 }; 00044 00045 } 00046 00047 #endif