|
libkeepass 0.2.0
KeePass key database importer/exporter library
|
#include <random.hh>
Public Types | |
| enum class | Type { kSalsa20 , kChaCha20 } |
Public Member Functions | |
| RandomObfuscator (const std::array< uint8_t, 32 > &key, const std::array< uint8_t, 8 > &init_vec) | |
| Constructs a random stream cipher from a raw key and initialization vector. | |
| RandomObfuscator (Type type, const std::array< uint8_t, 32 > &stream_key) | |
| RandomObfuscator (Type type, const std::vector< uint8_t > &stream_key) | |
| ~RandomObfuscator () | |
| Wipes the buffered keystream and destroys the underlying ciphers. | |
| std::vector< uint8_t > | Process (const std::vector< uint8_t > &data) |
| Obfuscates or deobfuscates a byte vector using the random stream. | |
| std::string | Process (const std::string &data) |
| Obfuscates or deobfuscates a string using the random stream. | |
| secure_string | Process (const secure_string &data) |
| Obfuscates or deobfuscates a sensitive string using the random stream. | |
Obfuscates binary data by xorring each byte with psuedo random data generated by a Salsa20 or ChaCha20 stream cipher.
| keepass::RandomObfuscator::RandomObfuscator | ( | const std::array< uint8_t, 32 > & | key, |
| const std::array< uint8_t, 8 > & | init_vec | ||
| ) |
Constructs a random stream cipher from a raw key and initialization vector.
| key | The 32-byte key for the stream cipher. |
| init_vec | The 8-byte initialization vector. |
| keepass::RandomObfuscator::RandomObfuscator | ( | Type | type, |
| const std::array< uint8_t, 32 > & | stream_key | ||
| ) |
Constructs a random stream cipher from the raw inner random stream key using the key transformation rule of the KDBX 4 format. For Salsa20 the key is hashed with SHA-256 and used with a fixed IV. For ChaCha20 the key is hashed with SHA-512 and split into a 32 byte key and 12 byte IV.
| keepass::RandomObfuscator::RandomObfuscator | ( | Type | type, |
| const std::vector< uint8_t > & | stream_key | ||
| ) |
Constructs a random stream cipher from the raw inner random stream key of KDBX 4, which may be 32 or 64 bytes depending on the writer.
| secure_string keepass::RandomObfuscator::Process | ( | const secure_string & | data | ) |
Obfuscates or deobfuscates a sensitive string using the random stream.
| data | The sensitive string data to process. |
| std::string keepass::RandomObfuscator::Process | ( | const std::string & | data | ) |
Obfuscates or deobfuscates a string using the random stream.
| data | The string data to process. |
Obfuscates or deobfuscates a byte vector using the random stream.
| data | The data to process (xor with the random stream). |