|
CryptoSys API
6.22.1
|
Authenticated encryption functions. More...
Public Types | |
| enum class | Alg |
| AEAD algorithm. More... | |
| enum | Opts : unsigned int |
| Advanced options. More... | |
Static Public Member Functions | |
| static crsysapi::bvec_t | DecryptWithTag (const bvec_t &data, const bvec_t &key, const bvec_t &iv, const bvec_t &aad, Alg alg, Opts opts=Opts::Default) |
| Decrypt data using specified AEAD algorithm in one-off operation with AAD and options. More... | |
| static crsysapi::bvec_t | EncryptWithTag (const bvec_t &data, const bvec_t &key, const bvec_t &iv, const bvec_t &aad, Alg alg, Opts opts=Opts::Default) |
| Encrypt data using specified AEAD algorithm in one-off operation with AAD and options. More... | |
Authenticated encryption functions.
|
strong |
AEAD algorithm.
| enum crsysapi::Aead::Opts : unsigned int |
|
static |
Decrypt data using specified AEAD algorithm in one-off operation with AAD and options.
The authentication tag is expected appended to the input.
| data | Input data to be encrypted |
| key | Key of exact length for algorithm (16 or 32 bytes) |
| iv | (optional) Initialization Vector (IV) (aka nonce) 16 bytes for ASCON else 12 bytes. Set as an empty vector bvec_t() if already prefixed to input. |
| aad | Additional authenticated data (optional) - set as an empty vector bvec_t() to ignore. |
| alg | Authenticated encryption algorithm. |
| opts | Advanced options. Use Opts::PrefixIV to expect the IV to be prepended to the input. |
| std::runtime_error | Exception with error code. |
Opts::PrefixIV option is used. In all cases the tag must be 16 bytes (128 bits). The IV must be 16 bytes (128 bits) for ASCON-128 otherwise exactly 12 bytes (96 bits). If additional authentication data (AAD) was provided during encryption then the exact same AAD data must be provided here.
|
static |
Encrypt data using specified AEAD algorithm in one-off operation with AAD and options.
The authentication tag is appended to the output.
| data | Input data to be encrypted |
| key | Key of exact length for algorithm (16 or 32 bytes) |
| iv | Initialization Vector (IV) (aka nonce) 16 bytes for ASCON else 12 bytes (required). |
| aad | Additional authenticated data (optional) - set as an empty vector bvec_t() to ignore. |
| alg | Authenticated encryption algorithm. |
| opts | Advanced options. Use Opts::PrefixIV to prepend the IV to the output. |
| std::runtime_error | Exception with error code. |
Opts::PrefixIV is used.