wickr-crypto-c
Data Structures | Functions
wickr_stream_key

Data Structures

struct  wickr_stream_key
 A data structure representing the stream encoding / decoding key material A stream key holds information about the key material used for cipher operations as well as it's next evolution key and the number of packets this key should be used to encode or decode before evolution takes place. More...
 

Functions

wickr_stream_key_twickr_stream_key_create (wickr_cipher_key_t *cipher_key, wickr_buffer_t *evolution_key, uint32_t packets_per_evolution)
 
wickr_stream_key_twickr_stream_key_create_user_data (wickr_cipher_key_t *cipher_key, wickr_buffer_t *evolution_key, uint32_t packets_per_evolution, wickr_buffer_t *user_data)
 
wickr_stream_key_twickr_stream_key_create_rand (const wickr_crypto_engine_t engine, wickr_cipher_t cipher, uint32_t packets_per_evolution)
 
wickr_stream_key_twickr_stream_key_copy (const wickr_stream_key_t *stream_key)
 
wickr_buffer_twickr_stream_key_serialize (const wickr_stream_key_t *key)
 
wickr_stream_key_twickr_stream_key_create_from_buffer (const wickr_buffer_t *buffer)
 
void wickr_stream_key_destroy (wickr_stream_key_t **stream_key)
 

Detailed Description

Function Documentation

◆ wickr_stream_key_copy()

wickr_stream_key_t* wickr_stream_key_copy ( const wickr_stream_key_t stream_key)

Copy a stream key

Parameters
stream_keythe stream key to copy
Returns
a newly allocated stream key holding a deep copy of properties from 'stream_key'

◆ wickr_stream_key_create()

wickr_stream_key_t* wickr_stream_key_create ( wickr_cipher_key_t cipher_key,
wickr_buffer_t evolution_key,
uint32_t  packets_per_evolution 
)

Create a stream key from components

Parameters
cipher_keysee documentation of 'wickr_stream_key' structure
evolution_keysee documentation of 'wickr_stream_key' structure
packets_per_evolutionsee documentation of 'wickr_stream_key' structure
Returns
a newly allocated stream key owning the properties passed in

◆ wickr_stream_key_create_from_buffer()

wickr_stream_key_t* wickr_stream_key_create_from_buffer ( const wickr_buffer_t buffer)

Create a stream key from a serialized buffer

Parameters
bufferthe buffer to parse into a stream key
Returns
a newly allocated stream key represented by 'buffer' or NULL if parsing buffer fails

◆ wickr_stream_key_create_rand()

wickr_stream_key_t* wickr_stream_key_create_rand ( const wickr_crypto_engine_t  engine,
wickr_cipher_t  cipher,
uint32_t  packets_per_evolution 
)

Generate a random stream key

Parameters
enginethe crypto engine to use for secure random cipher key generation
cipherthe cipher to use for generation of the internal 'cipher_key' property
packets_per_evolutionthe number of times this key should be used before it evoloves
Returns
a newly allocated stream key

◆ wickr_stream_key_create_user_data()

wickr_stream_key_t* wickr_stream_key_create_user_data ( wickr_cipher_key_t cipher_key,
wickr_buffer_t evolution_key,
uint32_t  packets_per_evolution,
wickr_buffer_t user_data 
)

Create a stream key from components with user data

Parameters
cipher_keysee documentation of 'wickr_stream_key' structure
evolution_keysee documentation of 'wickr_stream_key' structure
packets_per_evolutionsee documentation of 'wickr_stream_key' structure
user_datasee documentation of 'wickr_stream_key' structure
Returns
a newly allocated stream key owning the properties passed in

◆ wickr_stream_key_destroy()

void wickr_stream_key_destroy ( wickr_stream_key_t **  stream_key)

Destroy a stream key

Parameters
stream_keya pointer to the stream key to destroy. All properties of '*stream_key' will also be destroyed

◆ wickr_stream_key_serialize()

wickr_buffer_t* wickr_stream_key_serialize ( const wickr_stream_key_t key)

Serialize a stream key

Parameters
keythe key to serialize
Returns
a serialized protocol buffer object representing the properties of 'key'