CppCMS
Public Types | Public Member Functions | Static Public Member Functions | List of all members
cppcms::crypto::cbc Class Referenceabstract

Cipher-block chaining encryption and decryption cryptographic service. More...

#include <cppcms/crypto.h>

Inheritance diagram for cppcms::crypto::cbc:
booster::noncopyable

Public Types

enum  cbc_type { aes128 = 0, aes192 = 1, aes256 = 2 }
 

Public Member Functions

virtual unsigned block_size () const =0
 
virtual unsigned key_size () const =0
 
virtual void set_key (key const &)=0
 
virtual void set_iv (void const *ptr, size_t size)=0
 
virtual void set_nonce_iv ()=0
 
virtual void encrypt (void const *in, void *out, unsigned len)=0
 
virtual void decrypt (void const *in, void *out, unsigned len)=0
 

Static Public Member Functions

static std::auto_ptr< cbccreate (cbc_type type)
 
static std::auto_ptr< cbccreate (std::string const &name)
 

Detailed Description

Cipher-block chaining encryption and decryption cryptographic service.

Note
In order to use it, you must compile CppCMS with OpenSSL (libcrypto) or GNU-TLS (libgcrypt) library.

Member Enumeration Documentation

CBC encryption type

Enumerator
aes128 

AES-128.

aes192 

AES-192.

aes256 

AES-256.

Member Function Documentation

virtual unsigned cppcms::crypto::cbc::block_size ( ) const
pure virtual

Get the size of the block CBC works on

static std::auto_ptr<cbc> cppcms::crypto::cbc::create ( cbc_type  type)
static

Create a new cbc object that performs encryption using type method.

If the encryption method is not supported returns an empty pointer!

static std::auto_ptr<cbc> cppcms::crypto::cbc::create ( std::string const &  name)
static

Create a new cbc object that performs encryption using algorithm name

If the encryption method is not supported returns an empty pointer!

Currently supported aes128, aes192, aes256, with names "aes" = "aes-128" = "aes128" , "aes-192" "aes192", "aes-256" = "aes256". They require CppCMS to be compiled with OpenSSL or GNU-TLS library

virtual void cppcms::crypto::cbc::decrypt ( void const *  in,
void *  out,
unsigned  len 
)
pure virtual

Decrypt the data in to out of size len. len should be multiple of block_size()

virtual void cppcms::crypto::cbc::encrypt ( void const *  in,
void *  out,
unsigned  len 
)
pure virtual

Encrypt the data in to out of size len. len should be multiple of block_size()

virtual unsigned cppcms::crypto::cbc::key_size ( ) const
pure virtual

Get the required key size in bytes

virtual void cppcms::crypto::cbc::set_iv ( void const *  ptr,
size_t  size 
)
pure virtual

Set initial vector value, size should be equal to block_size()

virtual void cppcms::crypto::cbc::set_key ( key const &  )
pure virtual

Set the key value

virtual void cppcms::crypto::cbc::set_nonce_iv ( )
pure virtual

Set randomly created initial vector value


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