Botan 1.10.17
Botan::HandshakeHash Class Reference

#include <tls_handshake_hash.h>

Public Member Functions

SecureVector< bytefinal ()
SecureVector< bytefinal_ssl3 (const MemoryRegion< byte > &)
void update (byte in)
void update (const byte in[], size_t length)
void update (const MemoryRegion< byte > &in)

Detailed Description

TLS Handshake Hash

Definition at line 20 of file tls_handshake_hash.h.

Member Function Documentation

◆ final()

SecureVector< byte > Botan::HandshakeHash::final ( )

Return a TLS Handshake Hash

Definition at line 18 of file tls_handshake_hash.cpp.

19 {
20 MD5 md5;
21 SHA_160 sha1;
22
23 md5.update(data);
24 sha1.update(data);
25
26 SecureVector<byte> output;
27 output += md5.final();
28 output += sha1.final();
29 return output;
30 }

References Botan::Buffered_Computation::final(), and Botan::Buffered_Computation::update().

Referenced by Botan::Certificate_Verify::Certificate_Verify(), and Botan::Certificate_Verify::verify().

◆ final_ssl3()

SecureVector< byte > Botan::HandshakeHash::final_ssl3 ( const MemoryRegion< byte > & secret)

Return a SSLv3 Handshake Hash

Definition at line 35 of file tls_handshake_hash.cpp.

36 {
37 const byte PAD_INNER = 0x36, PAD_OUTER = 0x5C;
38
39 MD5 md5;
40 SHA_160 sha1;
41
42 md5.update(data);
43 sha1.update(data);
44
45 md5.update(secret);
46 sha1.update(secret);
47
48 for(size_t i = 0; i != 48; ++i)
49 md5.update(PAD_INNER);
50 for(size_t i = 0; i != 40; ++i)
51 sha1.update(PAD_INNER);
52
53 SecureVector<byte> inner_md5 = md5.final(), inner_sha1 = sha1.final();
54
55 md5.update(secret);
56 sha1.update(secret);
57 for(size_t i = 0; i != 48; ++i)
58 md5.update(PAD_OUTER);
59 for(size_t i = 0; i != 40; ++i)
60 sha1.update(PAD_OUTER);
61 md5.update(inner_md5);
62 sha1.update(inner_sha1);
63
64 SecureVector<byte> output;
65 output += md5.final();
66 output += sha1.final();
67 return output;
68 }

References Botan::Buffered_Computation::final(), and Botan::Buffered_Computation::update().

◆ update() [1/3]

void Botan::HandshakeHash::update ( byte in)
inline

Definition at line 29 of file tls_handshake_hash.h.

30 { data.push_back(in); }

◆ update() [2/3]

void Botan::HandshakeHash::update ( const byte in[],
size_t length )
inline

Definition at line 23 of file tls_handshake_hash.h.

24 { data += std::make_pair(in, length); }

Referenced by Botan::HandshakeMessage::send().

◆ update() [3/3]

void Botan::HandshakeHash::update ( const MemoryRegion< byte > & in)
inline

Definition at line 26 of file tls_handshake_hash.h.

27 { data += in; }

The documentation for this class was generated from the following files: