Advanced Cryptographic Key Management
PostgreSQL-backed secure storage for large FHE keys (... keys, ... total)
28
Algorithms
...
Largest Key
614ms
Large Key Retrieval
...
Compression Ratio
System Overview
Design Principles
- Separation of Concerns
- Database-Backed Storage
- Reference-Based Architecture
- Complete Audit Trail
- Lifecycle Management
Technology Stack
Application
Rust + SQLx
Storage
PostgreSQL 15+
Security
NIST 800-88
Key Features
TOAST Compression
Adaptive Pooling
Lifecycle Policies
Audit Logging
Cryptographic Shredding
Tamper Detection
Technical Architecture
Client Layer
REST API Requests
UUID References
Application Layer (Rust)
SQLx Async Driver
UUID v4 Generation
Chrono Timestamps
Storage Layer (PostgreSQL)
BYTEA Columns
JSONB Metadata
TOAST Compression
B-tree Indexes
Identity
key_vaultkey_id UUID PRIMARY KEY
algorithm VARCHAR(255)
key_type VARCHAR(50)
Key Material (Binary)
key_vaultpublic_key BYTEA
private_key BYTEA
symmetric_key BYTEA
Lifecycle
key_vaultcreated_at TIMESTAMPTZ
expires_at TIMESTAMPTZ
revoked_at TIMESTAMPTZ
rotation_policy VARCHAR(50)
Access Details
key_vault_access_logaccessed_at TIMESTAMPTZ
accessed_by VARCHAR(255)
operation VARCHAR(50)
Context
key_vault_access_logip_address INET
user_agent TEXT
request_id UUID
Result
key_vault_access_logsuccess BOOLEAN
duration_ms INTEGER
key_size_bytes BIGINT
Performance Metrics
Storage Efficiency
Raw Key Size (... keys)
Loading...
TOAST Storage Strategy
Loading...
Actual Storage Size
Loading...
Compression Ratio
Loading...
Query Performance
| Operation | Time | Status |
|---|---|---|
| Key Retrieval (114MB) | 614ms | Excellent |
| Usage Update | 2ms | Excellent |
| Audit Log Insert | 1ms | Excellent |
Scalability Improvements
Storage Strategy
EXTERNAL: Out-of-line, no compression
Optimal for crypto keys (incompressible)
Saves CPU, prevents bloat
Connection Pool
Configuration: Adaptive pool
Range: 5-50 connections
Scales with load
Query Timeout
Limit: 600 seconds
Optimized for large FHE keys
Handles 114 MB keys
Security & Compliance
Access Control
- Owner-based key isolation
- JSONB policy enforcement
- Time-based expiration
- Usage count limits
Audit Logging
- Tamper-evident Merkle hashes
- SHA-256 audit chains
- Complete access history
- Forensic analysis ready
Lifecycle Management
- Automatic expiration checks
- Revocation enforcement
- Usage limit tracking
- Storage tier optimization
Cryptographic Shredding
- NIST 800-88 compliant
- 3-pass overwrite (zeros/random/zeros)
- Automatic on expiration
- Batch processing (100 keys)
NIST 800-88
GDPR Ready
HIPAA Compliant
PCI-DSS Aligned
API Integration
1
Key Generation
POST /keys/generate
{
"algorithm": "post-zk-homomorphic"
}
key_id
โ
ac7ff871-2184-48d4...
โ
2
Encryption
POST /encrypt
{
"algorithm": "post-zk-homomorphic",
"data": "SGVsbG8...",
"key_id": "ac7ff871..."
}
encrypted_data
โ
3.16MB payload
โ
3
Decryption
POST /decrypt
{
"algorithm": "post-zk-homomorphic",
"data": "PQP...",
"key_id": "ac7ff871..."
}
decrypted_data
โ
Original plaintext
Technical Specifications
Database Infrastructure
| Database | PostgreSQL 15+ |
| Driver | SQLx 0.7.4 (async) |
| Connection Pool | 5-50 adaptive |
| Pool Timeout | 30s idle / 60s max lifetime |
| Query Timeout | 600s (large keys) |
Storage & Compression
| Key Storage | BYTEA binary columns |
| TOAST Strategy | EXTERNAL (optimal - no compression waste) |
| Max Key Size | 1GB per column |
| Current Usage | 115MB ร 10 keys = 1.15GB |
| Storage Tiers | Hot / Warm / Cold / Archive |
Data Types & Formats
| Identifier | UUID v4 (128-bit) |
| Timestamps | TIMESTAMPTZ (TZ-aware) |
| Metadata | JSONB (flexible schema) |
| IP Addresses | INET (IPv4/IPv6) |
| Arrays | TEXT[] (compliance tags) |
Performance & Indexing
| Primary Index | B-tree on UUID |
| Algorithm Index | B-tree on algorithm |
| Expiration Index | Partial B-tree (WHERE NOT NULL) |
| Avg Retrieval | 614ms (114MB key) |
| Metadata Update | ~2ms |
Lifecycle Management
| Rotation Policies | 3mo / 6mo / 12mo / manual |
| Retention | 90d / 1y / 3y / permanent |
| Shredding | NIST 800-88 (3-pass) |
| Auto Expiration | Scheduled task (hourly) |
| Usage Limits | Configurable per key |
Security & Compliance
| Audit Logging | Complete access trail |
| Tamper Detection | Merkle hash chains |
| Hash Algorithm | SHA-256 |
| Compliance | GDPR / HIPAA / PCI-DSS |
| Access Control | Owner-based + JSONB policies |