ark::crypt::TlsStream
Defined in header “ark/crypt/tls_stream.hh”.
A TLS stream can be used with something (like for example a socket) to establish a secure connection between endpoints.
Typedefs
- using native_handle_type = int
A typedef for the native handle type (for file descriptors).
Methods
-
TlsStream(SSL_CTX * context)
Constructor. Initializes the stream from the given context. -
~TlsStream()
Destructor. Cleans up resources. -
size_t write(std::string_view message)
Writes the given bytes over this stream. Returns the number of bytes actually written. -
std::string read()
Reads some number of bytes from the stream and returns them as a string. -
void set_native_handle(native_handle_type handle)
Sets the file descriptor for the stream. -
void accept()
Accepts the incoming client, handling negotiation. -
void connect()
Connects over this file descriptor, handling negotation. -
std::string get_peer_certificate()
Returns the peer certificate for this connection, PEM encoded.