CppCMS
Public Member Functions | List of all members
cppcms::crypto::key Class Reference

Key object, holds the string that represents the binary key. More...

#include <cppcms/crypto.h>

Public Member Functions

 key ()
 
 key (key const &other)
 
key const & operator= (key const &)
 
 ~key ()
 
 key (void const *data, size_t length)
 
 key (char const *s)
 
 key (std::string const &)
 
char const * data () const
 
size_t size () const
 
void reset ()
 
void set (void const *ptr, size_t len)
 
void set_hex (char const *ptr, size_t len)
 
void read_from_file (std::string const &file_name)
 

Detailed Description

Key object, holds the string that represents the binary key.

When the key is destroyed it zeros all the memory it uses to prevent accidental leaks of the highly confidential data

Constructor & Destructor Documentation

cppcms::crypto::key::key ( )

Create an empty key on 0 length

cppcms::crypto::key::key ( key const &  other)

Copy the key

cppcms::crypto::key::~key ( )

Destroy they key object clearing the area used by it.

cppcms::crypto::key::key ( void const *  data,
size_t  length 
)

Create a key using binary representation pointed by data of length bytes

cppcms::crypto::key::key ( char const *  s)
explicit

Create a key using the hexadecimal representation

cppcms::crypto::key::key ( std::string const &  )
explicit

Create a key using the hexadecimal representation

Member Function Documentation

char const* cppcms::crypto::key::data ( ) const

Get the pointer to data, never returns NULL even if size() == 0

key const& cppcms::crypto::key::operator= ( key const &  )

Assign the key

void cppcms::crypto::key::read_from_file ( std::string const &  file_name)

Read the key from file. Under windows file_name should be UTF-8 encoded string.

void cppcms::crypto::key::reset ( )

Clear the key - and clear the area it was stored it

void cppcms::crypto::key::set ( void const *  ptr,
size_t  len 
)

Set the binary value for the key

void cppcms::crypto::key::set_hex ( char const *  ptr,
size_t  len 
)

Set the value for the key using hexadecimal representation

size_t cppcms::crypto::key::size ( ) const

Get the size of the key


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