UCommon
ucommon::Cipher::Key Class Reference

Cipher key formed by hash algorithm. More...

#include <secure.h>

Public Member Functions

void assign (const char *key, size_t size, const uint8_t *salt, unsigned rounds)
 
void assign (const char *key, size_t size=0)
 
void b64 (const char *string)
 
secure::string b64 (void)
 
void clear (void)
 
size_t get (uint8_t *key, uint8_t *ivout=NULL)
 
size_t iosize (void) const
 
secure::keybytes iv ()
 
 Key (const char *cipher, const char *digest)
 
 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)
 
secure::keybytes key ()
 
 operator bool () const
 
bool operator! () const
 
bool operator!= (const Key &other) const
 
Keyoperator= (const char *pass)
 
bool operator== (const Key &other) const
 
void set (const char *cipher, const char *digest)
 
bool set (const char *cipher, const secure::keybytes &iv)
 
void set (const char *cipher, const uint8_t *iv, size_t ivsize)
 
bool set (const secure::keybytes &key)
 
void set (const uint8_t *key, size_t size)
 
size_t size (void) 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 { 
 
   int   algoid 
 
   const void *   algotype 
 
};  
 
union { 
 
   int   hashid 
 
   const void *   hashtype 
 
};  
 
size_t blksize
 
uint8_t ivbuf [512/8]
 
uint8_t keybuf [512/8]
 
size_t keysize
 
int modeid
 

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
Examples
cipher.cpp.

Definition at line 301 of file secure.h.

Member Function Documentation

◆ iosize()

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

Definition at line 375 of file secure.h.

◆ iv()

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

Definition at line 347 of file secure.h.

◆ key()

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

Definition at line 343 of file secure.h.

◆ 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.

◆ size()

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

Definition at line 371 of file secure.h.

Friends And Related Symbol Documentation

◆ Cipher

friend class Cipher
friend

Definition at line 304 of file secure.h.

Field Documentation

◆ algoid

int ucommon::Cipher::Key::algoid

Definition at line 308 of file secure.h.

◆ algotype

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

Definition at line 307 of file secure.h.

◆ blksize

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

Definition at line 322 of file secure.h.

◆ hashid

int ucommon::Cipher::Key::hashid

Definition at line 313 of file secure.h.

◆ hashtype

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

Definition at line 312 of file secure.h.

◆ ivbuf

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

Definition at line 319 of file secure.h.

◆ keybuf

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

Definition at line 319 of file secure.h.

◆ keysize

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

Definition at line 322 of file secure.h.

◆ 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 file: