45#include <StormByte/expected.hxx>
46#include <StormByte/safe/binary.hxx>
47#include <StormByte/safe/secure_binary.hxx>
76 inline constexpr std::size_t
TagSize = 16;
77 inline constexpr std::uint64_t
MaxMessageSize = (std::uint64_t{1} << 36) - 32;
78 inline constexpr std::uint64_t
MaxAADSize = (std::uint64_t{1} << 61) - 1;
113 std::span<const std::byte> nonce,
114 std::span<const std::byte> plaintext,
115 std::span<const std::byte> aad = {}
135 std::span<const std::byte> nonce,
136 std::span<const std::byte> ciphertext,
137 std::span<const std::byte> tag,
138 std::span<const std::byte> aad = {}
Shared, wiped container for passwords and raw key material.
Definition password.hxx:108
STORMBYTE_DECLARE_MAYBE_SAFE(class StormByte::System::Device::Access)
ExpectedPlaintext Open(Algorithm algorithm, const Secure::Password &key, std::span< const std::byte > nonce, std::span< const std::byte > ciphertext, std::span< const std::byte > tag, std::span< const std::byte > aad={})
Authenticate the entire ciphertext before returning any plaintext.
ExpectedSealed Seal(Algorithm algorithm, const Secure::Password &key, std::span< const std::byte > nonce, std::span< const std::byte > plaintext, std::span< const std::byte > aad={})
Encrypt binary plaintext with a raw AES key and detached full tag.
StormByte::Expected< Sealed, Error > ExpectedSealed
Definition aead.hxx:95
Algorithm
Supported raw-key authenticated encryption algorithms.
Definition aead.hxx:57
@ AES128GCM
AES-GCM with an exactly 16-byte key.
Definition aead.hxx:58
@ AES256GCM
AES-GCM with an exactly 32-byte key.
Definition aead.hxx:59
constexpr std::uint64_t MaxMessageSize
GCM byte limit.
Definition aead.hxx:77
StormByte::Expected< StormByte::Safe::SecureBinary, Error > ExpectedPlaintext
Definition aead.hxx:96
constexpr std::uint64_t MaxAADSize
GCM AAD byte limit.
Definition aead.hxx:78
Error
Typed validation, authentication and backend failures.
Definition aead.hxx:65
@ BackendFailure
Definition aead.hxx:72
@ AuthenticationFailed
Definition aead.hxx:71
@ InvalidKeySize
Definition aead.hxx:67
@ InputTooLong
Definition aead.hxx:70
@ UnsupportedAlgorithm
Definition aead.hxx:66
@ InvalidNonceSize
Definition aead.hxx:68
@ InvalidTagSize
Definition aead.hxx:69
constexpr std::size_t TagSize
Only full 128-bit tags are accepted.
Definition aead.hxx:76
constexpr std::size_t NonceSize
Only 96-bit nonces are accepted.
Definition aead.hxx:75
std::conditional_t< Type::Reference< T >, std::expected< std::reference_wrapper< std::remove_reference_t< T > >, Safe::Shared< E > >, std::expected< T, Safe::Shared< E > > > Expected
Detached public ciphertext and full-length authentication tag.
Definition aead.hxx:86
StormByte::Safe::Binary tag
Definition aead.hxx:88
StormByte::Safe::Binary ciphertext
Definition aead.hxx:87
#define STORMBYTE_CRYPTO_PUBLIC
Definition visibility.h:53