Classes | |
| struct | Sealed |
| Detached public ciphertext and full-length authentication tag. More... | |
Typedefs | |
| using | ExpectedSealed = StormByte::Expected<Sealed, Error> |
| using | ExpectedPlaintext = StormByte::Expected<StormByte::Safe::SecureBinary, Error> |
Enumerations | |
| enum class | Algorithm { AES128GCM , AES256GCM } |
| Supported raw-key authenticated encryption algorithms. More... | |
| enum class | Error { UnsupportedAlgorithm , InvalidKeySize , InvalidNonceSize , InvalidTagSize , InputTooLong , AuthenticationFailed , BackendFailure } |
| Typed validation, authentication and backend failures. More... | |
Functions | |
| 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. | |
| 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. | |
Variables | |
| constexpr std::size_t | NonceSize = 12 |
| Only 96-bit nonces are accepted. | |
| constexpr std::size_t | TagSize = 16 |
| Only full 128-bit tags are accepted. | |
| constexpr std::uint64_t | MaxMessageSize = (std::uint64_t{1} << 36) - 32 |
| GCM byte limit. | |
| constexpr std::uint64_t | MaxAADSize = (std::uint64_t{1} << 61) - 1 |
| GCM AAD byte limit. | |
| using StormByte::Crypto::AEAD::ExpectedPlaintext = StormByte::Expected<StormByte::Safe::SecureBinary, Error> |
|
strong |
|
strong |
| ExpectedPlaintext StormByte::Crypto::AEAD::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.
| algorithm | AES128GCM or AES256GCM. |
| key | Immutable wiped raw key storage. |
| nonce | Borrowed exactly 12-byte nonce. |
| ciphertext | Borrowed binary ciphertext, possibly empty. |
| tag | Borrowed exactly 16-byte authentication tag. |
| aad | Borrowed binary additional authenticated data, possibly empty. |
| ExpectedSealed StormByte::Crypto::AEAD::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.
| algorithm | AES128GCM or AES256GCM. |
| key | Immutable wiped raw key storage, not a password to derive. |
| nonce | Borrowed exactly 12-byte nonce. |
| plaintext | Borrowed binary plaintext, possibly empty. |
| aad | Borrowed binary additional authenticated data, possibly empty. |
|
inlineconstexpr |
GCM AAD byte limit.
|
inlineconstexpr |
GCM byte limit.
|
inlineconstexpr |
Only 96-bit nonces are accepted.
|
inlineconstexpr |
Only full 128-bit tags are accepted.