Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Designing an encrypted USB vault format without inventing any crypto

We needed a way to keep an encrypted copy of a password vault on a USB stick: something you can pull out of the computer at any moment without corrupting it, that reveals as little as possible to whoever finds the stick, and that a reviewer can check without reading our code. This post walks through the design of the format we ended up with, GKDF (Guardikey Key Drive Format). The full byte-level…

The wire material describes the design of an encrypted USB vault format called GKDF (Guardikey Key Drive Format). The format uses standard cryptographic primitives such as Argon2id for password stretching, XChaCha20-Poly1305 for encryption, HKDF-SHA256 for key derivation, and BLAKE3 for hashing. The container is a fixed-size 1 MiB file consisting of a 1 MiB header and 64 KiB chunks, and it never changes in size.

The data is encrypted under a random drive master key (DMK) that is wrapped by key-encryption keys derived from various factors, including the master password, recovery key, key file, and a "quick unlock on this computer" secret. Each factor goes through Argon2id stretching before being combined with HKDF to create the key-encryption key.

The format avoids writing in place to prevent data corruption in case a USB stick is removed during a write operation. Instead, it uses two slot tables and two superblocks, where a save operation writes new chunks into free space, flushes, and then writes a new superblock over the older one. Interrupted saves retain the previous generation, and an incomplete superblock is ignored during authentication.

The previous draft included a Merkle tree over the chunks, but it was removed in favor of a more straightforward approach. Each reference to a chunk contains the chunk's write generation, index, key epoch, and purpose, which are all included in the AEAD associated data. This eliminates the need for a Merkle tree while still ensuring the integrity of the chunks.

To prevent unauthorized access, the current generation of the vault is anchored on the computer and optionally on a sync server using a keyed tag. Older generations can be opened in read-only mode for inspection but with a warning. The spec also includes test vectors and six questions for reviewers, encouraging independent verification of the design.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Three spreadsheet errors you can't see by looking at the row

I wrote a checker because I kept missing the same three things. None of them are visible if you read a row on its own. 1. The overwritten formula A row says 300 x 4.80 = 1,500.00.

  • Formula overwritten, altering calculation from 3004.80 to 1,500.00
  • Duplicate item with same document number and quantity, 30 rows apart
  • Unit price error, price entered as 8.50 instead of 0.85

What Is the Difference Between val and var in Kotlin, and Is val Immutable?

In short: var can be given a new value. val can't. But val only locks the name, not the object behind it. A val list can still grow, and a val property can return a new value each time you read it.

  • Var allows variable reassignment, val does not
  • val locks object reference, not object itself
  • In Android, val misuse can cause view update issues

More from Saturday, 28 November 2026 →