Botan  1.11.15
src/lib/tls/tls_handshake_hash.h
Go to the documentation of this file.
00001 /*
00002 * TLS Handshake Hash
00003 * (C) 2004-2006,2011,2012 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_TLS_HANDSHAKE_HASH_H__
00009 #define BOTAN_TLS_HANDSHAKE_HASH_H__
00010 
00011 #include <botan/secmem.h>
00012 #include <botan/tls_version.h>
00013 #include <botan/tls_magic.h>
00014 
00015 namespace Botan {
00016 
00017 namespace TLS {
00018 
00019 using namespace Botan;
00020 
00021 /**
00022 * TLS Handshake Hash
00023 */
00024 class Handshake_Hash
00025    {
00026    public:
00027       void update(const byte in[], size_t length)
00028          { data += std::make_pair(in, length); }
00029 
00030       void update(const std::vector<byte>& in)
00031          { data += in; }
00032 
00033       secure_vector<byte> final(Protocol_Version version,
00034                                 const std::string& mac_algo) const;
00035 
00036       const std::vector<byte>& get_contents() const { return data; }
00037 
00038       void reset() { data.clear(); }
00039    private:
00040       std::vector<byte> data;
00041    };
00042 
00043 }
00044 
00045 }
00046 
00047 #endif