Skip to content

Commit 21cbf83

Browse files
Sergey Kleinclaude
andcommitted
feat: implement security features (HMAC signing, replay protection)
Security Features: • HMAC-SHA256 message signing for integrity verification • Signature verification with constant-time comparison • Replay protection (timestamp freshness + nonce deduplication) • SecurityManager class for signing and verification • KeyManager class for key storage and retrieval Technical Implementation: • Deterministic canonical string creation for signing • Tamper detection for any message modification • Configurable timestamp validity window (default 5 minutes) • 60-second clock skew tolerance • Secure random key generation (32 bytes) Tests: • 40+ security tests covering all features • Signing and verification roundtrips • Tamper detection tests • Replay attack simulations • Key management tests • Integration tests with binary encoding Example: • 06_security_features.py with 8 demonstrations • Performance benchmarks (~1-2ms overhead) • Best practices and production checklist Performance: • 1000 signatures: ~1-2ms per signature • 1000 verifications: ~1-2ms per verification • Minimal overhead for real-time applications Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent da3b8b9 commit 21cbf83

4 files changed

Lines changed: 1236 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)