20 #ifndef lime_double_ratchet_protocol_hpp 21 #define lime_double_ratchet_protocol_hpp 26 namespace double_ratchet_protocol {
34 template <
typename Curve>
46 template <
typename Curve>
52 template <
typename Curve>
54 template <
typename Curve>
57 template <
typename Curve>
60 template <
typename Curve>
67 template <
typename Curve>
74 bool m_payload_direct_encryption;
78 uint16_t
Ns(
void)
const {
return m_Ns;}
80 uint16_t
PN(
void)
const {
return m_PN;}
84 bool valid(
void)
const {
return m_valid;}
88 size_t size(
void) {
return m_size;}
92 DRHeader(
const std::vector<uint8_t> header);
97 #ifdef EC25519_ENABLED 100 extern template bool parseMessage_get_X3DHinit<C255>(
const std::vector<uint8_t> &message, std::vector<uint8_t> &X3DH_initMessage) noexcept;
108 extern template bool parseMessage_get_X3DHinit<C448>(
const std::vector<uint8_t> &message, std::vector<uint8_t> &X3DH_initMessage) noexcept;
144 #endif // lime_double_ratchet_protocol_hpp 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
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
Definition: lime_double_ratchet_protocol.cpp:85
DR_message_type
DR message type byte bit mapping.
Definition: lime_double_ratchet_protocol.hpp:130
constexpr size_t headerSize() noexcept
return the size of the double ratchet packet header
Definition: lime_double_ratchet_protocol.hpp:35
constexpr std::uint8_t DR_v01
Definition: lime_double_ratchet_protocol.hpp:114
void buildMessage_header(std::vector< uint8_t > &header, const uint16_t Ns, const uint16_t PN, const X< Curve, lime::Xtype::publicKey > &DHs, const std::vector< uint8_t > X3DH_initMessage, const bool payloadDirectEncryption) noexcept
Build a header string from needed info.
Definition: lime_double_ratchet_protocol.cpp:213
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:100
constexpr size_t X3DHinitSize(bool haveOPk) noexcept
return the size of the X3DH init packet included in the double ratchet packet header ...
Definition: lime_double_ratchet_protocol.hpp:47
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...
Definition: lime_double_ratchet_protocol.cpp:124
DR_X3DH_OPk_flag
haveOPk byte from X3DH init message mapping
Definition: lime_double_ratchet_protocol.hpp:137
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:157