एन्क्रिप्शन मॉडल
.rkvey v5 फ़ॉर्मैट: preamble, प्रति compartment AEAD, append-only commits और secret isolation।
.rkvey v5 फ़ॉर्मैट (Rust Key Vault) HKDF और AEAD best practices पर multi-layer encryption model implement करता है। Mental model: master password → master key → subkeys → encrypted compartments।
हर entry compartments में बँटा है (metadata, protected secrets, manifest और attachment files), प्रत्येक का अपना HKDF key। एक compartment decrypt करने से दूसरे reveal नहीं होते।
QubKey v5 एन्क्रिप्शन मॉडल
मास्टर पासवर्ड
उपयोगकर्ता इनपुट (UTF-8) - कभी भी प्लेनटेक्स्ट में संग्रहीत नहीं किया जाता है
आर्गन2आईडी
नमक
16 बाइट्स (प्रस्तावना)
याद
64 एमबी
पुनरावृत्तियों
3
समानता
4
उत्पादन
256 बिट्स
सर्व - कुंची
256 बिट्स · वॉल्ट रूट कुंजी
एचकेडीएफ-एसएचए256
जानकारी='एचडीआर'
हेडर कुंजी
हेडर_कुंजी
एचकेडीएफ-एसएचए256
जानकारी='idx'
सूचकांक कुंजी
अनुक्रमणिका_कुंजी
एचकेडीएफ-एसएचए256
जानकारी='कम्पार्टमेंट'
डिब्बे की कुंजी
कम्पार्टमेंट_कुंजी
प्रति प्रविष्टि (v5)
HKDF(master_key, salt=file∥entry_id, info=kind∥sub_id) → कम्पार्टमेंट कुंजी
एन्क्रिप्टेड डिब्बे
Key derivation
Derivation आपके master password को usable cryptographic keys में बदलता है। Argon2id जानबूझकर time- और memory-intensive (~500 ms, 64 MB) है offline rate limits enforce करने के लिए। v5 में हर entry compartment को HKDF से अपना key मिलता है।
User input → master password (UTF-8)
Argon2id → random salt के साथ master_key (256 bit)
HKDF-SHA256 → B-Tree के लिए index_key
HKDF-SHA256 → प्रति entry और compartment type compartment_key (metadata, secrets, attachment…)
| Parameter | Value | Description | Default |
|---|---|---|---|
Variant | Argon2id | OWASP-recommended hybrid variant — GPU और side-channel attacks resistant | — |
Memory | 64 MB | प्रति derivation memory — parallel attacks की hardware cost बढ़ाता है | 65536 KB |
Iterations | 3 | memory पर passes — security/performance (~500 ms) | — |
Parallelism | 4 | parallel threads | — |
Output | 32 bytes | derived key length | — |
Salt | 16 bytes | preamble में random salt | — |
AEAD encryption
AES-256-GCM (default)
- modern processors पर AES-NI hardware support
- Nonce: 12 bytes, authentication tag: 16 bytes
- theoretical limit: ~64 GB encrypted data प्रति key
कब choose करें: AES hardware acceleration वाली machines, daily use।
अधिकतर platforms पर optimal performance के लिए default cipher।
XChaCha20-Poly1305 (optional)
- extended nonce: 24 bytes (negligible collision probability)
- hardware dependency नहीं — सभी CPUs पर consistent performance
- long-lived keys के लिए recommended
कब choose करें: archived vaults, AES-NI-less machines, ChaCha20 preference।
advanced vault settings में enable करने योग्य।
File structure
Structure description (v5):
preamble— Magic Bytes, format version, Argon2id saltheader.enc— encrypted vault metadata (name, creation date, settings)index/— secrets decrypt किए बिना O(log-n) search के लिए encrypted B-Treecompartments/— type के अनुसार AEAD blocks: metadata, protected secrets, manifest, attachmentsappend/— commit region: new compartments + index snapshot + validated footer
Integrity और commits
Resilience
Append-only commits interruption पर integrity guarantee करते हैं:
- New compartments file end पर append होते हैं
- Encrypted index snapshot write होता है
- Data disk पर sync (fsync)
- Validated footer commit close करता है (consistency point)
Real scenario: आप entry edit कर रहे हैं और write के दौरान power cut। Restart पर QubKey latest valid footer find करता है — no data loss, no silent corruption। Periodic compaction stale space ज़्यादा होने पर clean file write करता है।
Per-compartment isolation
HKDF-SHA256 से हर compartment को अपना compartment_key मिलता है, master key से entry ID और compartment type के साथ derive। Practical consequences:
- Entry view केवल metadata decrypt करता है; secrets explicit reveal तक masked
- Attachments individually load (download / preview), vault unlock पर नहीं
- B-Tree index अपना
index_keyuse करता है, data से separate - Secret change unchanged attachment files को necessarily rewrite नहीं करता
यह isolation .rkvey-v5 फ़ॉर्मैट में natively built-in है।
Cryptographic primitives
| Primitive | Use | Library |
|---|---|---|
| Argon2id | password → key derivation | argon2 (RustCrypto) |
| HKDF-SHA256 | key → subkey derivation | hkdf (RustCrypto) |
| AES-256-GCM | AEAD encryption | aes-gcm (RustCrypto) |
| XChaCha20-Poly1305 | AEAD encryption (alt) | chacha20poly1305 (RustCrypto) |
| HMAC-SHA256 | file integrity | hmac (RustCrypto) |
| CSPRNG | random generation | getrandom (OS) |