EPS Conduits  v0.0.2-2413
networking over networking
Cipher.hpp File Reference
#include "common.hpp"
#include "NetBuffer.hpp"
#include <openssl/evp.h>
Include dependency graph for Cipher.hpp:
This graph shows which files directly or indirectly include this file:

Namespaces

 EPS
 
 EPS::Cipher
 Cipher takes care of calling OpenSSL to encrypt and decrypt NetBuffer objects.
 

Macros

#define ENC_MODE_UNCHANGED   -1
 Definition needed when calling OpenSSL functions such as EVP_CipherInit_ex() More...
 
#define ENC_MODE_DECRYPT   0
 Definition needed when calling OpenSSL functions such as EVP_CipherInit_ex() More...
 
#define ENC_MODE_ENCRYPT   1
 Definition needed when calling OpenSSL functions such as EVP_CipherInit_ex() More...
 

Functions

void EPS::Cipher::reset (void)
 Reset OpenSSL. More...
 
void EPS::Cipher::initialize (EPS::StrMap &configuration)
 Initialize OpenSSL ciphers. More...
 
void EPS::Cipher::get_cipher_key_and_iv (EPS::StrMap &configuration)
 Get and parse the key and iv from configuration. More...
 
EPS::NetBufferEPS::Cipher::encrypt (EPS::NetBuffer &buffer)
 Encrypt a network buffer. Return a pointer to the newly-encrypted buffer. The original buffer remains untouched. More...
 
EPS::NetBufferEPS::Cipher::decrypt (EPS::NetBuffer &buffer)
 Decrypt a network buffer. Return a pointer to the newly-decrypted buffer. The original buffer remains untouched. More...
 
EPS::NetBufferEPS::Cipher::decrypt_header (EPS::NetBuffer &buffer)
 Decrypt only the first few bytes ("header") of a network buffer. Return a pointer to the newly-decrypted buffer. The original buffer remains untouched. More...
 

Variables

std::array< uint8_t, 32 > EPS::Cipher::key
 OpenSSL: 256-bit encryption/decryption key. More...
 
std::array< uint8_t, 16 > EPS::Cipher::iv
 OpenSSL: 128-bit encryption/decryption iv. More...
 
const EVP_CIPHER * EPS::Cipher::cipher = nullptr
 OpenSSL: cipher to use for encryption/decryption. More...
 
EVP_CIPHER_CTX * EPS::Cipher::decrypt_ctx = nullptr
 OpenSSL: ctx needed for decryption. More...
 
EVP_CIPHER_CTX * EPS::Cipher::encrypt_ctx = nullptr
 OpenSSL: ctx needed for encryption. More...
 
size_t EPS::Cipher::size_of_keys_in_bytes = 0
 OpenSSL: size of the cipher key. More...
 
size_t EPS::Cipher::size_of_iv_in_bytes = 0
 OpenSSL: size of the cipher initialization vector. More...
 
std::string EPS::Cipher::name = "<invalid>"
 OpenSSL: text name of the cipher in use. More...
 
std::string EPS::Cipher::hash = "<invalid>"
 nonsense text string to help validate encryption key and iv More...
 

Macro Definition Documentation

◆ ENC_MODE_DECRYPT

#define ENC_MODE_DECRYPT   0

Definition needed when calling OpenSSL functions such as EVP_CipherInit_ex()

◆ ENC_MODE_ENCRYPT

#define ENC_MODE_ENCRYPT   1

Definition needed when calling OpenSSL functions such as EVP_CipherInit_ex()

◆ ENC_MODE_UNCHANGED

#define ENC_MODE_UNCHANGED   -1

Definition needed when calling OpenSSL functions such as EVP_CipherInit_ex()