20#ifndef lime_double_ratchet_protocol_hpp
21#define lime_double_ratchet_protocol_hpp
68 template <
typename Curve>
69 constexpr size_t headerSize(uint8_t messageType)
noexcept {
85 template <
typename Curve>
86 constexpr size_t X3DHinitSize(
bool haveOPk,
typename std::enable_if_t<!std::is_base_of_v<genericKEM, Curve>,
bool> =
true) noexcept {
98 template <
typename Algo>
99 constexpr size_t X3DHinitSize(
bool haveOPk,
typename std::enable_if_t<std::is_base_of_v<genericKEM, Algo>,
bool> =
true) noexcept {
108 template <
typename Curve>
110 template <
typename Algo>
112 template <
typename Curve>
114 template <
typename Algo>
117 template <
typename Curve>
122#ifdef EC25519_ENABLED
136#ifdef EC25519_ENABLED
Base buffer definition for DSA data structure.
Definition lime_crypto_primitives.hpp:148
static constexpr size_t ssize(void)
provide a static size function to be able to call the function not on an object
Definition lime_crypto_primitives.hpp:151
Base buffer definition for KEM data structure.
Definition lime_crypto_primitives.hpp:102
static constexpr size_t ssize(void)
provide a static size function to be able to call the function not on an object
Definition lime_crypto_primitives.hpp:105
Base buffer definition for Key Exchange data structure.
Definition lime_crypto_primitives.hpp:56
static constexpr size_t ssize(void)
provide a static size function to be able to call the function not on an object
Definition lime_crypto_primitives.hpp:59
Group in this namespace all the functions related to building or parsing double ratchet packets.
Definition lime_double_ratchet_protocol.cpp:64
constexpr uint8_t DR_v01
Definition lime_double_ratchet_protocol.hpp:30
bool parseMessage_get_X3DHinit(const std::vector< uint8_t > &message, std::vector< uint8_t > &X3DH_initMessage) noexcept
check the message for presence of X3DH init in the header, extract it if there is one
Definition lime_double_ratchet_protocol.cpp:248
void parseMessage_X3DHinit(const std::vector< uint8_t >message, DSA< Curve, lime::DSAtype::publicKey > &Ik, X< Curve, lime::Xtype::publicKey > &Ek, uint32_t &SPk_id, uint32_t &OPk_id, bool &OPk_flag) noexcept
Parse the X3DH init message and extract peer Ik, peer Ek, self SPk id and seld OPk id if present This...
Definition lime_double_ratchet_protocol.cpp:166
DR_X3DH_OPk_flag
haveOPk byte from X3DH init message mapping
Definition lime_double_ratchet_protocol.hpp:56
@ withOPk
Definition lime_double_ratchet_protocol.hpp:58
@ withoutOPk
Definition lime_double_ratchet_protocol.hpp:57
constexpr size_t X3DHinitSize(bool haveOPk, typename std::enable_if_t<!std::is_base_of_v< genericKEM, Curve >, bool >=true) noexcept
return the size of the X3DH init packet included in the double ratchet packet header
Definition lime_double_ratchet_protocol.hpp:86
constexpr size_t headerSize(uint8_t messageType) noexcept
return the size of the double ratchet packet header
Definition lime_double_ratchet_protocol.hpp:69
DR_message_type
DR message type byte bit mapping.
Definition lime_double_ratchet_protocol.hpp:48
@ X3DH_init_flag
Definition lime_double_ratchet_protocol.hpp:49
@ KEM_pk_index
Definition lime_double_ratchet_protocol.hpp:51
@ payload_direct_encryption_flag
Definition lime_double_ratchet_protocol.hpp:50
void buildMessage_X3DHinit(std::vector< uint8_t > &message, const DSA< Curve, lime::DSAtype::publicKey > &Ik, const X< Curve, lime::Xtype::publicKey > &Ek, const uint32_t SPk_id, const uint32_t OPk_id, const bool OPk_flag) noexcept
build an X3DH init message to insert in DR header EC only version
Definition lime_double_ratchet_protocol.cpp:87
constexpr size_t DRPkIndexSize
Definition lime_defines.hpp:81
Definition lime_double_ratchet.hpp:46