Skip to content

.crin File Format

Version: 1.0  |  Status: Stable

Offset Size Field
0 8B Magic: "CRYPTIN1" (ASCII)
8 1B Version: 0x01
9 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) — AAD
58 16B Salt (random, per-file)
74 12B Nonce (random, AES-GCM)
86 N B Ciphertext
86+N 16B GCM Authentication Tag

The header from offset 0 to 57 (inclusive) is authenticated as AEAD associated data. Any modification to the header invalidates the GCM tag.

K_session = DERIVE_SESSION_KEY(dongle, nonce_session)
K_file = HKDF-SHA256(ikm=K_session, salt=salt, info="cryptin-file-v1")
  1. Read and verify magic "CRYPTIN1"
  2. Extract dongle pubkey from header
  3. Verify dongle pubkey matches connected dongle (GET_PUBKEY)
  4. Derive K_file using salt from header
  5. Decrypt with AES-256-GCM using nonce from header
  6. Verify GCM tag — if invalid: “Wrong dongle or corrupted file”