wickr-crypto-c
Data Structures | Functions
Key Exchange

Data Structures

struct  wickr_key_exchange
 Public key exchange protected data. After a shared secret is generated using a public key with identifier 'key_id', and run through a KDF, it is used to encrypt data to be protected by the exchange and the ciphertext is stored in 'exchange_ciphertext'. More...
 

Functions

wickr_key_exchange_twickr_key_exchange_create (wickr_buffer_t *exchange_id, uint64_t key_id, wickr_cipher_result_t *exchange_ciphertext)
 
wickr_key_exchange_twickr_key_exchange_copy (const wickr_key_exchange_t *source)
 
void wickr_key_exchange_destroy (wickr_key_exchange_t **exchange)
 
wickr_exchange_array_t * wickr_exchange_array_new (uint32_t exchange_count)
 
bool wickr_exchange_array_set_item (wickr_exchange_array_t *array, uint32_t index, wickr_key_exchange_t *exchange)
 
wickr_key_exchange_twickr_exchange_array_fetch_item (wickr_exchange_array_t *array, uint32_t index)
 
wickr_array_t * wickr_exchange_array_copy (wickr_exchange_array_t *array)
 
void wickr_exchange_array_destroy (wickr_exchange_array_t **array)
 

Detailed Description

Function Documentation

◆ wickr_exchange_array_copy()

wickr_array_t* wickr_exchange_array_copy ( wickr_exchange_array_t *  array)
Parameters
arraythe array to copy
Returns
a newly allocated key exchange array that contains deep copies of the items from 'array'

◆ wickr_exchange_array_destroy()

void wickr_exchange_array_destroy ( wickr_exchange_array_t **  array)
Parameters
arraya pointer to the array to destroy, all items of '*array' are also destroyed

◆ wickr_exchange_array_fetch_item()

wickr_key_exchange_t* wickr_exchange_array_fetch_item ( wickr_exchange_array_t *  array,
uint32_t  index 
)

Fetch a key exchange from an exchange array

NOTE: Calling this function does not make a copy of the exchange being returned, the array still owns it

Parameters
arraythe array to fetch 'index' from
indexthe index to fetch from 'array'
Returns
a key exchange representing 'index' from the array

◆ wickr_exchange_array_new()

wickr_exchange_array_t* wickr_exchange_array_new ( uint32_t  exchange_count)

Allocate a new key exchange array

Parameters
exchange_countthe number of exchanges the array should hold
Returns
a newly allocated wickr_array for key exchange objects

◆ wickr_exchange_array_set_item()

bool wickr_exchange_array_set_item ( wickr_exchange_array_t *  array,
uint32_t  index,
wickr_key_exchange_t exchange 
)

Set an item in a key exchange array

NOTE: Calling this function does not make a copy of 'exchange', the array simply takes ownership of it

Parameters
arraythe array to set 'exchange' into
indexthe location in 'array' to set exchange
exchangethe exchange to set at position 'index' in 'array'
Returns
true if setting succeeds, false if the index is out of bounds

◆ wickr_key_exchange_copy()

wickr_key_exchange_t* wickr_key_exchange_copy ( const wickr_key_exchange_t source)

Copy a key exchange

Parameters
sourcethe key exchange to copy
Returns
a newly allocated node holding a deep copy of the properties of 'source'

◆ wickr_key_exchange_create()

wickr_key_exchange_t* wickr_key_exchange_create ( wickr_buffer_t exchange_id,
uint64_t  key_id,
wickr_cipher_result_t exchange_ciphertext 
)

Create a key exchange from properties

Parameters
exchange_idsee 'wickr_key_exchange' property documentation property documentation
key_idsee 'wickr_key_exchange' property documentation property documentation
exchange_ciphertextsee 'wickr_key_exchange' property documentation property documentation
Returns
a newly allocated packet metadata set owning the properties passed in

◆ wickr_key_exchange_destroy()

void wickr_key_exchange_destroy ( wickr_key_exchange_t **  exchange)

Destroy a key exchange

Parameters
exchangea pointer to the key exchange to destroy. All properties of '*exchange' will also be destroyed