/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) // // See accompanying file COPYING.TXT file for licensing details. // /////////////////////////////////////////////////////////////////////////////// #ifndef CPPCMS_HMAC_ENCRYPTOR_H #define CPPCMS_HMAC_ENCRYPTOR_H #include #include #include #include namespace cppcms { namespace sessions { namespace impl { class CPPCMS_API hmac_factory : public encryptor_factory { public: virtual std::auto_ptr get(); hmac_factory(std::string const &algo,crypto::key const &k); virtual ~hmac_factory() {} private: std::string algo_; crypto::key key_; }; class CPPCMS_API hmac_cipher : public cppcms::sessions::encryptor { public: hmac_cipher(std::string const &hash_name,crypto::key const &key); virtual std::string encrypt(std::string const &plain); virtual bool decrypt(std::string const &cipher,std::string &plain); static bool equal(void const *a,void const *b,size_t n); private: crypto::key key_; std::string hash_; }; } // impl } // sessions } // cppcms #endif