1#ifndef SOURCEMETA_CORE_CRYPTO_AES_CBC_HMAC_H_
2#define SOURCEMETA_CORE_CRYPTO_AES_CBC_HMAC_H_
4#ifndef SOURCEMETA_CORE_CRYPTO_EXPORT
5#include <sourcemeta/core/crypto_export.h>
13namespace sourcemeta::core {
26 [[nodiscard]]
auto ciphertext() const -> std::string_view {
27 assert(this->data.size() >= this->tag_length);
28 return std::string_view{this->data}.substr(0, this->data.size() -
33 [[nodiscard]]
auto tag() const -> std::string_view {
34 assert(this->data.size() >= this->tag_length);
35 return std::string_view{this->data}.substr(this->data.size() -
58 const std::string_view key,
const std::string_view iv,
59 const std::string_view associated_data,
const std::string_view plaintext)
60 -> std::optional<AESCBCHMACCiphertext>;
81 const std::string_view key,
const std::string_view iv,
82 const std::string_view associated_data,
const std::string_view ciphertext,
83 const std::string_view tag) -> std::optional<std::string>;
std::string::size_type tag_length
The length in bytes of the trailing authentication tag.
Definition crypto_aes_cbc_hmac.h:23
auto ciphertext() const -> std::string_view
The ciphertext, a whole number of 16-byte blocks.
Definition crypto_aes_cbc_hmac.h:26
auto tag() const -> std::string_view
The authentication tag.
Definition crypto_aes_cbc_hmac.h:33
std::string data
The ciphertext followed by its authentication tag.
Definition crypto_aes_cbc_hmac.h:20
auto SOURCEMETA_CORE_CRYPTO_EXPORT aes_cbc_hmac_encrypt(const std::string_view key, const std::string_view iv, const std::string_view associated_data, const std::string_view plaintext) -> std::optional< AESCBCHMACCiphertext >
auto SOURCEMETA_CORE_CRYPTO_EXPORT aes_cbc_hmac_decrypt(const std::string_view key, const std::string_view iv, const std::string_view associated_data, const std::string_view ciphertext, const std::string_view tag) -> std::optional< std::string >
Definition crypto_aes_cbc_hmac.h:18