|
Logger System 1.0.0
High-performance C++20 thread-safe logging system with asynchronous capabilities
|
HMAC-SHA256 integrity policy (ISO/IEC 27001 A.12.4.2 default). More...
#include <integrity_policy.h>


Public Member Functions | |
| hmac_sha256_integrity_policy (secure_key key) | |
| Construct from a secure_key. | |
| std::string | sign (const std::string &record) const override |
Produce a signature for record. | |
| bool | verify (const std::string &record, const std::string &signature) const override |
Verify that signature matches record. | |
| std::string | name () const override |
| Short identifier used as a prefix in serialized signatures (e.g. "HMAC-SHA256"). Implementations must return a stable non-empty ASCII string. | |
Public Member Functions inherited from kcenon::logger::security::integrity_policy | |
| virtual | ~integrity_policy ()=default |
Static Private Member Functions | |
| static std::string | compute_hmac (const std::string &message, const secure_key &key) |
Private Attributes | |
| std::shared_ptr< secure_key > | key_ |
HMAC-SHA256 integrity policy (ISO/IEC 27001 A.12.4.2 default).
Uses OpenSSL's EVP_MAC API when available; otherwise falls back to a portable, non-cryptographic hash. The fallback is functionally correct (sign/verify round-trip) but MUST NOT be relied on for tamper detection in production. Build with OpenSSL 3.x to get real HMAC-SHA256.
Thread-safety: instances are immutable after construction; sign() and verify() may be called concurrently.
Definition at line 93 of file integrity_policy.h.
|
inlineexplicit |
Construct from a secure_key.
| key | HMAC key (moved in; policy takes ownership). |
The key is stored in a secure_key to guarantee zeroization on destruction (see secure_key_storage.h).
Definition at line 102 of file integrity_policy.h.
|
inlinestaticprivate |
Definition at line 133 of file integrity_policy.h.
References kcenon::logger::security::secure_key::data(), and kcenon::logger::security::secure_key::size().
Referenced by sign(), and verify().


|
inlineoverridevirtual |
Short identifier used as a prefix in serialized signatures (e.g. "HMAC-SHA256"). Implementations must return a stable non-empty ASCII string.
Implements kcenon::logger::security::integrity_policy.
Definition at line 128 of file integrity_policy.h.
|
inlineoverridevirtual |
Produce a signature for record.
| record | The serialized log record to sign. |
Implements kcenon::logger::security::integrity_policy.
Definition at line 106 of file integrity_policy.h.
References compute_hmac(), and key_.

|
inlineoverridevirtual |
Verify that signature matches record.
| record | The original log record. |
| signature | The signature previously emitted by sign(). |
Implements kcenon::logger::security::integrity_policy.
Definition at line 110 of file integrity_policy.h.
References compute_hmac(), and key_.

|
private |
Definition at line 207 of file integrity_policy.h.