MADARA  3.4.1
madara::filters::AESBufferFilter Class Reference

Encrypts a buffer with 256 bit AES via OpenSSL. More...

#include <AESBufferFilter.h>

Inheritance diagram for madara::filters::AESBufferFilter:
madara::filters::BufferFilter

Public Member Functions

 AESBufferFilter ()
 Constructor. More...
 
 AESBufferFilter (const AESBufferFilter &input)
 Copy constructor. More...
 
 AESBufferFilter (unsigned char *key, int key_length)
 256 bit key constructor More...
 
virtual ~AESBufferFilter ()
 Destructor. More...
 
virtual int decode (char *source, int size, int max_size) const
 Decodes the buffer in place using AES encryption. More...
 
virtual int encode (char *source, int size, int max_size) const
 Encodes the buffer in place using AES encryption. More...
 
int generate_key (const std::string &password)
 Generates a 256 bit key from a password. More...
 
virtual std::string get_id (void)
 Gets the id of the filter. More...
 
virtual uint32_t get_version (void)
 Gets the version of the filter. More...
 

Private Attributes

utility::ScopedArray< unsigned char > iv_
 initialization vector More...
 
utility::ScopedArray< unsigned char > key_
 the user's cypher key More...
 

Detailed Description

Encrypts a buffer with 256 bit AES via OpenSSL.

Definition at line 29 of file AESBufferFilter.h.

Constructor & Destructor Documentation

◆ AESBufferFilter() [1/3]

madara::filters::AESBufferFilter::AESBufferFilter ( )

Constructor.

Definition at line 14 of file AESBufferFilter.cpp.

◆ AESBufferFilter() [2/3]

madara::filters::AESBufferFilter::AESBufferFilter ( const AESBufferFilter input)

Copy constructor.

Parameters
inputthe buffer filter to copy

Definition at line 21 of file AESBufferFilter.cpp.

◆ AESBufferFilter() [3/3]

madara::filters::AESBufferFilter::AESBufferFilter ( unsigned char *  key,
int  key_length 
)

256 bit key constructor

Parameters
keythe key to use for encryption
key_lengththe length of the key

Definition at line 28 of file AESBufferFilter.cpp.

◆ ~AESBufferFilter()

madara::filters::AESBufferFilter::~AESBufferFilter ( )
virtual

Destructor.

Definition at line 36 of file AESBufferFilter.cpp.

Member Function Documentation

◆ decode()

int madara::filters::AESBufferFilter::decode ( char *  source,
int  size,
int  max_size 
) const
virtual

Decodes the buffer in place using AES encryption.

Parameters
sourcethe source and destination buffer
sizethe amount of data in the buffer in bytes
max_sizethe amount of bytes the buffer can hold
Returns
the new size after decoding

decryption context

Implements madara::filters::BufferFilter.

Definition at line 134 of file AESBufferFilter.cpp.

◆ encode()

int madara::filters::AESBufferFilter::encode ( char *  source,
int  size,
int  max_size 
) const
virtual

Encodes the buffer in place using AES encryption.

Parameters
sourcethe source and destination buffer
sizethe amount of data in the buffer in bytes
max_sizethe amount of bytes the buffer can hold
Returns
the new size after encoding

encryption context

Implements madara::filters::BufferFilter.

Definition at line 60 of file AESBufferFilter.cpp.

◆ generate_key()

int madara::filters::AESBufferFilter::generate_key ( const std::string &  password)

Generates a 256 bit key from a password.

Parameters
passworda password to seed the key with
Returns
0 on success, -1 on error

Definition at line 38 of file AESBufferFilter.cpp.

◆ get_id()

std::string madara::filters::AESBufferFilter::get_id ( void  )
virtual

Gets the id of the filter.

This is used in the serialization process for transports and checkpoints to identify which filter is used.

Implements madara::filters::BufferFilter.

Definition at line 207 of file AESBufferFilter.cpp.

◆ get_version()

uint32_t madara::filters::AESBufferFilter::get_version ( void  )
virtual

Gets the version of the filter.

See also
madara::utility::get_uint_version for one way to get this from a string version

Implements madara::filters::BufferFilter.

Definition at line 216 of file AESBufferFilter.cpp.

Member Data Documentation

◆ iv_

utility::ScopedArray<unsigned char> madara::filters::AESBufferFilter::iv_
private

initialization vector

Definition at line 97 of file AESBufferFilter.h.

◆ key_

utility::ScopedArray<unsigned char> madara::filters::AESBufferFilter::key_
private

the user's cypher key

Definition at line 94 of file AESBufferFilter.h.


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