wickr-crypto-c
Data Structures | Functions
Wickr_ephemeral_keypair

Data Structures

struct  wickr_ephemeral_keypair
 Represents a key pair used for message key exchanges within the Wickr Messaging Protocol. More...
 

Functions

wickr_ephemeral_keypair_twickr_ephemeral_keypair_create (uint64_t identifier, wickr_ec_key_t *ec_key, wickr_ecdsa_result_t *signature)
 
wickr_ephemeral_keypair_twickr_ephemeral_keypair_copy (const wickr_ephemeral_keypair_t *source)
 
wickr_ephemeral_keypair_twickr_ephemeral_keypair_generate_identity (const wickr_crypto_engine_t *engine, uint64_t identifier, const wickr_identity_t *identity)
 
bool wickr_ephemeral_keypair_verify_owner (const wickr_ephemeral_keypair_t *keypair, const wickr_crypto_engine_t *engine, const wickr_identity_t *owner)
 
void wickr_ephemeral_keypair_make_public (const wickr_ephemeral_keypair_t *keypair)
 
wickr_buffer_twickr_ephemeral_keypair_serialize (const wickr_ephemeral_keypair_t *keypair)
 
wickr_ephemeral_keypair_twickr_ephemeral_keypair_create_from_buffer (const wickr_buffer_t *buffer, const wickr_crypto_engine_t *engine)
 
void wickr_ephemeral_keypair_destroy (wickr_ephemeral_keypair_t **keypair)
 

Detailed Description

Function Documentation

◆ wickr_ephemeral_keypair_copy()

wickr_ephemeral_keypair_t* wickr_ephemeral_keypair_copy ( const wickr_ephemeral_keypair_t source)

Copy an ephemeral keypair

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

◆ wickr_ephemeral_keypair_create()

wickr_ephemeral_keypair_t* wickr_ephemeral_keypair_create ( uint64_t  identifier,
wickr_ec_key_t ec_key,
wickr_ecdsa_result_t signature 
)

Create an Ephemeral Keypair from components

Parameters
identifierthe numerical identifier of the keypair
ec_keyan Elliptic Curve public keypair
signaturea signature of the public key material in 'ec_key' by the owner of this key
Returns
a newly allocated Ephemeral Keypair, owning the properties that were passed in

◆ wickr_ephemeral_keypair_create_from_buffer()

wickr_ephemeral_keypair_t* wickr_ephemeral_keypair_create_from_buffer ( const wickr_buffer_t buffer,
const wickr_crypto_engine_t engine 
)

Create an ephemeral keypair from a buffer that was created with 'wickr_ephemeral_keypair_serialize'

Parameters
bufferthe buffer that contains a serialized representation of an identity chain
enginethe crypto engine to use to import the key components of the ephemeral keypair
Returns
deserialized ephemeral keypair or null if the deserialization fails

◆ wickr_ephemeral_keypair_destroy()

void wickr_ephemeral_keypair_destroy ( wickr_ephemeral_keypair_t **  keypair)

Destroy an ephemeral keypair

Parameters
keypaira pointer to the key pair to destroy. All properties of '*keypair' will also be destroyed

◆ wickr_ephemeral_keypair_generate_identity()

wickr_ephemeral_keypair_t* wickr_ephemeral_keypair_generate_identity ( const wickr_crypto_engine_t engine,
uint64_t  identifier,
const wickr_identity_t identity 
)

Generate a new ephemeral key pair given an owner identity.

This method will use the 'default_curve' property of the crypto engine provided as the curve for the resulting keypair

Parameters
enginecrypto engine supporting random Elliptic Curve generation, and ECDSA signatures
identifierthe identifier to assign to the generated output keypair
identitythe identity to sign the generated output key pair with
Returns
a newly generated random Elliptic Curve key pair with identifier 'identifier' and a signature using the 'sig_key' property of the identity provided as the signing key

◆ wickr_ephemeral_keypair_make_public()

void wickr_ephemeral_keypair_make_public ( const wickr_ephemeral_keypair_t keypair)

Destroy the private components of the keypair

Parameters
keypairthe key pair to make public

◆ wickr_ephemeral_keypair_serialize()

wickr_buffer_t* wickr_ephemeral_keypair_serialize ( const wickr_ephemeral_keypair_t keypair)

Serialize an ephemeral keypair to bytes

Parameters
keypairthe ephemeral keypair to serialize
Returns
a buffer containing a serialized representation of 'keypair' or null if serialization fails

◆ wickr_ephemeral_keypair_verify_owner()

bool wickr_ephemeral_keypair_verify_owner ( const wickr_ephemeral_keypair_t keypair,
const wickr_crypto_engine_t engine,
const wickr_identity_t owner 
)

Verify the owner of an ephemeral key pair is a particular identity

Parameters
keypairthe key pair to verify the owner of
enginea crypto engine that supports verifying signatures generated with the curve associated with the 'sig_key' property of owner
ownerthe proposed owner of this keypair
Returns
true if the signature of key pair can be verified with the sig_key of owner