wickr-crypto-c

Data Structures | Functions
Key Exchange Set

## Data Structures
struct | wickr_key_exchange_set
| A collection of key exchanges for a set of recipients. The data protected inside 'exchange_ciphertext' for each recipient is derived by each recipient node using their individualized key exchange. See Wickr white paper 'Prepare Packet Header' section for more information. More...

## Functions
wickr_key_exchange_set_t * | wickr_key_exchange_set_create (wickr_ec_key_t *sender_pub, wickr_exchange_array_t *exchanges)
wickr_key_exchange_t * | wickr_key_exchange_set_find (const wickr_key_exchange_set_t *exchange_set, const wickr_buffer_t *identifier)
wickr_key_exchange_set_t * | wickr_key_exchange_set_copy (const wickr_key_exchange_set_t *source)
void | wickr_key_exchange_set_destroy (wickr_key_exchange_set_t **exchange_set)
wickr_buffer_t * | wickr_key_exchange_set_serialize (const wickr_key_exchange_set_t *exchange_set)
wickr_key_exchange_set_t * | wickr_key_exchange_set_create_from_buffer (const wickr_crypto_engine_t *engine, const wickr_buffer_t *buffer)
wickr_cipher_result_t * | wickr_key_exchange_set_encrypt (const wickr_key_exchange_set_t *exchange_set, const wickr_crypto_engine_t *engine, const wickr_cipher_key_t *header_key)
wickr_key_exchange_set_t * | wickr_key_exchange_set_create_from_cipher (const wickr_crypto_engine_t *engine, const wickr_cipher_result_t *cipher_result, const wickr_cipher_key_t *header_key)

## Detailed Description

## Function Documentation

## ◆ wickr_key_exchange_set_copy()

wickr_key_exchange_set_t* wickr_key_exchange_set_copy | ( | const wickr_key_exchange_set_t * | source | ) |

Copy a key exchange set

Parameters

  source | the key exchange set to copy

Returns
  a newly allocated key exchange set holding a deep copy of the properties of 'source'

## ◆ wickr_key_exchange_set_create()

wickr_key_exchange_set_t* wickr_key_exchange_set_create | ( | wickr_ec_key_t * | sender_pub,
|  | wickr_exchange_array_t * | exchanges
| ) |  |

Create a key exchange set from components

Parameters

  sender_pub | see 'wickr_key_exchange_set' property documentation property documentation
  exchanges | see 'wickr_key_exchange_set' property documentation property documentation

Returns
  a newly allocated key exchange set owning the properties passed in

## ◆ wickr_key_exchange_set_create_from_buffer()

wickr_key_exchange_set_t* wickr_key_exchange_set_create_from_buffer | ( | const wickr_crypto_engine_t * | engine,
|  | const wickr_buffer_t * | buffer
| ) |  |

Create a key exchange set from bytes

Parameters

  engine | a crypto engine to use for importing key information within the exchange set
  buffer | the buffer containing a serialized representation of a 'wickr_key_exchange_set'

Returns
  a key exchange set built from the bytes of 'buffer' or NULL if deserialization fails

## ◆ wickr_key_exchange_set_create_from_cipher()

wickr_key_exchange_set_t* wickr_key_exchange_set_create_from_cipher | ( | const wickr_crypto_engine_t * | engine,
|  | const wickr_cipher_result_t * | cipher_result,
|  | const wickr_cipher_key_t * | header_key
| ) |  |

Decrypt-Then-Deserialize a packet key exchange set

NOTE: This is a low level function that should not be called directly from this API if it can be avoided. Please use the 'wickr_ctx' API instead since it is a higher level and safer set of functions

Parameters

  engine | a crypto engine capable of decryption using header_key
  cipher_result | an encrypted key exchange set
  header_key | the key to use for decryption

Returns
  a decrypted key exchange set or NULL if the decryption key is incorrect

## ◆ wickr_key_exchange_set_destroy()

void wickr_key_exchange_set_destroy | ( | wickr_key_exchange_set_t ** | exchange_set | ) |

Destroy a key exchange set

Parameters

  exchange_set | a pointer to the key exchange set to destroy. All properties of '*exchange_set' will also be destroyed

## ◆ wickr_key_exchange_set_encrypt()

wickr_cipher_result_t* wickr_key_exchange_set_encrypt | ( | const wickr_key_exchange_set_t * | exchange_set,
|  | const wickr_crypto_engine_t * | engine,
|  | const wickr_cipher_key_t * | header_key
| ) |  |

Serialize-Then-Encrypt a packet key exchange set

The packet key exchange set is serialized using protocol buffers (message.pb-c.h)

NOTE: This is a low level function that should not be called directly from this API if it can be avoided. Please use the 'wickr_ctx' API instead since it is a higher level and safer set of functions

Parameters

  exchange_set | the key_exchange_set to encrypt
  engine | a crypto engine capable of encryption using header_key
  header_key | the key to encrypt the key exchange set with

Returns
  an encrypted key exchange set

## ◆ wickr_key_exchange_set_find()

wickr_key_exchange_t* wickr_key_exchange_set_find | ( | const wickr_key_exchange_set_t * | exchange_set,
|  | const wickr_buffer_t * | identifier
| ) |  |

Find a particular exchange in the exchange set

Parameters

  exchange_set | the exchange set to search
  identifier | the identifier of the exchange to find

Returns
  the key exchange for 'identifier' or NULL if it cannot be found

## ◆ wickr_key_exchange_set_serialize()

wickr_buffer_t* wickr_key_exchange_set_serialize | ( | const wickr_key_exchange_set_t * | exchange_set | ) |

Serialize a key exchange set using protocol buffers

Parameters

  exchange_set | the exchange set to serialize into bytes

Returns
  bytes representing 'exchange_set' with protocol buffers or NULL if serialization fails