All file tools

> files encrypt

Encrypt

Protect a file or text with a password before you send or store it. Encryption happens on this device, with AES-256-GCM and a key derived from the password.

Important before you set a passwordIf you forget the password, the encrypted file is lost forever: there is no recovery and no master key. This is not a ZIP, PDF or Office password but a format of its own, openly documented (the layout and a Python example are below under “How it works”). Only this tool or a program that rebuilds this format opens the file again. Your password stays in the memory of this tab, it is not saved or sent anywhere. The name and size of the encrypted file still reveal roughly how big your original was.
Direction

Stays only in the memory of this tab, is not saved or sent anywhere.

Strength: n/aRough estimate: only length and variety of characters

Six random German words from your device’s random number generator, easy to remember and type. They appear openly in the field so you can write them down.

Deliberately neutral: the real file name is hidden, encrypted, inside the content and only appears again when you decrypt.

Choose file

or drag it here, several at once too.

ANY FORMAT · UP TO 500 MB · STAYS ON YOUR DEVICE

Related: Unpack and pack ZIP · Password generator

Your file, your text and your password do not leave this device. Encrypting and decrypting happen only in this tab.

How it works
  1. 01Choose a tab: “File” for one or more documents, “Text” for a paragraph you want to paste into an email.
  2. 02Enter a password (or take a suggested passphrase) and remember the password separately from the file, for example in a password manager or passed on by phone.
  3. 03Choose the file or text, tap “Encrypt” and download or copy the result. To open it later, you need exactly the same password and this tool (or a program following the same format, example below).

What happens here. From your password, a 256-bit key is derived with PBKDF2-HMAC-SHA-256 and 600,000 rounds. Every file gets a new, random salt (16 bytes). Encryption uses AES-256-GCM and a likewise new, random initialization vector (IV, 12 bytes). The authentication tag of GCM sits at the end of the ciphertext. Salt and IV are never reused, so two encryptions of the same file with the same password still give different outputs. Everything runs through the built-in crypto.subtle interface of your browser, none of it leaves the device.

The file format “BNKZENC1”. So that an encrypted file does not depend on this tool, the layout is open: 8 bytes identifier “BNKZENC1”, 1 byte format version, 1 byte KDF identifier (1 = PBKDF2-HMAC-SHA-256), 4 bytes round count, 16 bytes salt, 12 bytes IV, then the ciphertext with the tag attached. The original file name is not openly in the file but encrypted itself in front of the actual content. That is why the downloaded file deliberately has a neutral name. When decrypting, the round count is checked: values below 100,000 or above 10,000,000 are rejected, so that a manipulated file can neither push you down to a weaker derivation nor force you into a deliberate computing bomb.

How to read a .bnkz file with Python (pip install cryptography), for example if you need the format in a program of your own:

import struct, unicodedata
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC

def decrypt_bnkz(path, password):
    data = open(path, "rb").read()
    assert data[:8] == b"BNKZENC1", "not a BNKZ file"
    version, kdf_id = data[8], data[9]
    rounds = struct.unpack(">I", data[10:14])[0]
    assert 100_000 <= rounds <= 10_000_000
    salt, iv = data[14:30], data[30:42]
    header, ciphertext = data[:42], data[42:]
    pw = unicodedata.normalize("NFKC", password).encode("utf-8")
    key = PBKDF2HMAC(hashes.SHA256(), 32, salt, rounds).derive(pw)
    plain = AESGCM(key).decrypt(iv, ciphertext, header)
    n = struct.unpack(">H", plain[:2])[0]
    name = plain[2:2 + n].decode("utf-8")
    return name, plain[2 + n:]

name, content = decrypt_bnkz("document.bnkz", "the-password")
open(name or "decrypted.bin", "wb").write(content)

Wrong password or damaged file. GCM reliably detects whether password and file match, but it cannot tell a wrong password from a file that was changed or damaged afterward. That is why the same message appears in both cases, and a half or wrong result is never output.

Limits. Files up to 500 MB, larger ones are rejected. If you forget the password, the file is irretrievably lost. This tool cannot and will not guess passwords. It is not a ZIP, PDF or Office password and does not open such files either. The name and size of the encrypted file stay visible, even if its content does not: whoever sees it still knows roughly the size of your original. The strength display for a password you type yourself is a rough estimate from length and variety of characters, not a real calculation of the guesses an attacker would need. For a passphrase created with “Suggest a passphrase”, the exact number of bits is shown instead: the number of words and the word list are then known exactly.