Cipher.
More...
#include <cipher.h>
|
static std::string | GenerateSalt () |
| Generate the unique secret salt.
|
|
Cipher.
Cipher allows to perform symmetric encode & decode data using a provided secret key and optional salt.
https://en.wikipedia.org/wiki/Symmetric-key_algorithm
Thread-safe.
- Examples
- cipher_decrypt.cpp, and cipher_encrypt.cpp.
Definition at line 43 of file cipher.h.
◆ Cipher() [1/5]
Initialize cipher with required algorithm.
- Parameters
-
Definition at line 17 of file cipher.cpp.
◆ Cipher() [2/5]
Initialize cipher with the given secret key and required algorithm.
- Parameters
-
Definition at line 58 of file cipher.h.
◆ Cipher() [3/5]
Initialize cipher with the given secret key, unique salt and required algorithm.
- Parameters
-
secret | - Secret key |
salt | - Unique secret salt |
algorithm | - Cipher algorithm (default is CipherAlgorithm::AES256) |
iterations | - Count key hashing iterations (default is 1000) |
Definition at line 66 of file cipher.h.
◆ Cipher() [4/5]
CppSecurity::Cipher::Cipher |
( |
const Cipher & |
| ) |
|
|
delete |
◆ Cipher() [5/5]
CppSecurity::Cipher::Cipher |
( |
Cipher && |
| ) |
|
|
default |
◆ ~Cipher()
CppSecurity::Cipher::~Cipher |
( |
| ) |
|
|
default |
◆ algorithm()
Get the cipher algorithm.
Definition at line 75 of file cipher.h.
◆ Decrypt()
std::string CppSecurity::Cipher::Decrypt |
( |
std::string_view |
str | ) |
|
◆ Encrypt()
std::string CppSecurity::Cipher::Encrypt |
( |
std::string_view |
str | ) |
|
◆ GenerateSalt()
std::string CppSecurity::Cipher::GenerateSalt |
( |
| ) |
|
|
static |
Generate the unique secret salt.
- Returns
- Unique secret salt
Definition at line 79 of file cipher.cpp.
◆ Initialize() [1/2]
void CppSecurity::Cipher::Initialize |
( |
std::string_view |
secret | ) |
|
◆ Initialize() [2/2]
void CppSecurity::Cipher::Initialize |
( |
std::string_view |
secret, |
|
|
std::string_view |
salt |
|
) |
| |
Initialize the cipher with the given secret key and unique salt.
- Parameters
-
secret | - Secret key |
salt | - Unique secret salt |
Definition at line 94 of file cipher.cpp.
◆ iterations()
size_t CppSecurity::Cipher::iterations |
( |
| ) |
const |
|
inlinenoexcept |
◆ name()
const std::string & CppSecurity::Cipher::name |
( |
| ) |
const |
|
inlinenoexcept |
◆ operator=() [1/2]
◆ operator=() [2/2]
The documentation for this class was generated from the following files: