wickr-crypto-c

Data Structures | Functions
Wickr_root_keys

## Data Structures
struct | wickr_root_keys
| Root level crypto keys for signatures, local encryption, and remote encryption. More...

## Functions
wickr_root_keys_t * | wickr_root_keys_create (wickr_ec_key_t *node_signature_root, wickr_cipher_key_t *node_storage_root, wickr_cipher_key_t *remote_storage_root)
wickr_root_keys_t * | wickr_root_keys_generate (const wickr_crypto_engine_t *engine)
wickr_root_keys_t * | wickr_root_keys_create_from_buffer (const wickr_crypto_engine_t *engine, const wickr_buffer_t *buffer)
wickr_buffer_t * | wickr_root_keys_serialize (const wickr_root_keys_t *keys)
wickr_cipher_result_t * | wickr_root_keys_export (const wickr_root_keys_t *keys, const wickr_crypto_engine_t *engine, const wickr_cipher_key_t *export_key)
wickr_storage_keys_t * | wickr_root_keys_localize (const wickr_root_keys_t *keys, const wickr_crypto_engine_t *engine, const wickr_dev_info_t *dev_info)
wickr_root_keys_t * | wickr_root_keys_copy (const wickr_root_keys_t *source)
void | wickr_root_keys_destroy (wickr_root_keys_t **keys)

## Detailed Description

## Function Documentation

## ◆ wickr_root_keys_copy()

wickr_root_keys_t* wickr_root_keys_copy | ( | const wickr_root_keys_t * | source | ) |

Copy a root key set

Parameters

  source | the root key set to copy

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

## ◆ wickr_root_keys_create()

wickr_root_keys_t* wickr_root_keys_create | ( | wickr_ec_key_t * | node_signature_root,
|  | wickr_cipher_key_t * | node_storage_root,
|  | wickr_cipher_key_t * | remote_storage_root
| ) |  |

Create a root key set from components

Parameters

  node_signature_root | see 'wickr_root_keys' property documentation
  node_storage_root | see 'wickr_root_keys' property documentation
  remote_storage_root | see 'wickr_root_keys' property documentation

Returns
  a newly allocated root key set. Takes ownership of the passed inputs

## ◆ wickr_root_keys_create_from_buffer()

wickr_root_keys_t* wickr_root_keys_create_from_buffer | ( | const wickr_crypto_engine_t * | engine,
|  | const wickr_buffer_t * | buffer
| ) |  |

Create a root key set from the serialized output of 'wickr_root_keys_serialize'

Parameters

  engine | a crypto engine to validate the decoded EC keys
  buffer | a buffer containing serialized root keys

Returns
  a root key set parsed out of buffer, or NULL if parsing fails

## ◆ wickr_root_keys_destroy()

void wickr_root_keys_destroy | ( | wickr_root_keys_t ** | keys | ) |

Destroy a root key set

Parameters

  keys | a pointer to a root key set to destroy. Will destroy the sub properties of '*keys' as well

## ◆ wickr_root_keys_export()

wickr_cipher_result_t* wickr_root_keys_export | ( | const wickr_root_keys_t * | keys,
|  | const wickr_crypto_engine_t * | engine,
|  | const wickr_cipher_key_t * | export_key
| ) |  |

Serialize and encrypt root keys

Parameters

  keys | the keys to serialize and encrypt
  engine | a crypto engine capable of encrypting data using 'export_key'
  export_key | the key to use for encryption of the serialized keys

Returns
  a cipher result of serialized 'keys' encrypted with 'export_key'

## ◆ wickr_root_keys_generate()

wickr_root_keys_t* wickr_root_keys_generate | ( | const wickr_crypto_engine_t * | engine | ) |

Generate a random set of root keys

Parameters

  engine | a crypto engine supporting random EC and cipher key generation

Returns
  a random set of root keys

## ◆ wickr_root_keys_localize()

wickr_storage_keys_t* wickr_root_keys_localize | ( | const wickr_root_keys_t * | keys,
|  | const wickr_crypto_engine_t * | engine,
|  | const wickr_dev_info_t * | dev_info
| ) |  |

Convert a root key set into a storage key set for a local device

Currently the local storage key is created by taking SHA256(keys->node_storage_root || dev_info->system_salt)

Parameters

  keys | the keys to convert
  engine | a crypto engine to use for conversion
  dev_info | the device to localize the keys to

Returns
  a set of storage keys bound to 'dev_info'

## ◆ wickr_root_keys_serialize()

wickr_buffer_t* wickr_root_keys_serialize | ( | const wickr_root_keys_t * | keys | ) |

Serialize root keys into a buffer

Parameters

  keys | the keys to serialize

Returns
  a buffer containing serialized root keys as a protocol buffer object