Fawkes API
Fawkes Development Version
|
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... | |
protobuf_comm::BufferEncryptor::BufferEncryptor | ( | const std::string & | key, |
std::string | cipher_name = "AES-128-ECB" |
||
) |
Constructor.
key | encryption key, can be any string, will be processed to meet the cipher's requirements. |
cipher_name | Cipher combination to use, currently supported are aes-128-ecb, aes-128-cbc, aes-256-ecb, and aes-256-cbc |
Definition at line 64 of file crypto.cpp.
protobuf_comm::BufferEncryptor::~BufferEncryptor | ( | ) |
Destructor.
Definition at line 86 of file crypto.cpp.
|
inline |
Get cipher ID.
Definition at line 61 of file crypto.h.
References encrypted_buffer_size().
Referenced by protobuf_comm::ProtobufBroadcastPeer::send().
void protobuf_comm::BufferEncryptor::encrypt | ( | const std::string & | plain, |
std::string & | enc | ||
) |
Encrypt a buffer.
Uses the cipher set in the constructor.
plain | plain text data |
enc | upon return contains encrypted buffer |
Definition at line 98 of file crypto.cpp.
Referenced by protobuf_comm::ProtobufBroadcastPeer::send().
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.
plain_length | length of the plain text buffer to encrypt |
Definition at line 154 of file crypto.cpp.
Referenced by cipher_id(), and protobuf_comm::ProtobufBroadcastPeer::send().