Raxol.Security.Encryption.KeyManager (Raxol v2.0.1)
View SourceManages encryption keys for at-rest data encryption.
This module provides secure key generation, storage, rotation, and retrieval for encrypting sensitive data. It supports multiple encryption algorithms and key derivation functions.
Features
- Master key encryption with key derivation
- Data encryption keys (DEK) with automatic rotation
- Key encryption keys (KEK) for wrapping DEKs
- Hardware Security Module (HSM) support
- Key versioning and migration
- Audit logging for all key operations
Summary
Functions
Returns a specification to start this module under a supervisor.
Decrypts data using the specified key.
Deletes a key (marks as deleted, doesn't remove).
Encrypts data using the specified key.
Generates a new data encryption key.
Gets an encryption key by ID and version.
Gets key metadata without the actual key material.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Lists all managed keys (metadata only).
Re-encrypts data with a new key version.
Rotates a key to a new version.
Unwraps a DEK using a KEK.
Wraps a DEK with a KEK for secure storage.
Types
@type algorithm() :: :aes_256_gcm | :aes_256_cbc | :chacha20_poly1305 | :aes_256_ctr
@type encryption_key() :: %{ id: key_id(), version: key_version(), type: key_type(), algorithm: algorithm(), key_material: binary(), created_at: DateTime.t(), expires_at: DateTime.t() | nil, metadata: map() }
@type key_id() :: String.t()
@type key_type() :: :master | :kek | :dek | :signing | :hmac
@type key_version() :: pos_integer()
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Decrypts data using the specified key.
Deletes a key (marks as deleted, doesn't remove).
Encrypts data using the specified key.
Generates a new data encryption key.
Gets an encryption key by ID and version.
Gets key metadata without the actual key material.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Lists all managed keys (metadata only).
Re-encrypts data with a new key version.
Rotates a key to a new version.
Unwraps a DEK using a KEK.
Wraps a DEK with a KEK for secure storage.