Fawkes API  Fawkes Development Version
protobuf_comm::BufferEncryptor Class Reference

Encrypt buffers using AES128 in ECB mode. More...

#include <>>

Public Member Functions

 BufferEncryptor (const std::string &key, std::string cipher_name="AES-128-ECB")
 Constructor. More...
 
 ~BufferEncryptor ()
 Destructor. More...
 
void encrypt (const std::string &plain, std::string &enc)
 Encrypt a buffer. More...
 
int cipher_id () const
 Get cipher ID. More...
 
size_t encrypted_buffer_size (size_t plain_length)
 Get required size for an encrypted buffer of the given plain text length. More...
 

Detailed Description

Encrypt buffers using AES128 in ECB mode.

Author
Tim Niemueller

Definition at line 49 of file crypto.h.

Constructor & Destructor Documentation

◆ BufferEncryptor()

protobuf_comm::BufferEncryptor::BufferEncryptor ( const std::string &  key,
std::string  cipher_name = "AES-128-ECB" 
)

Constructor.

Parameters
keyencryption key, can be any string, will be processed to meet the cipher's requirements.
cipher_nameCipher combination to use, currently supported are aes-128-ecb, aes-128-cbc, aes-256-ecb, and aes-256-cbc

Definition at line 62 of file crypto.cpp.

◆ ~BufferEncryptor()

protobuf_comm::BufferEncryptor::~BufferEncryptor ( )

Destructor.

Definition at line 86 of file crypto.cpp.

Member Function Documentation

◆ cipher_id()

int protobuf_comm::BufferEncryptor::cipher_id ( ) const
inline

Get cipher ID.

Returns
cipher ID

Definition at line 60 of file crypto.h.

◆ encrypt()

void protobuf_comm::BufferEncryptor::encrypt ( const std::string &  plain,
std::string &  enc 
)

Encrypt a buffer.

Uses the cipher set in the constructor.

Parameters
plainplain text data
encupon return contains encrypted buffer

Definition at line 97 of file crypto.cpp.

◆ encrypted_buffer_size()

size_t protobuf_comm::BufferEncryptor::encrypted_buffer_size ( size_t  plain_length)

Get required size for an encrypted buffer of the given plain text length.

Parameters
plain_lengthlength of the plain text buffer to encrypt
Returns
length of encrypted buffer required

Definition at line 148 of file crypto.cpp.


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