/* * TLS Client * (C) 2004-2010 Jack Lloyd * * Released under the terms of the Botan license */ #ifndef BOTAN_TLS_CLIENT_H__ #define BOTAN_TLS_CLIENT_H__ #include #include #include #include #include namespace Botan { /** * TLS Client */ class BOTAN_DLL TLS_Client : public TLS_Connection { public: size_t read(byte buf[], size_t buf_len); void write(const byte buf[], size_t buf_len); void close(); bool is_closed() const; std::vector peer_cert_chain() const; void add_client_cert(const X509_Certificate& cert, Private_Key* cert_key); TLS_Client(std::function input_fn, std::function output_fn, const TLS_Policy& policy, RandomNumberGenerator& rng); ~TLS_Client(); private: void close(Alert_Level, Alert_Type); size_t get_pending_socket_input(byte output[], size_t length); void initialize(); void do_handshake(); void state_machine(); void read_handshake(byte, const MemoryRegion&); void process_handshake_msg(Handshake_Type, const MemoryRegion&); std::function input_fn; const TLS_Policy& policy; RandomNumberGenerator& rng; Record_Writer writer; Record_Reader reader; std::vector peer_certs; std::vector > certs; class Handshake_State* state; SecureVector session_id; SecureQueue read_buf; bool active; }; } #endif