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:
- Confidentiality at rest: someone who copies an encrypted file, a backup or a lost disk cannot read the data or the original file name without a credential that opens the file.
- Integrity: a change made to the encrypted file, such as changed, removed, reordered, added or truncated data, or a changed list of users, is detected before any decrypted output is kept.
- Separate credentials per person: a file can be opened with a password or key file, and by several people with their own RSA key, SSH-RSA key or smart card. One user can be removed, and the file given a new key, without sharing a new secret with the rest.
- No secrets in scripts: passwords, passphrases and PINs can be read from a private file or a file descriptor instead of the command line.
- No damaged files: decrypting, removing a user, rekeying and converting write a new file and check it before it replaces anything.
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.
| Part | Contents |
| 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 area | One 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. |
| Records | Record 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 file: PBKDF2-HMAC-SHA256 (SP 800-132) with the file's random 32-byte salt turns the
password, or the contents of a key file, into a 256-bit key that wraps the file key with AES-256 Key Wrap
(SP 800-38F). The default is 600,000 iterations;
fcrypt --iteraccepts 1,000 to 10,000,000, and the count is stored in the header. A password or key must be at least 8 bytes. Key Wrap has its own integrity check, so a wrong password is found when the key is unwrapped. - RSA and SSH-RSA keys: the file key is encrypted to the user's RSA public key with RSA-OAEP, using SHA-256 for both the hash and MGF1. Adding a user needs only their public key (an SSH-RSA key is converted to a PEM public key with ssh-keygen). fcrypt refuses an RSA user key under 2048 bits, or under 3072 bits when the RHEL crypto policy is FUTURE (fcrypt reads the policy itself, section 11); slots hold RSA keys up to 8192 bits. The user decrypts with their private key file.
- Smart cards: the file key is encrypted with RSA-OAEP SHA-256 to the public key of a card certificate, read from the card (no PIN) or from an exported certificate file. The card decrypts it with a private key that never leaves the card (section 7).
- Quantum-resistant (hybrid) users, 2026.110: an RSA or smart card user can also have an ML-KEM-1024 key (NIST FIPS 203). The file key is then wrapped with AES-256 Key Wrap under a key derived with KBKDF-HMAC-SHA384 from both the ML-KEM-1024 shared secret and 32 random bytes encrypted with RSA-OAEP SHA-256 for the user's RSA key or card; the derivation also binds the slot type, the user name and a SHA-384 of both ciphertexts. Opening the file as that user needs both the RSA private key (or the card) and the ML-KEM private key file, a PKCS#8 file encrypted with the user's passphrase. The hybrid user's slot (type 4 for RSA, 5 for a card) keeps its ciphertexts in part slots (type 6) of at most 1,008 bytes, so releases 2026.102 to 2026.109, which refuse longer slots, still open the file with the password, key file or an RSA-only user.
- Derived keys: KBKDF in counter mode with HMAC-SHA256 (SP 800-108) derives three keys from the file key, each with its own label and the file ID as context: the header MAC key, the data encryption key and the data MAC key. No key is used for two purposes.
- Random values: the file key, salt, file ID and every IV come from the OpenSSL random generator (the FIPS provider's generator in FIPS mode).
4. Record encryption and integrity
- Each record is encrypted with AES-256 in CBC mode under the data encryption key, with a new random 16-byte IV. A record holds at most one chunk, 65,536 bytes, of data.
- Each record then gets an HMAC-SHA256 tag under the data MAC key (encrypt-then-MAC). The tag covers the file ID, the record's number (8 bytes), a last-record flag (1 byte), the ciphertext length, the IV and the ciphertext. The tag is checked, in constant time, before the record is decrypted, so a changed ciphertext is never decrypted.
- Header authentication: the header MAC covers the fixed header, including the iteration count, salt, file ID and reserved bytes, and the whole key slot area. It is checked right after the file key is recovered and before any record is read, so users cannot be added, removed or changed, and header values cannot be altered, without a credential that opens the file.
What the checks detect:
- Changed data: any changed byte in a record fails its tag; a changed header or slot fails the header MAC.
- Removed or reordered records: the record number is part of the tag, so a record in the wrong place fails.
- Truncated files: only the final record carries the last-record flag. A file cut short ends on a record without it and fails.
- Added data: a record followed by more bytes must not have the last-record flag, so data appended after the real last record makes that record fail.
- Records from another file: the file ID is part of the tag, and each file has its own keys.
- Bad lengths: a record length that is not a whole number of AES blocks, or larger than a chunk plus padding, is refused before anything is read into memory.
5. Decryption and output files
- fdecrypt writes decrypted data to a new temp file with a random name next to the output file. It is created exclusively, never through a symbolic link, readable and writable only by the owner on Linux.
- The temp file is renamed to the output name only after every record, including the one with the
last-record flag, has passed its check. If anything fails, the temp file is removed and nothing is left
behind. Without
-othe rename fails rather than replace a file that appeared in the meantime. - The stored file name is not trusted. By default it is restored relative to the current or output
folder; names with
..are refused.--no-pathkeeps only the file name and--absolute-pathrestores the exact stored path, for full restores. - With
--stdoutthere is no temp file: each record is written as soon as it passes its check, and a failure stops the output with an error and a non-zero exit code (see section 12). - Keys, key encryption keys, unwrapped keys and decrypted buffers are cleared with
OPENSSL_cleanseonce they are no longer needed.
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.
- When it is on: with
--fips, whenFCRYPT_FIPS=1is set, or when the host is in FIPS mode:/proc/sys/crypto/fips_enabledis 1 on Linux, the Windows "System cryptography: Use FIPS compliant algorithms" policy is enabled, or the OpenSSL configuration setsfips=yes.--no-fipsturns it off for one run.fcrypt --versionshows the mode and the provider in use. - How: the programs make their own OpenSSL library context with only the
fipsandbaseproviders loaded andfips=yesas the default property, and setfips=yesin OpenSSL's default context too, for the few calls that always use it. If the FIPS provider cannot be loaded or fails its self-test, the program stops and nothing is encrypted or decrypted. - Algorithms: format 2026102 uses only PBKDF2-HMAC-SHA256, AES-256 Key Wrap, RSA-OAEP with SHA-256, KBKDF with HMAC-SHA256, AES-256-CBC and HMAC-SHA256, all fetched from that library context. Hybrid users add ML-KEM-1024 and KBKDF-HMAC-SHA384, which need a FIPS provider that includes ML-KEM: the RHEL FIPS provider (Red Hat's validated 3.0.7 module) does not yet, so in FIPS mode a hybrid user gets a clear error and the file still opens with the password, key file or an RSA-only user.
- Refused in FIPS mode: files from releases before 2026.102, whose key derivation is not an approved
algorithm; decrypt them with
fdecrypt --no-fipsor convert them withfmigrate --no-fips. A private RSA key with a passphrase in the traditional PEM format, which derives its key with MD5, cannot be read; convert it to PKCS#8 (the README shows the command, also for SSH-RSA keys). - Requirements: RHEL 9 and 10 use the operating system's FIPS provider (
fips-mode-setup --enable). On RHEL 8, hosts in FIPS mode use therhel8build, which links Red Hat's FIPS-validated system OpenSSL 1.1.1k; that library runs in FIPS mode by itself on a host in FIPS mode, and fcrypt then reports FIPS mode on and refuses old formats (tested on RHEL 8.10 in FIPS mode). The preferred RHEL 8 build,rhel8_openssl35, has OpenSSL 3.5 built in without a FIPS provider: it refuses to run on a host in FIPS mode, and the installer does not choose it there. Windows builds use the FIPS provider (fips.dll) of the OpenSSL 3.5.x LTS release they were built with. - Compliance: for FIPS 140-3 compliance the FIPS provider version in use must have a CMVP certificate. Check the provider version against the validated list before relying on FIPS mode, and check your site's policy with your security office.
- Smart cards: the card's private key operation is done by the card and its PKCS#11 module, not by the OpenSSL FIPS provider (section 7).
7. Smart cards (PKCS#11)
- No OpenSSL engine on OpenSSL 3: builds that use OpenSSL 3 (RHEL 9, RHEL 10, Windows and the RHEL 8
rhel8_openssl35build) load the card's PKCS#11 module directly; the deprecated OpenSSL ENGINE API and the pkcs11 engine are not used. The RHEL 8 FIPS build (system OpenSSL 1.1.1) still uses the pkcs11 engine. The default module is OpenSC; on Windows the ActivClient module is used when it is installed.--smartcard-providerpicks another module. - Adding a card user needs no PIN: the public key is read from the card or from an exported certificate file, and the file key is wrapped in software with RSA-OAEP SHA-256. The card key must be RSA; EC keys are refused, because they cannot decrypt a wrapped key.
- Decrypting asks the card to decrypt the wrapped key with RSA-OAEP SHA-256. Cards that cannot do that themselves, such as PIV cards and ActivClient, decrypt with raw RSA on the card, and fcrypt removes the OAEP padding (SHA-256, MGF1-SHA256), checking every byte before it reports a single padding error.
- PIN safeguards (CAC and PIV cards lock after three wrong PINs):
- The PIN is sent to the card once per decrypt and never retried. After any failed card login, no more logins are made until the program is run again, not for the next file and not by any fallback.
- The PIN is not sent when it is empty, too long (it is never cut short), has a control character such as a tab or carriage return, or is outside the PIN length the card reports.
- The card's PIN flags are read before each login. A locked PIN is refused. When the card reports one try
left or low tries, the PIN is sent only with
--smartcard-allow-final-tryor--smartcard-allow-pin-count-low. Some modules do not report the PIN tries, so passing these checks is not a promise that tries are left. - After a wrong PIN the error says one try was used and what the card reports about the tries left.
- Hybrid card users (2026.110): CAC and PIV cards hold RSA keys only, so a card user is made quantum-resistant by also giving it an ML-KEM-1024 key file: the card decrypts its RSA half and the key file gives the ML-KEM half. Without the key file the card is not used at all (no login).
- Choosing the card:
--smartcard-slotuses only one PKCS#11 slot. Without it, a cert ID found on more than one inserted card, or on none, is refused and no PIN is sent. - Listing without a PIN:
fcrypt --smartcard-listshows the cards, cert IDs, key types and sizes and PIN status, and--smartcard-matchfinds the card that holds a certificate, using only public PKCS#11 calls: no login, no PIN.
8. Adding and removing users, and rekeying
- Adding a user (
--add-rsa-key,--add-smartcard-cert, with--add-pq-public-keyfor a hybrid user) writes the file to a temp file with the new slots and the records unchanged, checks that it decrypts to the same data, and renames it over the original, under the same file lock as the changes below (since 2026.110; it used to rewrite the key slot area in place).--require-pqrefuses users without an ML-KEM key. --remove-userdeletes the RSA key or smart card slot of one user (with a hybrid user's part slots). The last slot is never removed. Removing a user does not change the file key, so a user who already recovered it could still use it; the follow-up is--rekey.--rekeygives the file a new random file key, a new salt and a new file ID, encrypts every record again and rewraps the key for every slot that is kept. RSA and smart card slots are rewrapped with their public keys, so no card login is needed; a hybrid user is rewrapped with its ML-KEM public key too (pq=in the rekey input) and is never silently turned into an RSA-only user. Every existing slot needs a choice (keep, change or drop) in the rekey input, or the rekey stops and lists what is missing; nothing is dropped silently, and a rekey that would leave no slot is refused. The password slot can be kept, changed, dropped or given a generated random password (64 hex digits) written to a private file or descriptor.- Atomic, checked rewrite: both write a new temp file, decrypt it again and compare a keyed
HMAC-SHA256 of its data with the original's (for a rekey, also open it with the new password), flush it to
disk and only then rename it over the original. A crash or kill before the rename leaves the original as it
was. A backup copy,
name.backup-YYYYMMDD-HHMMSS.enc, is kept.--dry-runwrites and checks the new file, then removes it. - One writer: both take an advisory lock on
file.lock(flock on Linux, LockFileEx on Windows) and wait up to--lock-timeoutseconds, 10 by default, for another writer. - Key management can be authenticated with the password or key file, with an RSA private key, or with a smart card (one card login, with the PIN safeguards above).
9. Passwords, keys and prompts
- Secrets from files and descriptors:
--password-file,--password-fd,--rsa-key-passphrase-file,--rsa-key-passphrase-fd,--smartcard-pin-fileand--smartcard-pin-fdin fcrypt, fdecrypt and fmigrate, and--pq-key-passphrase-fileand--pq-key-passphrase-fdfor the ML-KEM key of a hybrid user (2026.110). The secret is the first line, at most 4,096 bytes. On Linux the file must be a regular file, not a symbolic link, owned by you with no group or other access. The buffers are wiped after use. - Secrets on the command line:
--password=,--rsa-key-passphrase=and--smartcard-pin=still work, but print a warning and are overwritten in the process arguments after they are read. - Key files: on Linux a
--keyfile or a private--rsa-keyfile must be a regular file owned by you with no group or other access, as ssh requires for private keys; otherwise it is refused. - Prompts: typed passwords, passphrases and PINs are not shown; the
*echo goes to stderr, not stdout, so it is never mixed with output. A new password is asked for twice. A prompt that gets empty input is an error, and--non-interactivemakes a missing secret an error instead of a prompt. - Scripts: errors go to stderr and the exit codes are fixed: 0 ok, 1 usage or other error, 2 the
credential did not open the file, 3 file or user not found, 4 locked by another writer, 5
--check-versionfound an old file, 7 read or write error.
10. Tamper-evident access log
- Optional and off unless asked for:
--access-log[=file]logs decrypts, user changes and rekeys to a per-user log, by default~/.fcrypt/logs/access.log(folder mode 700, file mode 600). - Each entry has the UTC time, OS user, host, process ID, program, file path, file ID, credential type, slot user, action and result. No password, PIN or file content is ever logged.
- Entries are chained with HMAC-SHA256 per file ID, keyed with a key derived from the file key
(KBKDF-HMAC-SHA256), so an entry cannot be changed, removed, reordered or inserted without
fdecrypt --verify-access-lognoticing, unless the person has the file key. Entries written without the key, such as a failed decrypt, are covered by the next tagged entry. After a rekey the old entries are checked with the old key and tagged again with the new one. - If the log cannot be written, the programs warn once and go on: a log failure never stops a decrypt or a change.
11. Older files, builds and platforms
- Reading older files: fdecrypt decrypts files from every earlier release outside FIPS mode.
Formats 2023102 and 2023103 derive their key with EVP_BytesToKey and SHA-256 (1,000 iterations by default)
and were checked block by block; files from 2025.105 on also carry a whole-file check.
fdecrypt --check-versionreports each file's format without decrypting it. - Converting with fmigrate: the old file is decrypted in memory and encrypted again as it is read, so the plaintext is never written to disk. The new file is written to a private temp file, decrypted again and checked against a SHA-256 hash of the data before it replaces the old file. RSA and smart card users of the old file cannot be carried over, because the old file holds only their wrapped key, not their public key; fmigrate lists them so they can be added again.
- Older releases: they have security problems and are no longer offered for download; only the current release is.
- Linux: RHEL 8, 9 and 10 (RHEL 10 is the default build). From 2026.110 every build uses OpenSSL 3.5
LTS or later, with one exception: RHEL 9 and 10 use the operating system's OpenSSL 3.5; RHEL 8 has two
builds,
rhel8_openssl35(preferred, OpenSSL 3.5.9 LTS built in, for hosts not in FIPS mode) andrhel8(Red Hat's FIPS-validated system OpenSSL 1.1.1k, only for hosts in FIPS mode, no hybrid users). RHEL 8's OpenSSL 3.5 packages come from EPEL, not Red Hat, and have no FIPS provider, so they are not used.install_fcrypt.shin the Linux package picks the build from the RHEL release and the host's FIPS mode, andfcrypt --versionshows the OpenSSL build. The builds stop with an error for an OpenSSL older than 3.5 (except therhel8build), and the programs refuse an older library at run time. - Crypto policy: the OpenSSL built into
rhel8_openssl35does not read the RHEL system crypto policy, so fcrypt reads/etc/crypto-policies/state/currentitself in every Linux build and shows it in--version. With FUTURE, new RSA access needs keys of at least 3072 bits (existing 2048-bit users still decrypt). fcrypt's other algorithms are fixed and allowed by every policy. - Windows: Windows 11, Windows Server 2022 and Windows Server 2025, 64-bit by default with a 32-bit build kept for legacy systems. Windows builds use only an OpenSSL 3.5.x LTS release, built from source with its FIPS provider; the build stops with an error for any other OpenSSL version. The 32-bit and 64-bit builds write the same format.
- DataReel: fcrypt is built with the bundled DataReel C++ library 6.4.1, which supplies its strings, memory buffers, lists, file and folder functions and the file cache used for the older formats. All cryptography is done by OpenSSL.
12. Limits, stated plainly
- A file that opens with a password is only as strong as that password: anyone with a copy can guess
offline at the speed PBKDF2 allows.
--itercan lower the count to 1,000. Use long random passwords, 128-byte random key files, or RSA keys and smart cards. - The header is not encrypted. Anyone can read the iteration count, the file ID, the number of key slots and the user names in the RSA and smart card slots. The number of records shows the file's approximate size.
- Every credential recovers the same file key. Anyone who can open a file can also add users to it, and a removed user who kept the file key can still read the file until it is rekeyed. Backups made before a rekey open with the old credentials.
- With
--stdout, records are written as they pass their checks, so a file that was cut short or changed part way through gives some output before the error. Scripts must check the exit code. - The checks of private files, key files and secret files (owner, mode, no symbolic links) are made on Linux. On Windows, files get the permissions of the folder they are in.
- Hybrid users need fcrypt 2026.110 or later, and a FIPS provider with ML-KEM in FIPS mode. Losing the ML-KEM key file locks the hybrid user out like losing the RSA key does; keep a backup of it.
- Removing whole entries from the end of the access log, and entries after the last tagged one, cannot be detected.
- While a file is being encrypted or decrypted, its keys are in the program's memory.
- Older formats are weaker than 2026102, and fdecrypt reads them outside FIPS mode without a switch. Convert them with fmigrate.
13. Quantum computing
- Quantum-resistant today: AES-256 record encryption (the best known quantum attack roughly halves its strength, which leaves about 128 bits), HMAC-SHA256, PBKDF2, AES Key Wrap and the key derivation. A file opened only with a password or a key file uses no public-key cryptography.
- Not quantum-resistant: the RSA-OAEP slots of RSA-only and card-only users. A quantum computer that can break RSA could recover the file key from any of those slots, so a copy of a file taken today could be attacked once such a computer exists.
- Hybrid users (2026.110): RSA and smart card users can be given an ML-KEM-1024 key (NIST FIPS 203,
OpenSSL 3.5), and the file key is then wrapped so that an attacker must break both RSA and ML-KEM-1024
(section 3).
--rekeymoves existing users to hybrid slots, and--require-pqrefuses RSA-only users. Files keep the 2026102 format. This follows the NSA CNSA 2.0 and NIST guidance to move from RSA to ML-KEM with AES-256. Hybrid users need an OpenSSL 3.5 build: not the RHEL 8 FIPS build, and not FIPS mode until the RHEL FIPS provider includes ML-KEM. - Smart cards: today's CAC and PIV cards hold RSA and elliptic-curve keys only. Until post-quantum cards are issued, a smart card user is protected by a hybrid slot that also needs an ML-KEM key file.
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.