One-shot message authentication codes. More...
Typedefs | |
| using | ExpectedTag = StormByte::Expected<StormByte::Safe::Binary, Error> |
| Expected full-length binary HMAC tag or a typed error. | |
| using | ExpectedVerification = StormByte::Expected<bool, Error> |
| Expected verification result or a typed error. | |
Enumerations | |
| enum class | Algorithm { SHA256 , SHA384 } |
| Supported HMAC hash functions. More... | |
| enum class | Error { UnsupportedAlgorithm , InvalidTagSize , BackendFailure } |
| Errors returned by HMAC operations. More... | |
Functions | |
| ExpectedTag | Compute (Algorithm algorithm, const Secure::Password &key, std::span< const std::byte > message) |
| Compute a full-length HMAC over binary input. | |
| ExpectedVerification | Verify (Algorithm algorithm, const Secure::Password &key, std::span< const std::byte > message, std::span< const std::byte > tag) |
| Verify a full-length binary HMAC in constant time with respect to tag bytes. | |
One-shot message authentication codes.
Expected verification result or a typed error.
|
strong |
Supported HMAC hash functions.
| Enumerator | |
|---|---|
| SHA256 | HMAC-SHA-256 (32-byte tag). |
| SHA384 | HMAC-SHA-384 (48-byte tag). |
|
strong |
Errors returned by HMAC operations.
| ExpectedTag StormByte::Crypto::HMAC::Compute | ( | Algorithm | algorithm, |
| const Secure::Password & | key, | ||
| std::span< const std::byte > | message ) |
Compute a full-length HMAC over binary input.
| algorithm | HMAC-SHA-256 or HMAC-SHA-384. |
| key | Wiped key storage; an empty key follows HMAC semantics. |
| message | Borrowed message bytes, including any NUL bytes. |
| ExpectedVerification StormByte::Crypto::HMAC::Verify | ( | Algorithm | algorithm, |
| const Secure::Password & | key, | ||
| std::span< const std::byte > | message, | ||
| std::span< const std::byte > | tag ) |
Verify a full-length binary HMAC in constant time with respect to tag bytes.
| algorithm | HMAC-SHA-256 or HMAC-SHA-384. |
| key | Wiped key storage; an empty key follows HMAC semantics. |
| message | Borrowed message bytes, including any NUL bytes. |
| tag | Candidate binary tag; truncated or oversized tags are rejected. |