wickr-crypto-c
Data Structures | Functions
Wickr_transport_root_key

Data Structures

struct  wickr_transport_root_key
 A root key for the wickr_transport_ctx that is used to communicate the master secret for the transport communication. The root key can be converted to a set of stream keys based on direction for use in a transport. More...
 

Functions

wickr_transport_root_key_twickr_transport_root_key_create_random (const wickr_crypto_engine_t *engine, wickr_cipher_t cipher, uint32_t packets_per_evo_send, uint32_t packets_per_evo_recv)
 
wickr_transport_root_key_twickr_transport_root_key_create (wickr_buffer_t *secret, wickr_cipher_t cipher, uint32_t packets_per_evo_send, uint32_t packets_per_evo_recv)
 
wickr_transport_root_key_twickr_transport_root_key_copy (const wickr_transport_root_key_t *root_key)
 
void wickr_transport_root_key_destroy (wickr_transport_root_key_t **root_key)
 
wickr_stream_key_twickr_transport_root_key_to_stream_key (const wickr_transport_root_key_t *root_key, const wickr_crypto_engine_t *engine, const wickr_buffer_t *salt, const wickr_buffer_t *stream_id, wickr_stream_direction direction)
 

Detailed Description

Function Documentation

◆ wickr_transport_root_key_copy()

wickr_transport_root_key_t* wickr_transport_root_key_copy ( const wickr_transport_root_key_t root_key)

Copy a transport root key

Parameters
root_keythe transport root key to copy
Returns
a newly allocated transport root key holding a deep copy of the properties of root_key

◆ wickr_transport_root_key_create()

wickr_transport_root_key_t* wickr_transport_root_key_create ( wickr_buffer_t secret,
wickr_cipher_t  cipher,
uint32_t  packets_per_evo_send,
uint32_t  packets_per_evo_recv 
)

Create a root key using a random secret of length cipher.key_key

Parameters
secreta secret of length cipher.key_len
cipherthe cipher to use for generating stream keys
packets_per_evo_sendthe value to set for packets_per_evolution when creating a stream key in the ENCODE direction
packets_per_evo_recvthe value to set for packets_per_evolution when creating a stream key in the DECODE direction
Returns
a newly allocated transport root key taking ownership of secret or NULL if allocation fails

◆ wickr_transport_root_key_create_random()

wickr_transport_root_key_t* wickr_transport_root_key_create_random ( const wickr_crypto_engine_t engine,
wickr_cipher_t  cipher,
uint32_t  packets_per_evo_send,
uint32_t  packets_per_evo_recv 
)

Create a root key using a random secret of length cipher.key_key

Parameters
enginea pointer to a crypto engine that can generate random bytes
cipherthe cipher to use for generating stream keys
packets_per_evo_sendthe value to set for packets_per_evolution when creating a stream key in the ENCODE direction
packets_per_evo_recvthe value to set for packets_per_evolution when creating a stream key in the DECODE direction
Returns
a newly allocated transport root key or NULL if random generation fails

◆ wickr_transport_root_key_destroy()

void wickr_transport_root_key_destroy ( wickr_transport_root_key_t **  root_key)

Destroy a transport root key

Parameters
root_keya pointer to the transport root key to destroy. All properties of *root_key will also be destroyed

◆ wickr_transport_root_key_to_stream_key()

wickr_stream_key_t* wickr_transport_root_key_to_stream_key ( const wickr_transport_root_key_t root_key,
const wickr_crypto_engine_t engine,
const wickr_buffer_t salt,
const wickr_buffer_t stream_id,
wickr_stream_direction  direction 
)

Convert a transport root key into a stream key

Parameters
root_keythe transport root key to convert into a stream key
enginea pointer to a crypto engine that supports HKDF functionality
saltthe salt to use for the HKDF function
stream_ida stream id that will differentiate the stream between the ENCODE and DECODE directions
directionthe direction to set on the resulting stream key
Returns
a newly allocated stream key or NULL if stream key generation fails