.crin File Format
Version: 1.0 | Status: Stable
Structure
Section titled “Structure”Offset Size Field0 8B Magic: "CRYPTIN1" (ASCII)8 1B Version: 0x019 1B Algorithm ID: 0x01 (AES-256-GCM + HKDF-SHA256)10 16B KDF Parameters (HKDF info string length + content)26 32B Dongle public key (K_identity pubkey) — AAD58 16B Salt (random, per-file)74 12B Nonce (random, AES-GCM)86 N B Ciphertext86+N 16B GCM Authentication TagAuthenticated Data (AAD)
Section titled “Authenticated Data (AAD)”The header from offset 0 to 57 (inclusive) is authenticated as AEAD associated data. Any modification to the header invalidates the GCM tag.
Key Derivation
Section titled “Key Derivation”K_session = DERIVE_SESSION_KEY(dongle, nonce_session)K_file = HKDF-SHA256(ikm=K_session, salt=salt, info="cryptin-file-v1")Decryption
Section titled “Decryption”- Read and verify magic
"CRYPTIN1" - Extract dongle pubkey from header
- Verify dongle pubkey matches connected dongle (
GET_PUBKEY) - Derive K_file using salt from header
- Decrypt with AES-256-GCM using nonce from header
- Verify GCM tag — if invalid: “Wrong dongle or corrupted file”