Stream cipher functions.
More...
|
static crsysapi::bvec_t | Bytes (const bvec_t &data, const bvec_t &key, const bvec_t &iv, Alg alg, int counter=0) |
| Enciphers data in array of bytes using specified stream cipher. More...
|
|
static int | File (const std::string &fileOut, const std::string &fileIn, const bvec_t &key, const bvec_t &iv, Alg alg, int counter=0) |
| Enciphers data in a file using specified stream cipher. More...
|
|
◆ Alg
Stream cipher algorithm.
Enumerator |
---|
Arcfour | ARCFOUR (RC4) algorithm
|
Salsa20 | Salsa20 algorithm
|
Chacha20 | Chacha20 algorithm
|
◆ Bytes()
Enciphers data in array of bytes using specified stream cipher.
- Parameters
-
data | Input data to be encrypted |
key | Key (length restrictions apply, see Remarks) |
iv | Initialization Vector (IV, nonce) or an empty vector bvec_t() for Arcfour |
alg | Stream cipher algorithm |
counter | Counter value for ChaCha20 only, otherwise ignored. |
- Returns
- Ciphertext in byte array, or empty array on error.
- Exceptions
-
std::runtime_error | Exception with error code. |
◆ File()
static int crsysapi::CipherStream::File |
( |
const std::string & |
fileOut, |
|
|
const std::string & |
fileIn, |
|
|
const bvec_t & |
key, |
|
|
const bvec_t & |
iv, |
|
|
Alg |
alg, |
|
|
int |
counter = 0 |
|
) |
| |
|
static |
Enciphers data in a file using specified stream cipher.
- Parameters
-
fileOut | Name of output file to be created or overwritten |
fileIn | Name of input file |
key | Key (length restrictions apply, see Remarks) |
iv | Initialization Vector (IV, nonce) or an empty vector bvec_t() for Arcfour |
alg | Stream cipher algorithm |
counter | Counter value for ChaCha20 only, otherwise ignored. |
- Returns
- 0 if successful or nonzero error code.
- Exceptions
-
std::runtime_error | Exception with error code. |