wickr-crypto-c
Data Structures | Functions
Wickr_transport_packet

Data Structures

struct  wickr_transport_packet
 A packet used within the wickr_transport_ctx to package up data and related metadata + authentication in one serializable structure. More...
 

Functions

wickr_transport_packet_twickr_transport_packet_create (wickr_transport_packet_meta_t meta, wickr_buffer_t *body)
 
wickr_transport_packet_twickr_transport_packet_copy (const wickr_transport_packet_t *pkt)
 
void wickr_transport_packet_destroy (wickr_transport_packet_t **pkt)
 
wickr_buffer_twickr_transport_packet_serialize (const wickr_transport_packet_t *pkt)
 
wickr_transport_packet_twickr_transport_packet_create_from_buffer (const wickr_buffer_t *buffer)
 
bool wickr_transport_packet_sign (wickr_transport_packet_t *pkt, const wickr_crypto_engine_t *engine, const wickr_identity_chain_t *identity_chain)
 
bool wickr_transport_packet_verify (const wickr_transport_packet_t *packet, const wickr_crypto_engine_t *engine, wickr_identity_chain_t *identity_chain)
 

Detailed Description

Function Documentation

◆ wickr_transport_packet_copy()

wickr_transport_packet_t* wickr_transport_packet_copy ( const wickr_transport_packet_t pkt)

Make a deep copy of a transport packet

Parameters
pktthe transport packet to make a copy of
Returns
a newly allocated transport packet holding a deep copy of the properties of 'pkt'

◆ wickr_transport_packet_create()

wickr_transport_packet_t* wickr_transport_packet_create ( wickr_transport_packet_meta_t  meta,
wickr_buffer_t body 
)

Create a transport packet

Parameters
metametadata describing body
bodythe main contents of the packet

◆ wickr_transport_packet_create_from_buffer()

wickr_transport_packet_t* wickr_transport_packet_create_from_buffer ( const wickr_buffer_t buffer)

Create a transport packet from a serialized transport packet

Parameters
buffera buffer that was created by a call to wickr_transport_packet_serialize
Returns
a newly allocated transport packet from the data contained in buffer or NULL if the buffer is corrupt or does not represent a transport packet

◆ wickr_transport_packet_destroy()

void wickr_transport_packet_destroy ( wickr_transport_packet_t **  pkt)

Destroy a transport packet

Parameters
pkta pointer to the transport packet to destroy. All properties of *pkt will also be destroyed

◆ wickr_transport_packet_serialize()

wickr_buffer_t* wickr_transport_packet_serialize ( const wickr_transport_packet_t pkt)

Serialize a transport packet down to a buffer for transfer

Parameters
pktthe packet to serialize
Returns
the byte representation of pkt or NULL if serialization fails

◆ wickr_transport_packet_sign()

bool wickr_transport_packet_sign ( wickr_transport_packet_t pkt,
const wickr_crypto_engine_t engine,
const wickr_identity_chain_t identity_chain 
)

Sign a transport packet to authenticate it using an identity chain. Upon successful signing, the mac type of pkt will be set based on the type of key used for the signature

Parameters
pktthe packet to sign
enginea pointer to a crypto engine that support digital signatures
identity_chainan identity chain that at minimum contains the private key for a node identity in order to sign the packet
Returns
true if signing is successful

◆ wickr_transport_packet_verify()

bool wickr_transport_packet_verify ( const wickr_transport_packet_t packet,
const wickr_crypto_engine_t engine,
wickr_identity_chain_t identity_chain 
)

Verify a packet that was signed by a call to wickr_transport_packet_sign

Parameters
packetthe packet to verify
enginea pointer to a crypto engine that supports verifying digital signatures
identity_chainthe public identity chain that is believed to have signed packet
Returns
true if packet was signed by identity_chain