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..
![]() ![]() |
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 |
Key & | operator= (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 |
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.
|
protected |
Definition at line 423 of file common.cpp.
References algoid, algotype, cipher, hashid, hashtype, ucommon::secure::init(), and set().
ucommon::Cipher::Key::Key | ( | ) |
Definition at line 472 of file common.cpp.
References ucommon::clear(), and ucommon::secure::init().
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().
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().
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().
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().
ucommon::Cipher::Key::~Key | ( | ) |
Definition at line 478 of file common.cpp.
References ucommon::clear().
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.
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().
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().
secure::string ucommon::Cipher::Key::b64 | ( | void | ) |
Definition at line 563 of file common.cpp.
References ucommon::typeref< const char * >::b64().
void ucommon::Cipher::Key::clear | ( | void | ) |
Definition at line 570 of file common.cpp.
References zerofill().
Referenced by assign(), and ucommon::Cipher::release().
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().
|
inline |
Definition at line 375 of file secure.h.
Referenced by ucommon::Cipher::align(), ucommon::Cipher::pad(), ucommon::Cipher::put(), and ucommon::Cipher::puts().
|
inline |
Definition at line 347 of file secure.h.
Referenced by ucommon::Cipher::iv().
|
inline |
Definition at line 343 of file secure.h.
Referenced by ucommon::Cipher::key().
|
inline |
|
inline |
bool ucommon::Cipher::Key::operator== | ( | const Key & | other | ) | const |
Definition at line 483 of file common.cpp.
|
static |
Definition at line 202 of file cipher.cpp.
|
protected |
Definition at line 215 of file cipher.cpp.
References cipher, ucommon::clear(), and ucommon::__context::map_cipher().
Referenced by Key().
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().
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().
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().
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().
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().
union { ... } ucommon::Cipher::Key::@14 |
union { ... } ucommon::Cipher::Key::@16 |
int ucommon::Cipher::Key::algoid |
Definition at line 308 of file secure.h.
Referenced by assign(), Key(), and ucommon::Cipher::set().
const void* ucommon::Cipher::Key::algotype |
|
protected |
Definition at line 322 of file secure.h.
Referenced by assign(), and ucommon::Cipher::set().
int ucommon::Cipher::Key::hashid |
const void* ucommon::Cipher::Key::hashtype |
|
protected |
Definition at line 319 of file secure.h.
Referenced by assign(), and ucommon::Cipher::set().
|
protected |
Definition at line 319 of file secure.h.
Referenced by assign(), operator==(), and ucommon::Cipher::set().
|
protected |
Definition at line 322 of file secure.h.
Referenced by assign(), operator==(), and ucommon::Cipher::set().