ucommon  7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
  Fossies Dox: ucommon-7.0.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
ucommon::Cipher::Key Class Reference

Cipher key formed by hash algorithm. More...

#include <secure.h>

Public Member Functions

 Key ()
 
 Key (const char *cipher, const char *digest, const char *text, size_t size=0, const uint8_t *salt=NULL, unsigned rounds=1)
 
 Key (const char *cipher, const uint8_t *iv, size_t ivsize)
 
 Key (const char *cipher, secure::keybytes &iv)
 
 Key (const char *cipher, const char *digest)
 
 ~Key ()
 
void set (const uint8_t *key, size_t size)
 
secure::keybytes key ()
 
secure::keybytes iv ()
 
bool set (const secure::keybytes &key)
 
void set (const char *cipher, const char *digest)
 
void set (const char *cipher, const uint8_t *iv, size_t ivsize)
 
void assign (const char *key, size_t size, const uint8_t *salt, unsigned rounds)
 
bool set (const char *cipher, const secure::keybytes &iv)
 
void assign (const char *key, size_t size=0)
 
void clear (void)
 
secure::string b64 (void)
 
void b64 (const char *string)
 
size_t get (uint8_t *key, uint8_t *ivout=NULL)
 
size_t size (void) const
 
size_t iosize (void) const
 
 operator bool () const
 
bool operator! () const
 
Keyoperator= (const char *pass)
 
bool operator== (const Key &other) const
 
bool operator!= (const Key &other) const
 

Static Public Member Functions

static void options (const uint8_t *salt=NULL, unsigned rounds=1)
 

Protected Member Functions

 Key (const char *ciper)
 
void set (const char *cipher)
 

Protected Attributes

union {
   const void *   algotype
 
   int   algoid
 
}; 
 
union {
   const void *   hashtype
 
   int   hashid
 
}; 
 
int modeid
 
uint8_t keybuf [512/8]
 
uint8_t ivbuf [512/8]
 
size_t keysize
 
size_t blksize
 

Friends

class Cipher
 

Detailed Description

Cipher key formed by hash algorithm.

This can generate both a key and iv table based on the algorithms used and required. Normally it is used from a pass-phrase, though any block of data may be supplied.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 301 of file secure.h.

Constructor & Destructor Documentation

◆ Key() [1/6]

ucommon::Cipher::Key::Key ( const char *  ciper)
protected

Definition at line 423 of file common.cpp.

References algoid, algotype, cipher, hashid, hashtype, ucommon::secure::init(), and set().

Here is the call graph for this function:

◆ Key() [2/6]

ucommon::Cipher::Key::Key ( )

Definition at line 472 of file common.cpp.

References ucommon::clear(), and ucommon::secure::init().

Here is the call graph for this function:

◆ Key() [3/6]

ucommon::Cipher::Key::Key ( const char *  cipher,
const char *  digest,
const char *  text,
size_t  size = 0,
const uint8_t *  salt = NULL,
unsigned  rounds = 1 
)

Definition at line 461 of file common.cpp.

References cipher, digest(), ucommon::secure::init(), ucommon::Cipher::set(), and ucommon::Cipher::size().

Here is the call graph for this function:

◆ Key() [4/6]

ucommon::Cipher::Key::Key ( const char *  cipher,
const uint8_t *  iv,
size_t  ivsize 
)

Definition at line 433 of file common.cpp.

References cipher, ucommon::secure::init(), ucommon::Cipher::iv(), and ucommon::Cipher::set().

Here is the call graph for this function:

◆ Key() [5/6]

ucommon::Cipher::Key::Key ( const char *  cipher,
secure::keybytes iv 
)

Definition at line 443 of file common.cpp.

References cipher, ucommon::secure::init(), ucommon::Cipher::iv(), ucommon::Cipher::set(), and ucommon::TypeRef::size().

Here is the call graph for this function:

◆ Key() [6/6]

ucommon::Cipher::Key::Key ( const char *  cipher,
const char *  digest 
)

Definition at line 452 of file common.cpp.

References cipher, digest(), ucommon::secure::init(), and ucommon::Cipher::set().

Here is the call graph for this function:

◆ ~Key()

ucommon::Cipher::Key::~Key ( )

Definition at line 478 of file common.cpp.

References ucommon::clear().

Here is the call graph for this function:

Member Function Documentation

◆ assign() [1/2]

void ucommon::Cipher::Key::assign ( const char *  key,
size_t  size,
const uint8_t *  salt,
unsigned  rounds 
)

Definition at line 142 of file cipher.cpp.

References _rounds, _salt, algoid, blksize, clear(), hashid, ivbuf, keybuf, keysize, MAX_DIGEST_HASHSIZE, ucommon::Cipher::pos(), and temp.

Here is the call graph for this function:

◆ assign() [2/2]

void ucommon::Cipher::Key::assign ( const char *  key,
size_t  size = 0 
)

Definition at line 197 of file cipher.cpp.

References _rounds, _salt, and ucommon::Cipher::size().

Here is the call graph for this function:

◆ b64() [1/2]

void ucommon::Cipher::Key::b64 ( const char *  string)

Definition at line 494 of file common.cpp.

References ucommon::String::b64decode(), ucommon::clear(), and ucommon::Cipher::key().

Here is the call graph for this function:

◆ b64() [2/2]

secure::string ucommon::Cipher::Key::b64 ( void  )

Definition at line 563 of file common.cpp.

References ucommon::typeref< const char * >::b64().

Here is the call graph for this function:

