Language: English

How the encryption works

For anyone who wants to check; you don't need it to use Locker. The code is client/js/encryption.js; the extension carries an identical copy, kept identical by a test. AES-256-GCM, HKDF and SHA-2 come from your browser's Web Crypto; scrypt (RFC 7914, absent from Web Crypto) is Locker's own code. No third-party crypto library.

Each Locker gets a fresh 256-bit secret from the system's secure random generator, written in base64url (43 characters) after # and a UTC-day namespace prefix:

A Locker link: the server address before the # is sent to the server; the key after the # is never sent to the server.https://your-locker/#Tm4wJx…Server addressSent to the serverKeyNever sent to theserver
https://your-locker/#n1-<day>-<tag>.<43-character-secret>

Browsers never send the part after #, so it never reaches the server or its logs. It can still appear in history, extensions, the clipboard and wherever you paste it. Locker removes it from the address bar once open; copies made elsewhere remain.

Two values from one secret

One secret becomes a public identifier and a private file keyThe one-time 256-bit secret is expanded with HKDF-SHA-512 into two separate values. The public identifier names the Locker on the server. The file key encrypts the file and never leaves your devices. ONE SECRET 256-bit secretthis Locker only HKDF-SHA-512 derive two labels from one key public identifier names the Locker on the server — the one value the server is given file key encrypts the file (ChaCha20-Poly1305) never leaves your devices
Two values, one secret. HKDF-SHA-512 expands the 256-bit secret into a public identifier that names the Locker on the server and a file key that encrypts the file and never leaves your devices. The server is given the identifier, never the key.

HKDF-SHA-512, salt "PrivacySafe Locker PLK3 key derivation" plus a NUL and the namespace, with a different label per output:

The 256-bit secret is expanded with HKDF-SHA-512 into two separate values: a public identifier that names the Locker on the server, and a file key that encrypts the file and never leaves your devices.256-bit secretHKDF-SHA-512PublicidentifierNames the Lockeron the serverFile keyEncrypts the file,never leaves yourdevices
Output Label Size Used for
Public storage identifier "public storage identifier" 128 bits Naming the Locker on the server
File key "file-encryption AES-256-GCM" 256 bits Encrypting and decrypting

The identifier reveals nothing about the key.

The file format (PLK3)

  1. A 24-byte header: PLK3, the record size (1 MB), the metadata length, an 8-byte random nonce prefix, and the record count.
  2. Encrypted metadata: name, type, real size, padded size.
  3. Encrypted records: the padded file in 1 MB pieces.
The PLK3 file: a 24-byte header, the padded name and type, then records of up to 1 MiB, each encrypted and with its own check.Header24 BName and type, padded256, 1024 or 4096 BRecord 11 MiBCheckRecord 21 MiBCheck…Record n1 MiBCheckEach record is encrypted with AES-256-GCM andchecked; changing any of it is detected.

Each is encrypted with AES-256-GCM:

  • Nonce: the 8-byte prefix plus the record number. Keys are unique per Locker, so a nonce never repeats under a key.
  • Authenticated data: the header plus the record number. Changing, reordering, removing or adding records, or editing the header, fails decryption.
  • Tag: 128 bits per record.

Records let large files stream and damage show up at the first bad record. The full specification is in CRYPTOGRAPHY.md in the source, checked by an independent decryptor.

Hiding sizes

File size: Padmé zero padding, at least 64 KB, at most about 3% for larger files; encrypted and checked like the file. Name length: metadata is padded to 256, 1,024 or 4,096 bytes.

Passphrases

Stretched with scrypt (N = 2^17, r = 8, p = 1; 128 MB per guess).

  • Link and passphrase: the scrypt salt comes from the link secret (label "passphrase salt"); the key comes from both (label "file-encryption AES-256-GCM with passphrase"). The recipient is asked for the passphrase before downloading.
  • Passphrase only: the link holds a random locator and salt but no key, so the key rests on the passphrase alone. Four words or emojis are weak offline; this mode needs explicit acknowledgment. Prefer link and passphrase.

Passphrases are normalized (capitals, spaces and punctuation ignored), never stored or sent.

Sending the key separately

A link without its secret, plus the 43-character secret alone. The recipient's browser checks the key belongs to that Locker before downloading.

A short code maps to the public identifier. The secret stays after #, which survives the redirect, so the server never sees it.

On the recipient's side

Their browser derives the key, downloads, checks the header and every record, and shows or saves the file only if all checks pass. Files that could run code are always downloaded, never opened in the page.

Why it resists quantum computers

Only symmetric cryptography protects a stored Locker (AES-256-GCM, HKDF-SHA-512, scrypt, SHA-2), and no key goes through a public-key exchange, the part quantum computers could break. Grover's algorithm leaves AES-256 about 128 bits. That covers stored files against "record now, decrypt later"; the HTTPS or Tor connection is a separate layer, and a weak passphrase stays weak.

Local Transfer

Nearby (beta): WebRTC (DTLS) plus per-direction AES-256-GCM records keyed from private pairing codes; both users confirm eight matching emojis before any file details are sent. Network addresses may be visible. Camera codes: AES-256-GCM under a key stretched from the words (four by default, up to 24) with PBKDF2-SHA-256 (600,000 rounds); recorded codes allow offline guessing. Enhanced mode uses a separate private 256-bit key QR. See Local Transfer.

This page is licensed under CC BY-SA 4.0. PrivacySafe Locker is free software under the GNU AGPL version 3 or later; see License.