Botan
1.11.15
|
00001 /* 00002 * HKDF 00003 * (C) 2013,2015 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_HKDF_H__ 00009 #define BOTAN_HKDF_H__ 00010 00011 #include <botan/mac.h> 00012 #include <botan/hash.h> 00013 #include <botan/kdf.h> 00014 00015 namespace Botan { 00016 00017 /** 00018 * HKDF, see @rfc 5869 for details 00019 * This is only the expansion portion of HKDF 00020 */ 00021 class BOTAN_DLL HKDF : public KDF 00022 { 00023 public: 00024 HKDF(MessageAuthenticationCode* prf) : m_prf(prf) {} 00025 00026 static HKDF* make(const Spec& spec); 00027 00028 KDF* clone() const { return new HKDF(m_prf->clone()); } 00029 00030 std::string name() const { return "HKDF(" + m_prf->name() + ")"; } 00031 00032 size_t kdf(byte out[], size_t out_len, 00033 const byte secret[], size_t secret_len, 00034 const byte salt[], size_t salt_len) const override; 00035 00036 private: 00037 std::unique_ptr<MessageAuthenticationCode> m_prf; 00038 }; 00039 00040 } 00041 00042 #endif