File Encryption (fcrypt) security design

How fcrypt protects files: the 2026102 file format, per-file keys wrapped for passwords, key files, RSA keys and smart cards, AES-256-CBC with HMAC-SHA256 on every record, FIPS 140-3 mode, key management, the access log, the security measures and their limits.

The current copy is at https://datareel.com/fcrypt/security_design.php.

Release: 2026.110 (file format 2026102), built with the DataReel C++ library 6.4.1 and OpenSSL 3.5 LTS (on RHEL 8 hosts in FIPS mode, Red Hat's FIPS-validated system OpenSSL 1.1.1; section 11). Audience: security reviewers, administrators and anyone deciding whether to trust fcrypt with their files. The source code is published, so everything on this page can be checked against it; the design does not depend on keeping it secret. The README has the commands, and the programs are on the downloads page.

1. What fcrypt protects, and from whom

fcrypt encrypts a file into a .enc file, fdecrypt decrypts it, and fmigrate converts files from older releases to the current format. The goals are:

fcrypt does not protect against an attacker who controls the computer while a file is being encrypted or decrypted (malware that reads the program's memory, the keyboard or the decrypted output), against a weak password, or against someone who already has a valid credential.

2. The 2026102 file format

fcrypt writes only format 2026102 (release 2026.102 and later). All integers are little endian. A file is a fixed header, a key slot area, a header MAC and a series of encrypted records.

Fixed header128 bytes, clear Key slot area16,384 bytes by default Header MAC32 bytes Record 0stored file name Records 1 to Nup to 64 KB of data each Length4 bytes IV16 bytes, random CiphertextAES-256-CBC, PKCS#7 padding TagHMAC-SHA256, 32 bytes The tag covers the file ID, the record number, a last-record flag, the length, the IV and the ciphertext.
Figure 1. Layout of a 2026102 file and of one record.
PartContents
Fixed header (128 bytes)Magic FCRYPT\x1A\x04, file version 2026102, header length, flags, KDF ID (1 = PBKDF2-HMAC-SHA256), KDF iteration count, cipher ID (1 = AES-256-CBC with HMAC-SHA256, encrypt-then-MAC), chunk size (65,536), key slot area length, a random 32-byte PBKDF2 salt, a random 16-byte file ID and 40 reserved bytes. A file that was rekeyed keeps its key generation and rekey time in the reserved bytes.
Key slot areaOne slot per way of opening the file: type (1 = password or key file, 2 = RSA key, 3 = smart card), slot length, user name and the wrapped file key. Unused space is zero. The area is 2,048 to 65,535 bytes, 16,384 by default.
Header MAC (32 bytes)HMAC-SHA256 over the fixed header and the whole key slot area.
RecordsRecord 0 holds the stored file name; records 1 to N hold the file data, one chunk of up to 65,536 bytes each. Each record is encrypted and tagged on its own (section 4).

When a file is opened, every header value and every slot length is checked against fixed limits before it is used (for example the iteration count must be 1,000 to 10,000,000 and a user name at most 255 bytes), because none of it is authenticated until a credential has recovered the file key.

3. The file key and the key slots

Every file has its own random 256-bit file key, made by the OpenSSL random generator. Every credential is a way to recover that file key, and the file key is never stored in the clear.

Password or key fileslot type 1, at most one RSA or SSH-RSA keyslot type 2, one per user Smart card (PKCS#11)slot type 3, one per user PBKDF2 + AES Key Wrap600,000 rounds, 32-byte salt RSA-OAEP, SHA-256RSA user keys 2048 bits or more File key256-bit, random Header MAC key Data encryption Data MAC KBKDF-HMAC-SHA256context: file ID --remove-user deletes a slot; --rekey makes a new file key and rewraps every kept user.
Figure 2. Every credential recovers the same file key; three working keys are derived from it.

4. Record encryption and integrity

What the checks detect:

5. Decryption and output files

1. Read header, slotsevery length checked 2. Unwrap file keyone credential, one slot 3. Check header MACheader and all slots 4. Each recordcheck tag, then decrypt Private temp filenew, mode 600 on Linux 5. Rename to outputonly after the last record Any failuretemp file removed, error, non-zero exit An existing output file is replaced only with -o. Stored paths with .. are refused, and leading /, drive letters and UNC prefixes are removed unless --absolute-path is given.
Figure 3. Decrypted data is kept only after every check passes.

6. FIPS 140-3 mode

fcrypt, fdecrypt and fmigrate have a FIPS 140-3 mode using the OpenSSL FIPS provider. fcrypt itself is not a validated cryptographic module.

7. Smart cards (PKCS#11)

8. Adding and removing users, and rekeying

9. Passwords, keys and prompts

10. Tamper-evident access log

11. Older files, builds and platforms

12. Limits, stated plainly

13. Quantum computing

14. Reporting a security issue

Report security issues privately through the contact page, not in public issue trackers. Fixes go into the next release; the README lists every release and what changed.