Botan

TLS Record Handling

License
Botan is released under the Simplified BSD License (see LICENSE.md)

TLS Cipher State


this()(TLSProtocolVersion _version, ConnectionSide side, bool our_side, in TLSCiphersuite suite, auto ref const TLSSessionKeys keys);

Initialize a new cipher state


package void  writeRecord(ref SecureVector!ubyte output, ubyte msg_type, const(ubyte)* msg, size_t msg_length, TLSProtocolVersion _version, ulong msg_sequence, ConnectionCipherState cipherstate, RandomNumberGenerator rng);

Create a TLS record

Parameters
SecureVector!ubyte output the output record is placed here
ubyte msg_type is the type of the message (handshake, alert, ...)
const(ubyte)* msg is the plaintext message
size_t msg_length is the length of msg
TLSProtocolVersion _version is the protocol version
ulong msg_sequence is the sequence number
ConnectionCipherState cipherstate is the writing cipher state
RandomNumberGenerator rng is a random number generator
Returns
number of bytes written to write_buffer

package size_t  readRecord(ref SecureVector!ubyte readbuf, const(ubyte)* input, size_t input_sz, ref size_t consumed, ref SecureVector!ubyte record, ref ulong record_sequence, ref TLSProtocolVersion record_version, ref RecordType record_type, ConnectionSequenceNumbers sequence_numbers, in const(ConnectionCipherState) delegate(ushort) get_cipherstate);

Decode a TLS record

Returns
zero if full message, else number of bytes still needed