◆ clear()

void ucommon::Cipher::Key::clear ( void  )

Definition at line 570 of file common.cpp.

References zerofill().

Referenced by assign(), and ucommon::Cipher::release().

Here is the call graph for this function:

◆ get()

size_t ucommon::Cipher::Key::get ( uint8_t *  key,
uint8_t *  ivout = NULL 
)

Definition at line 520 of file common.cpp.

References ucommon::Cipher::size().

Here is the call graph for this function:

◆ iosize()

size_t ucommon::Cipher::Key::iosize ( void  ) const
inline

◆ iv()

secure::keybytes ucommon::Cipher::Key::iv ( )
inline

Definition at line 347 of file secure.h.

Referenced by ucommon::Cipher::iv().

◆ key()

secure::keybytes ucommon::Cipher::Key::key ( )
inline

Definition at line 343 of file secure.h.

Referenced by ucommon::Cipher::key().

◆ operator bool()

ucommon::Cipher::Key::operator bool ( ) const
inline

Definition at line 379 of file secure.h.

◆ operator!()

bool ucommon::Cipher::Key::operator! ( ) const
inline

Definition at line 383 of file secure.h.

◆ operator!=()

bool ucommon::Cipher::Key::operator!= ( const Key other) const
inline

Definition at line 394 of file secure.h.

◆ operator=()

Key & ucommon::Cipher::Key::operator= ( const char *  pass)
inline

Definition at line 387 of file secure.h.

◆ operator==()

bool ucommon::Cipher::Key::operator== ( const Key other) const

Definition at line 483 of file common.cpp.

References keybuf, and keysize.

◆ options()

void ucommon::Cipher::Key::options ( const uint8_t *  salt = NULL,
unsigned  rounds = 1 
)
static

Definition at line 202 of file cipher.cpp.

References _rounds, and _salt.

◆ set() [1/6]

void ucommon::Cipher::Key::set ( const char *  cipher)
protected

Definition at line 215 of file cipher.cpp.

References cipher, ucommon::clear(), and ucommon::__context::map_cipher().

Referenced by Key().

Here is the call graph for this function:

◆ set() [2/6]

void ucommon::Cipher::Key::set ( const char *  cipher,
const char *  digest 
)

Definition at line 208 of file cipher.cpp.

References cipher, digest(), ucommon::__context::map_digest(), and ucommon::Cipher::set().

Here is the call graph for this function:

◆ set() [3/6]

bool ucommon::Cipher::Key::set ( const char *  cipher,
const secure::keybytes iv 
)

Definition at line 534 of file common.cpp.

References cipher, ucommon::Cipher::iv(), ucommon::Cipher::set(), and ucommon::TypeRef::size().

Here is the call graph for this function:

◆ set() [4/6]

void ucommon::Cipher::Key::set ( const char *  cipher,
const uint8_t *  iv,
size_t  ivsize 
)

Definition at line 508 of file common.cpp.

References cipher, ucommon::clear(), ucommon::Cipher::iv(), and ucommon::Cipher::set().

Here is the call graph for this function:

◆ set() [5/6]

bool ucommon::Cipher::Key::set ( const secure::keybytes key)

Definition at line 548 of file common.cpp.

References ucommon::Cipher::key(), ucommon::Cipher::set(), ucommon::Cipher::size(), and ucommon::TypeRef::size().

Here is the call graph for this function:

◆ set() [6/6]

void ucommon::Cipher::Key::set ( const uint8_t *  key,
size_t  size 
)

Definition at line 500 of file common.cpp.

References ucommon::Cipher::key(), and ucommon::Cipher::size().

Here is the call graph for this function:

◆ size()

size_t ucommon::Cipher::Key::size ( void  ) const
inline

Definition at line 371 of file secure.h.

Friends And Related Function Documentation

◆ Cipher

friend class Cipher
friend

Definition at line 304 of file secure.h.

Member Data Documentation

◆ 

union { ... } ucommon::Cipher::Key::@14

◆ 

union { ... } ucommon::Cipher::Key::@16

◆ algoid

int ucommon::Cipher::Key::algoid

Definition at line 308 of file secure.h.

Referenced by assign(), Key(), and ucommon::Cipher::set().

◆ algotype

const void* ucommon::Cipher::Key::algotype

Definition at line 307 of file secure.h.

Referenced by Key().

◆ blksize

size_t ucommon::Cipher::Key::blksize
protected

Definition at line 322 of file secure.h.

Referenced by assign(), and ucommon::Cipher::set().

◆ hashid

int ucommon::Cipher::Key::hashid

Definition at line 313 of file secure.h.

Referenced by assign(), and Key().

◆ hashtype

const void* ucommon::Cipher::Key::hashtype

Definition at line 312 of file secure.h.

Referenced by Key().

◆ ivbuf

uint8_t ucommon::Cipher::Key::ivbuf[512/8]
protected

Definition at line 319 of file secure.h.

Referenced by assign(), and ucommon::Cipher::set().

◆ keybuf

uint8_t ucommon::Cipher::Key::keybuf[512/8]
protected

Definition at line 319 of file secure.h.

Referenced by assign(), operator==(), and ucommon::Cipher::set().

◆ keysize

size_t ucommon::Cipher::Key::keysize
protected

Definition at line 322 of file secure.h.

Referenced by assign(), operator==(), and ucommon::Cipher::set().

◆ modeid

int ucommon::Cipher::Key::modeid
protected

Definition at line 316 of file secure.h.


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