|
| template<typename Curve > |
| static void | KDF_RK (DRChainKey &RK, DRChainKey &CK, const X< Curve, lime::Xtype::sharedSecret > &dhOut) noexcept |
| | Key Derivation Function used in Root key/Diffie-Hellman Ratchet chain. More...
|
| |
| template<typename Curve > |
| static void | KEM_KDF_RK (DRChainKey &RK, DRChainKey &CK, const X< typename Curve::EC, lime::Xtype::sharedSecret > &dhOut, const K< typename Curve::KEM, lime::Ktype::sharedSecret > &kemOut, const X< typename Curve::EC, lime::Xtype::publicKey > &ECPkSender, const X< typename Curve::EC, lime::Xtype::publicKey > &ECPkReceiver, const K< typename Curve::KEM, lime::Ktype::publicKey > &KEMPk, const K< typename Curve::KEM, lime::Ktype::cipherText > &KEMCt) noexcept |
| | Key Derivation Function used in Root key/Diffie-Hellman/KEM Ratchet chain. More...
|
| |
| template<typename Curve > |
| static void | KDF_CK (DRChainKey &CK, DRMKey &MK, uint16_t chainIndex, typename std::enable_if_t<!std::is_base_of_v< genericKEM, Curve >, bool >=true) noexcept |
| | Key Derivation Function used in Symmetric key ratchet chain. More...
|
| |
| template<typename Curve > |
| static void | KDF_CK (DRChainKey &CK, DRMKey &MK, uint16_t chainIndex, typename std::enable_if_t< std::is_base_of_v< genericKEM, Curve >, bool >=true) noexcept |
| |
| static bool | decrypt (const lime::DRMKey &MK, const std::vector< uint8_t > &ciphertext, const size_t headerSize, std::vector< uint8_t > &AD, std::vector< uint8_t > &plaintext) |
| | Decrypt as described is spec section 3.1. More...
|
| |
Status on peer's public key in the DR session, as stored in DB in a 4 bytes integer mapping: byte 3 | byte 2 | byte 1 | byte 0 <Total number of message sent/received - or skipped -since last KEM ratchet> Flags as detailed below The total number of message should never increase more than maxKEMRatchetChainSize the peer in position of performing a KEM ratchet is encrypting message or maxSendingChain if he is not.
Flags bitmap : – 0 force KEM ratchet ASAP (set when a session is created on receiver side to force KEM ratchet at first response) – 1 KEM peer pk available locally – 2 KEM self pk known by peer – 3 EC peer pk available locally
template<typename Curve >
| static void lime::anonymous_namespace{lime_double_ratchet.cpp}::KDF_CK |
( |
DRChainKey & |
CK, |
|
|
DRMKey & |
MK, |
|
|
uint16_t |
chainIndex, |
|
|
typename std::enable_if_t<!std::is_base_of_v< genericKEM, Curve >, bool > |
= true |
|
) |
| |
|
staticnoexcept |
Key Derivation Function used in Symmetric key ratchet chain.
Implemented according to Double Ratchet spec section 5.2 using HMAC-SHA512
1 MK = HMAC-SHA512(CK, hkdf_mk_info) // get 48 bytes of it: first 32 to be key and last 16 to be IV
2 CK = HMAC-SHA512(CK, hkdf_ck_info)
3 hkdf_ck_info and hkdf_mk_info being a distincts constants (0x02 and 0x01 as suggested in double ratchet - section 5.2)
The EC/KEM version includes a modification from https://eprint.iacr.org/2024/220.pdf section 4.2: use the chain index in the derivation append the derivation index to hkdf_mk_info and hkdf_ck_info
- Parameters
-
| [in,out] | CK | Input/output buffer used as key to compute MK and then next CK |
| [out] | MK | Message Key(32 bytes) and IV(16 bytes) computed from HMAC_SHA512 keyed with CK |