Botan  1.11.15
src/lib/pk_pad/emsa_pssr/pssr.h
Go to the documentation of this file.
00001 /*
00002 * PSSR
00003 * (C) 1999-2007 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_PSSR_H__
00009 #define BOTAN_PSSR_H__
00010 
00011 #include <botan/emsa.h>
00012 #include <botan/hash.h>
00013 
00014 namespace Botan {
00015 
00016 /**
00017 * PSSR (called EMSA4 in IEEE 1363 and in old versions of the library)
00018 */
00019 class BOTAN_DLL PSSR : public EMSA
00020    {
00021    public:
00022 
00023       /**
00024       * @param hash the hash object to use
00025       */
00026       PSSR(HashFunction* hash);
00027 
00028       /**
00029       * @param hash the hash object to use
00030       * @param salt_size the size of the salt to use in bytes
00031       */
00032       PSSR(HashFunction* hash, size_t salt_size);
00033 
00034       static PSSR* make(const Spec& spec);
00035    private:
00036       void update(const byte input[], size_t length);
00037 
00038       secure_vector<byte> raw_data();
00039 
00040       secure_vector<byte> encoding_of(const secure_vector<byte>& msg,
00041                                       size_t output_bits,
00042                                       RandomNumberGenerator& rng);
00043 
00044       bool verify(const secure_vector<byte>& coded,
00045                   const secure_vector<byte>& raw,
00046                   size_t key_bits);
00047 
00048       size_t SALT_SIZE;
00049       std::unique_ptr<HashFunction> hash;
00050    };
00051 
00052 }
00053 
00054 #endif