wickr-crypto-c
Data Fields
wickr_stream_ctx Struct Reference

A context that is used for encrypting or decrypting a sequenced stream of data packets The stream context manages the state of stream operations including key evolution management based on the sequence number of the being encrypted / decrypted. The stream context is assigned a direction, and can only be used for encoding OR decoding of packets, and not both. More...

#include <stream_ctx.h>

Data Fields

wickr_crypto_engine_t engine
 
wickr_stream_key_tkey
 
wickr_stream_iv_tiv_factory
 
uint64_t last_seq
 
wickr_stream_direction direction
 
size_t ref_count
 

Detailed Description

A context that is used for encrypting or decrypting a sequenced stream of data packets The stream context manages the state of stream operations including key evolution management based on the sequence number of the being encrypted / decrypted. The stream context is assigned a direction, and can only be used for encoding OR decoding of packets, and not both.

Key evolution happens based on sequence number. Keyn+1 is generated by HMAC(Keyn, evolution_key). Gaps in sequence numbers are allowed and if the key needs to evolove multiple times, it will do so in a loop until the key is current, and data ciphering is possible. Sequence numbers can NOT go backwards due to the evolution's use of HMAC. Once Keyn+1 is generated, it is not possible to go back and calculate Keyn.

Field Documentation

◆ direction

wickr_stream_ctx::direction

the direction of this stream context. direction can either be encoding or decoding

◆ engine

wickr_stream_ctx::engine

crypto engine to be used for cipher operations, as well as key evolution using HMAC

◆ iv_factory

wickr_stream_ctx::iv_factory

the iv generator that this stream is using to create IVs

◆ key

wickr_stream_ctx::key

the current stream key that the stream context is using for encryption or decryption depending on direction the stream key will change over the course of packet encoding due to it's evolutions

◆ last_seq

wickr_stream_ctx::last_seq

the most recent sequence number that successfully encrypted or decrypted a packet

◆ ref_count

wickr_stream_ctx::ref_count

current reference count of the stream


The documentation for this struct was generated from the following file: