OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::EpochKey Class Reference

#include <data_epoch.hpp>

Public Member Functions

 EpochKey ()=default
 
 EpochKey (decltype(keydata) keydata, uint16_t epoch)
 
 EpochKey (StaticKey key)
 
void iterate ()
 
std::pair< StaticKey, StaticKeydata_key (openvpn::CryptoAlgs::Type cipher)
 
EpochDataChannelCryptoContext key_context (openvpn::SSLLib::Ctx libctx, openvpn::CryptoAlgs::Type cipher, int mode)
 

Public Attributes

std::array< uint8_t, SECRET_SIZEkeydata {}
 
std::uint16_t epoch = 0
 

Static Public Attributes

static constexpr int SECRET_SIZE = 32
 

Detailed Description

Definition at line 102 of file data_epoch.hpp.

Constructor & Destructor Documentation

◆ EpochKey() [1/3]

openvpn::EpochKey::EpochKey ( )
default

◆ EpochKey() [2/3]

openvpn::EpochKey::EpochKey ( decltype(keydata keydata,
uint16_t  epoch 
)
inline

Constructs an epoch key with the given key material and epoch

Definition at line 117 of file data_epoch.hpp.

◆ EpochKey() [3/3]

openvpn::EpochKey::EpochKey ( openvpn::StaticKey  key)

Constructs an epoch key with the given OpenVPNStaticKey as epoch 1 key.

Parameters
keyis assumed to be already prepared as the correct slice of the Data channel key using key.slice

Definition at line 155 of file data_epoch.cpp.

Member Function Documentation

◆ data_key()

std::pair< openvpn::StaticKey, openvpn::StaticKey > openvpn::EpochKey::data_key ( openvpn::CryptoAlgs::Type  cipher)

Derives the data channel keys that are tied to the current epoch.

Returns
Key material for the encryption/decryption key and the implicit IV material

Definition at line 118 of file data_epoch.cpp.

Here is the caller graph for this function:

◆ iterate()

void openvpn::EpochKey::iterate ( )

Iterates the epoch key to make it E_n+1, ie increase the epoch by one and derive the new key material accordingly

Definition at line 104 of file data_epoch.cpp.

◆ key_context()

openvpn::EpochDataChannelCryptoContext openvpn::EpochKey::key_context ( openvpn::SSLLib::Ctx  libctx,
openvpn::CryptoAlgs::Type  cipher,
int  mode 
)

Generate a context that can be used to encrypt or decrypt using this epoch

Definition at line 139 of file data_epoch.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ epoch

std::uint16_t openvpn::EpochKey::epoch = 0

Definition at line 109 of file data_epoch.hpp.

◆ keydata

std::array<uint8_t, SECRET_SIZE> openvpn::EpochKey::keydata {}

Definition at line 108 of file data_epoch.hpp.

◆ SECRET_SIZE

constexpr int openvpn::EpochKey::SECRET_SIZE = 32
staticconstexpr

Definition at line 106 of file data_epoch.hpp.


The documentation for this class was generated from the following files: