Botan
1.10.17
src
ssl
tls_client.h
Go to the documentation of this file.
1
/*
2
* TLS Client
3
* (C) 2004-2010 Jack Lloyd
4
*
5
* Released under the terms of the Botan license
6
*/
7
8
#ifndef BOTAN_TLS_CLIENT_H__
9
#define BOTAN_TLS_CLIENT_H__
10
11
#include <botan/tls_connection.h>
12
#include <botan/tls_policy.h>
13
#include <botan/tls_record.h>
14
#include <vector>
15
#include <string>
16
17
namespace
Botan
{
18
19
/**
20
* SSL/TLS Client
21
*/
22
class
BOTAN_DLL
TLS_Client
:
public
TLS_Connection
23
{
24
public
:
25
size_t
read
(
byte
buf[],
size_t
buf_len);
26
void
write
(
const
byte
buf[],
size_t
buf_len);
27
28
void
close
();
29
bool
is_closed
()
const
;
30
31
std::vector<X509_Certificate>
peer_cert_chain
()
const
;
32
33
void
add_client_cert
(
const
X509_Certificate
& cert,
34
Private_Key
* cert_key);
35
36
TLS_Client
(std::tr1::function<
size_t
(
byte
[],
size_t
)> input_fn,
37
std::tr1::function<
void
(
const
byte
[],
size_t
)> output_fn,
38
const
TLS_Policy
& policy,
39
RandomNumberGenerator
& rng);
40
41
~TLS_Client
();
42
private
:
43
void
close
(
Alert_Level
,
Alert_Type
);
44
45
size_t
get_pending_socket_input(
byte
output[],
size_t
length);
46
47
void
initialize();
48
void
do_handshake();
49
50
void
state_machine();
51
void
read_handshake(
byte
,
const
MemoryRegion<byte>
&);
52
void
process_handshake_msg(
Handshake_Type
,
const
MemoryRegion<byte>
&);
53
54
std::tr1::function<size_t (
byte
[],
size_t
)> input_fn;
55
56
const
TLS_Policy
& policy;
57
RandomNumberGenerator
& rng;
58
59
Record_Writer
writer;
60
Record_Reader
reader;
61
62
std::vector<X509_Certificate> peer_certs;
63
std::vector<std::pair<X509_Certificate, Private_Key*> > certs;
64
65
class
Handshake_State
* state;
66
SecureVector<byte>
session_id;
67
SecureQueue
read_buf;
68
bool
active;
69
};
70
71
}
72
73
#endif
Botan::Handshake_State
Definition
tls_state.h:20
Botan::MemoryRegion
Definition
secmem.h:22
Botan::Private_Key
Definition
pk_keys.h:87
Botan::RandomNumberGenerator
Definition
rng.h:21
Botan::Record_Reader
Definition
tls_record.h:80
Botan::Record_Writer
Definition
tls_record.h:40
Botan::SecureQueue
Definition
secqueue.h:20
Botan::SecureVector
Definition
secmem.h:329
Botan::TLS_Client::TLS_Client
TLS_Client(std::tr1::function< size_t(byte[], size_t)> input_fn, std::tr1::function< void(const byte[], size_t)> output_fn, const TLS_Policy &policy, RandomNumberGenerator &rng)
Definition
tls_client.cpp:84
Botan::TLS_Client::peer_cert_chain
std::vector< X509_Certificate > peer_cert_chain() const
Definition
tls_client.cpp:162
Botan::TLS_Client::close
void close()
Definition
tls_client.cpp:204
Botan::TLS_Client::is_closed
bool is_closed() const
Definition
tls_client.cpp:212
Botan::TLS_Client::read
size_t read(byte buf[], size_t buf_len)
Definition
tls_client.cpp:182
Botan::TLS_Client::write
void write(const byte buf[], size_t buf_len)
Definition
tls_client.cpp:170
Botan::TLS_Client::add_client_cert
void add_client_cert(const X509_Certificate &cert, Private_Key *cert_key)
Definition
tls_client.cpp:96
Botan::TLS_Connection
Definition
tls_connection.h:20
Botan::TLS_Policy
Definition
tls_policy.h:23
Botan::X509_Certificate
Definition
x509cert.h:24
Botan
Definition
algo_base.h:14
Botan::Alert_Type
Alert_Type
Definition
tls_magic.h:62
Botan::Handshake_Type
Handshake_Type
Definition
tls_magic.h:40
Botan::Alert_Level
Alert_Level
Definition
tls_magic.h:57
Generated by
1.18.0