Botan
1.11.15
|
00001 /* 00002 * X9.31 EMSA 00003 * (C) 1999-2007 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_EMSA_X931_H__ 00009 #define BOTAN_EMSA_X931_H__ 00010 00011 #include <botan/emsa.h> 00012 #include <botan/hash.h> 00013 00014 namespace Botan { 00015 00016 /** 00017 * EMSA from X9.31 (EMSA2 in IEEE 1363) 00018 * Useful for Rabin-Williams, also sometimes used with RSA in 00019 * odd protocols. 00020 */ 00021 class BOTAN_DLL EMSA_X931 : public EMSA 00022 { 00023 public: 00024 /** 00025 * @param hash the hash object to use 00026 */ 00027 EMSA_X931(HashFunction* hash); 00028 private: 00029 void update(const byte[], size_t); 00030 secure_vector<byte> raw_data(); 00031 00032 secure_vector<byte> encoding_of(const secure_vector<byte>&, size_t, 00033 RandomNumberGenerator& rng); 00034 00035 bool verify(const secure_vector<byte>&, const secure_vector<byte>&, 00036 size_t); 00037 00038 secure_vector<byte> m_empty_hash; 00039 std::unique_ptr<HashFunction> m_hash; 00040 byte m_hash_id; 00041 }; 00042 00043 } 00044 00045 #endif