File encryption and decryption utility

Release 2026.110

Supports Windows 11, Windows Server 2022 and Windows Server 2025
(64-bit by default; 32-bit builds for legacy systems)
Supports Red Hat Enterprise Linux 8, 9, and 10 (RHEL 10 is the default
Linux build). RHEL 6 and 7 are no longer supported.

Built with the DataReel C++ library version 6.4.1, included under the
3plibs/datareel directory.

This source code is used to build the fcrypt and fdecrypt utilities
that are used to encrypt existing files using the AES CBC 256 bit
encryption algorithm based on the OpenSSL implementation. Every
algorithm used for new files is FIPS 140-3 approved, and the programs
can run with only the OpenSSL FIPS provider.

In the distribution example programs used for OpenSSL development and
testing are under the following directory: 

openssl_examples

Example programs for the AES encryption routines are under the
following directory: 

aesdb_examples

The fcrypt and fdecrypt programs provide a comprehensive symmetric
encryption tool kit for encrypting and decrypting files.

FEATURES:

	AES 256 bit symmetric file encryption
	FIPS 140-3 mode using the OpenSSL FIPS provider
	File encryption using a password or key file
	Multi user access to encrypted files using RSA keys
	Multi user access to encrypted files using a smart card
	Supports DOD CAC smart cards
	Remove users and rekey files (2026.106)
	Tamper evident access log (2026.106)
	Smart card list with no PIN or login (2026.107)
	DataReel 6.3 security fixes (2026.108)
	DataReel 6.4.1 (2026.109)
	Quantum-resistant users, RSA or smart card + ML-KEM-1024 (2026.110)
	
RELEASE 2026.110: QUANTUM-RESISTANT USERS AND OPENSSL 3.5 LTS
-------------------------------------------------------------
* AI-assisted install, build, upgrade and support: AGENTS.md (with
  CLAUDE.md and GEMINI.md, which only import it) lets an approved
  enterprise AI agent assist a site's administrators, human in the loop
  and never autonomous; the agent never sees a password, key, PIN or
  decrypted file. Also at https://datareel.com/fcrypt/ai_assisted_guide.php.
* docs/security_design.php: the security design white paper (the file
  format, the key slots, FIPS 140-3 mode, smart cards, key management, the
  access log and the limits), published at
  https://datareel.com/fcrypt/security_design.php, and
  docs/security_design.html, a standalone copy made by
  docs/make_docs_html.py. The release packages carry the documents in a
  docs folder: README.txt, AGENTS.md, CLAUDE.md, GEMINI.md and
  security_design.html, the same text as the website.
* Quantum-resistant (hybrid) users. An RSA key or smart card user can
  also get an ML-KEM-1024 key (NIST FIPS 203, OpenSSL 3.5): the file key
  is then wrapped so that both the RSA key or card and the ML-KEM key
  are needed, and a future quantum computer that breaks RSA alone cannot
  recover it ("harvest now, decrypt later"). See QUANTUM-RESISTANT USERS
  below.
  - fcrypt --generate-pq-key=file makes a user's ML-KEM-1024 key: file
    (PKCS#8 PEM encrypted with a passphrase, mode 600) and file.pub.pem
    (the public key, for the file owner).
  - fcrypt --add-rsa-key=pub.pem --rsa-key-username=user
    --add-pq-public-key=user_pq.pub.pem (or --add-smartcard-cert or
    --add-smartcard-cert-file with --add-pq-public-key) adds a hybrid user.
  - fdecrypt --rsa-key=key.pem --rsa-key-username=user --pq-key=file
    (or --smartcard-cert ... --pq-key=file) opens the file as that user;
    the passphrase comes from --pq-key-passphrase-file,
    --pq-key-passphrase-fd or the prompt. --remove-user and --rekey
    accept the same options to authenticate as a hybrid user.
  - --rekey input "rsa:user=pub.pem,pq=user_pq.pub.pem" and
    "smartcard:user=cert.pem,pq=user_pq.pub.pem" move users to hybrid
    slots. A hybrid user must be given its pq= in a rekey: it is never
    silently made RSA-only.
  - --require-pq refuses to add, or keep in a rekey, an RSA-only or
    card-only user.
  - fdecrypt --list-users shows "RSA key + ML-KEM-1024" and "Smart Card +
    ML-KEM-1024" users; --json adds "quantum_resistant".
  - The file format is still 2026102. Releases 2026.102 to 2026.109 still
    decrypt these files with the password, the key file or an RSA-only
    user, list the users (the hybrid slots show as Unknown) and refuse to
    open as a hybrid user; their --add-rsa-key and --remove-user keep
    the hybrid users working, and their --rekey refuses such a file and
    leaves it unchanged. Upgrade every copy that opens the file as a
    hybrid user, or rekeys it, to 2026.110 first.
  - FIPS mode: a hybrid user needs a FIPS provider with ML-KEM. The RHEL
    FIPS provider (Red Hat's validated 3.0.7 module) has none, so in FIPS
    mode a hybrid user gets a clear error and the file still opens with
    the password or key file.
  - Each hybrid user takes about 2.3 KB of the key slot area (16384
    bytes by default, --static-data-size): about 6 hybrid users per file
    with a password slot.
  - New tests: console/linux/run_pq_tests.sh [old_build_dir ...]
    (SC_MODULE/SC_PIN/SC_CERT for a SoftHSM2 smart card user).
* fcrypt --add-rsa-key with the key on stdin (ssh-keygen -e ... |
  fcrypt --add-rsa-key) reads the whole pipe. It waited only 5 ms for
  the first bytes, so a slow producer gave "--add-rsa-key missing
  filename". The compatibility tests give older releases the key from a
  file, since they still have the 5 ms wait.
* FCRYPT_FIPS=1 with the rhel8 build (system OpenSSL 1.1.1k) on a host
  not in FIPS mode is refused like --fips (--no-fips overrides it), the
  same as the OpenSSL 3.5 builds when the FIPS provider cannot load. It
  was ignored before.
* The RHEL crypto policy. The OpenSSL 3.5 built into
  the rhel8_openssl35 build does not read the system crypto policy, so
  fcrypt reads /etc/crypto-policies/state/current itself, in every Linux
  build. fcrypt --version shows it. With the FUTURE policy, new RSA access
  (--add-rsa-key, hybrid users, rekey rewraps) needs RSA keys of at least
  3072 bits, and the error names the policy; existing users with 2048-bit
  keys can still decrypt, so nobody is locked out. DEFAULT, FIPS and LEGACY
  keep fcrypt's own 2048-bit minimum. fcrypt's algorithms are fixed and
  allowed by every policy (AES-256, HMAC-SHA256, PBKDF2-SHA256, RSA-OAEP
  SHA-256, ML-KEM-1024). FIPS mode is read from
  /proc/sys/crypto/fips_enabled, not from the policy, and the
  rhel8_openssl35 build refuses to run on a host in FIPS mode.
* Adding a user is all or nothing: --add-rsa-key and --add-smartcard-cert
  write the file to a temp file, check that it decrypts to the same data
  and rename it over the original, as --remove-user does, and take the
  same file lock (--lock-timeout, exit 4). They used to rewrite the key
  slot area in place.
* OpenSSL 3.5 LTS (11/18/2026: nothing is distributed on an
  OpenSSL older than the 3.5 LTS line, with one exception for FIPS on
  RHEL 8). RHEL 9 and 10 use the system OpenSSL 3.5 and Windows an
  OpenSSL 3.5.x LTS release. RHEL 8 has two builds in the Linux package;
  rhel8_openssl35 is the preferred build, and rhel8 is only for hosts that
  must run in FIPS mode:
  - rhel8_openssl35: OpenSSL 3.5 LTS (3.5.9) built in statically, for
    hosts not in FIPS mode, with hybrid users. Built with
    makefile_rhel8_openssl35 (OPENSSL35_PREFIX, see build_openssl35.sh).
  - rhel8: Red Hat's FIPS-validated system OpenSSL 1.1.1k, for hosts in
    FIPS mode (the exception). It has no hybrid (ML-KEM) users: the
    hybrid options give a clear error, and files with hybrid users still
    open with the password, key file or an RSA user. On a host in FIPS
    mode the system OpenSSL runs in FIPS mode, so FIPS mode is on and old
    format files are refused, as with the OpenSSL 3 FIPS mode.
  console/scripts/install_fcrypt.sh (in the Linux package) picks the build
  from /etc/redhat-release and /proc/sys/crypto/fips_enabled; dry run by
  default, --install to copy (~/bin, --system for /usr/local/bin).
  RHEL 8's openssl3 packages (3.5.5) come from EPEL, not Red Hat, and have
  no FIPS provider, so they are not used. The builds stop with an error
  for an OpenSSL older than 3.5 (except the rhel8 build), the programs
  refuse an older OpenSSL library at run time, and fcrypt --version shows
  the OpenSSL build. Each package README and these release notes state
  the OpenSSL version of every build.
* The file format is still 2026102: files from every earlier release
  decrypt with 2026.110, and 2026.102 and later decrypt files written by
  2026.110 with the password, key file or an RSA-only user.

RELEASE 2026.109: DATAREEL 6.4.1
--------------------------------
* The bundled DataReel library is updated to version 6.4.1 (the 6.4
  release of 11/17/2026 and the fixes on the DataReel 6.4.1 branch),
  from 6.3. DataReel 6.4.1 sets FD_CLOEXEC on gxSocket sockets, so
  programs that run child processes do not pass them open sockets, and
  fixes the 6.x thread code: a new thread is in the running state
  before it starts (a cancel made before it ran was lost), Linux timed
  waits use the monotonic clock (a system time change no longer
  shortens or stretches them), and the sleep calls no longer leave a
  mutex locked on every call. The
  6.x API is unchanged and fcrypt needed no code changes. The database
  core now has two more source files, gxdjrnl.cpp and gxdpcache.cpp,
  which console/project.mak builds for the Linux and Windows
  makefiles. See 3plibs/datareel/RELEASE_NOTES_6.2.txt through
  RELEASE_NOTES_6.4.1.txt.
* Fixes from DataReel 6.4 in the classes fcrypt uses: the rest of the
  6.x security sweep (sockets, TLS, the parsers and the 6.x-only
  modules); DiskFileB reads that get no bytes are reported as EOF or a
  read error instead of a full read, and file names of the maximum
  length no longer write past the name buffer; futils works on a copy
  of the path and uses memmove() for overlapping copies; the
  MemoryBuffer and gxString searches and inserts stay inside the
  buffer; the string compares keep the 2026.107 Linux and Windows
  order.
* The encrypted file format does not change. Files encrypted by every
  earlier release (2023.105 through 2026.108) decrypt with this
  release, and files from this release decrypt with 2026.102 and
  later.

RELEASE 2026.108: DATAREEL 6.3
------------------------------
* Built with the bundled DataReel 6.3 (datareel branch
  6.3-oodb-backport): the DataReel 7.2/7.3/7.3.1 database and security
  fixes ported to 6.x (damaged-file checks, bounded checksums and block
  lengths, journal recovery bounds, owner-only journal files) and a
  sweep of the 6.x string, buffer, file, config and log code. The
  encrypted file format is unchanged: 2026.107 and 2026.108 read each
  other's files.
* FC_parse_name_values() refuses a line with no name before "=". Such
  a line read past the end of the input (found by fuzzing). It affects
  --rekey input and record input from the Encrypted Password Database.
* Tests: run_keymgmt_tests.sh has 41 checks; the build, security,
  compatibility and migrate suites pass.

RELEASE 2026.107: SMART CARD LIST AND STRING ORDER
--------------------------------------------------
* String compares give the same order on Linux and Windows. The
  DataReel string compares (StringANCompare and others in strutil.cpp)
  passed signed char values to isdigit() and tolower(); for the bytes
  above 127 the Windows runtime result is undefined, so a database
  index (such as the Encrypted Password Database's) built on Linux was
  walked in a different order on Windows. The compares now give the
  glibc results on every platform, so Linux indexes keep their order.
  Encrypted files are not affected.
* fcrypt --smartcard-list lists the cards, cert IDs and PIN status with
  no login and no PIN, and --smartcard-match=cert.pem shows which card
  and cert ID hold a cert or public key. See FINDING THE SLOT AND CERT ID
  WITHOUT A PIN below.
* The same list is a C++ API in include/smart_card.h for programs such
  as the Encrypted Password Database GUI: SC_list_tokens() fills a
  std::vector<SC_TokenInfo> (slot, reader, label, manufacturer, model,
  serial, CKF_ token flags and PIN lengths, and a SC_CertInfo for each
  certificate or public key: ID, label, subject and issuer CN, expiry,
  key type and size, public key SHA-256), SC_spki_sha256() gives the
  SHA-256 of a cert's or key's SubjectPublicKeyInfo, and
  SC_match_public_keys() finds the card objects holding given keys.
  They only call C_GetSlotList, C_GetSlotInfo, C_GetTokenInfo and a
  public session's C_FindObjects: no C_Login, and the PIN safeguards
  are not used or changed. Every session is closed and the module
  finalized. The OpenSSL 1.x engine build (RHEL 8) returns SC_ERROR,
  listing is not supported there.
* console/linux/run_smartcard_list_tests.sh tests the list with three
  throwaway SoftHSM2 tokens (it refuses any other module) and counts
  the C_Login calls with pkcs11-spy; p11_flag_shim.c sets the locked,
  final try and low tries flags for the tests.

KEY MANAGEMENT IN RELEASE 2026.106
----------------------------------
* fcrypt --remove-user=name removes the RSA key or smart card access of
  a user (--remove-user-type=rsa|smartcard when the user has both).
  The file is written to a temp file, checked by decrypting it, flushed
  to disk and renamed over the original; a backup copy
  (name.backup-YYYYMMDD-HHMMSS.enc) is kept. The last key slot is never
  removed. Removing a user does not revoke a file key the user already
  recovered: run fcrypt --rekey after it.

* fcrypt --rekey gives the file a new random file key, a new salt and
  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 slot without a choice in
  the rekey input makes the rekey stop and list what is missing; no
  slot is dropped silently. The new file must decrypt to the same data
  before it replaces the original. See REKEY INPUT below.

* Key management can be authenticated with the password or key file
  (as --add-rsa-key), with --rsa-key=private_key.pem --rsa-key-username,
  or with --smartcard-cert (one card login through the existing single
  login path; the PIN safeguards of 2026.105 apply).

* --password-file, --password-fd, --rsa-key-passphrase-file,
  --rsa-key-passphrase-fd, --smartcard-pin-file and --smartcard-pin-fd
  in fcrypt, fdecrypt and fmigrate, as in the Encrypted Password
  Database: the secret is the first line, a file must be a regular file
  only you can read, the buffers are wiped. --password=, 
  --rsa-key-passphrase= and --smartcard-pin= still work but warn and are
  wiped from the process arguments after they are read.

* --access-log[=file] logs decrypts, user changes and rekeys to a
  per-user log (default ~/.fcrypt/logs/access.log, directory mode 700,
  file mode 600). Logging is off unless asked for. fdecrypt
  --verify-access-log checks the HMAC chain of a file's entries. See
  ACCESS LOG below.

* fdecrypt --check-version reports v1 (2023102/2023103) or v2
  (2026102) for each file without decrypting and without a smart card,
  and exits 5 if any file is v1. Decrypting a v1 file prints a warning
  that names fmigrate.

* Automation: --non-interactive, --quiet, --dry-run, --lock-timeout,
  --json (fdecrypt --check-version and --list-users) and stable exit
  codes, see AUTOMATION AND PRODUCTION USE below.

* Fixed: on Windows fdecrypt --stdout wrote stdout in text mode, which
  put a carriage return before every line feed of the decrypted data.

* File format: unchanged. A rekeyed file stores its key generation and
  rekey time in reserved header bytes 88-103 ("FCX1", generation,
  time), which 2026.105 and older versions write as zeros and never
  read; the header MAC covers them. 2026.105 decrypts files written by
  this release.

BEHAVIOR CHANGES IN RELEASE 2026.106
------------------------------------
* fdecrypt exits 2 when the password, key or RSA key does not open a
  file, 3 when the file does not exist, and fdecrypt --check-version
  exits 5 for a v1 file and 7 for a file that is not encrypted. Scripts
  that test for exit code 1 should test for non-zero.
* fcrypt and fdecrypt read a public or private key from stdin only for
  a bare --add-rsa-key or --rsa-key (no =file), so stdin is free for
  --password-fd=0 and the rekey input.

REKEY INPUT
-----------
fcrypt --rekey reads name=value lines from stdin, --rekey-fd=n or
--rekey-file=file (a file only you can read). Blank lines and lines
starting with # are skipped. In values \n is a newline, \t a tab and
\\ a backslash.

  password=<current password>      Keep the password slot with this password
                                   (implied when you authenticate with
                                   --password-file, --password-fd or --key)
  new-password=<password>          Give the password slot a new password
  drop-password=yes                Remove the password slot
  rsa:<user>=<public key file>     Rewrap the RSA slot of <user>
  smartcard:<user>=<cert file>     Rewrap the smart card slot, PEM or DER cert
  smartcard:<user>=card            Read the cert from the card in the reader
                                   (--smartcard-cert-id, --smartcard-slot), no PIN
  drop-rsa:<user>=yes              Remove the RSA slot of <user>
  drop-smartcard:<user>=yes        Remove the smart card slot of <user>

--rekey-new-password-file=file (a new file, mode 600) or
--rekey-new-password-fd=n makes a random password (64 hex digits) for
the password slot instead; it is written before the file is changed
and is never printed. A rekey that would leave no slot is refused.

Example, remove bob and rotate the key:

$ ./fcrypt --password-file=$HOME/.keys/pw --remove-user=bob secret.enc
$ printf 'rsa:alice=%s\n' $HOME/keys/alice.pub | ./fcrypt --password-file=$HOME/.keys/pw --rekey secret.enc

ACCESS LOG
----------
One line per entry, tab separated name=value fields:

  FCLOG1 time= user= host= pid= tool= file= id= auth= slot= action=
  record= result= detail= mac=

time is UTC, id is the file ID, action is open, add-user, remove-user,
rekey or access-log-rekey, result is ok or fail. No password, PIN or
file content is ever logged. mac is an HMAC-SHA256 chain per file ID,
keyed with a key derived from the file key, so an entry cannot be
changed, removed, reordered or inserted without --verify-access-log
noticing, unless the person has the file key. Entries written without
the key (a failed decrypt) are covered by the next tagged entry.
Entries after the last tagged entry, and removing whole entries from
the end, cannot be detected. After a rekey the entries of the file are
checked with the old key and tagged again with the new key. See
include/fckeymgmt.h for the details.

AUTOMATION AND PRODUCTION USE
-----------------------------
* --non-interactive (or --batch): never prompt. A missing password,
  passphrase, PIN or input is an error.
* --quiet: only errors.
* --dry-run (fcrypt --remove-user and --rekey): the new file is written
  and checked, then removed; the file is not changed.
* --lock-timeout=seconds: fcrypt --remove-user and --rekey take an
  advisory lock on file.lock (flock on Linux, LockFileEx on Windows) and
  wait this long (default 10) for another writer, then exit 4.
* --json: fdecrypt --check-version and --list-users.
* Errors go to stderr; requested output (--stdout data, --check-version,
  --list-users) goes to stdout.
* Exit codes: 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-version found a v1 file, 7 read or write error.

Secrets never belong in argv, shell history or temp files. Read them
from a file only you can read, or a pipe:

$ ./fdecrypt --password-fd=3 --stdout data.enc 3<$HOME/.keys/pw
$ ./fdecrypt --rsa-key=$HOME/.keys/id_rsa.pem --rsa-key-username=$USER --rsa-key-passphrase-file=$HOME/.keys/pp data.enc

Using AWS KMS and Secrets Manager

fcrypt has no AWS code. Pipe the secret straight into a -fd option.
Linux (bash):

$ aws kms decrypt --ciphertext-blob fileb://pw.enc --query Plaintext --output text | base64 -d | ./fdecrypt --password-fd=0 --stdout data.enc
$ aws secretsmanager get-secret-value --secret-id fcrypt/pw --query SecretString --output text | ./fdecrypt --password-fd=0 --stdout data.enc
$ aws secretsmanager get-secret-value --secret-id fcrypt/rsa-pass --query SecretString --output text | ./fdecrypt --rsa-key=$HOME/.keys/id_rsa.pem --rsa-key-username=$USER --rsa-key-passphrase-fd=0 --stdout data.enc

Windows (PowerShell):

PS> aws secretsmanager get-secret-value --secret-id fcrypt/pw --query SecretString --output text | .\fdecrypt.exe --password-fd=0 --stdout data.enc
PS> [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String((aws kms decrypt --ciphertext-blob fileb://pw.enc --query Plaintext --output text))) | .\fdecrypt.exe --password-fd=0 --stdout data.enc

The secret then never lands in argv, shell history or a temp file. Do
not use "--password=$(aws ...)", which puts it on the command line.
AWS CloudHSM's PKCS#11 library may work with --smartcard-provider,
but it is untested.

SMART CARD SAFEGUARDS IN RELEASE 2026.105
-----------------------------------------
Tested with a DoD CAC through ActivClient (Windows) and OpenSC (RHEL
10 and Windows), and with a YubiKey PIV key through OpenSC.

* PIN safeguards, so testing or a typing mistake does not lock a CAC
  or PIV card (they lock after 3 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 no longer
    cut short), has a control character such as a tab or carriage
    return, or is outside the card's PIN length.
  - The card's PIN flags are read first. A locked PIN is refused.
    When the card reports one PIN try left or low PIN tries, the PIN
    is only sent with --smartcard-allow-final-try or
    --smartcard-allow-pin-count-low. Some modules, possibly
    ActivClient, do not report the PIN tries.
  - After a wrong PIN the error says one PIN try was used and what
    the card reports about the tries left.
* --smartcard-slot=N uses only the card in PKCS#11 slot N. With more
  than one card inserted (a CAC and a YubiKey both have ID 03 with
  OpenSC), a cert ID found on more than one card, or on no card, is
  refused and no PIN is sent. The error lists the slots.
* smartcard_list.sh (Linux) and smartcard_list.bat (Windows) list the
  readers, cards, PIN flags and every cert and key with its ID, label
  and type, without a PIN, so you can find the slot and the cert ID.
* The encrypted file format is unchanged.

SECURITY FIXES IN RELEASE 2026.104
----------------------------------
* fcrypt, fdecrypt and fmigrate refuse a --key file or a private
  --rsa-key file that is not a regular file owned by you with no group
  or other access, like ssh does for private keys. Run chmod 600 on
  the file.

* The * echo of password, passphrase and PIN prompts is written to
  stderr instead of stdout, so it is not mixed with program output.

* The bundled DataReel 6.1 library stops B-tree walks that would loop
  on a damaged or crafted index file, guards its data file scans
  against zero block lengths, and adds gxDatabase::SetWriteHook(). See
  3plibs/datareel/RELEASE_NOTES_6.1.txt.

* The PBKDF2, KBKDF and AES-256-CBC functions of the 2026102 file
  format are exported as FC_pbkdf2_sha256(), FC_kbkdf_sha256(),
  FC_aes256_cbc() and FC_rand_bytes() for other programs, such as the
  Encrypted Password Database.

* The encrypted file format is unchanged.

SECURITY FIXES IN RELEASE 2026.103
----------------------------------
* The bundled DataReel library is updated to version 6.1. DataReel 6.1
  checks the B-tree node key counts, B-tree header key size and node
  order, and the object member counts and lengths that it reads from
  database and index files. Damaged or crafted files are rejected
  instead of overflowing memory. See 3plibs/datareel/RELEASE_NOTES_6.1.txt.

* fcrypt, fdecrypt and fmigrate no longer loop forever at 100% CPU when
  a password, passphrase or PIN prompt reaches the end of its input,
  for example when stdin is /dev/null or a closed pipe in a script.
  Input that ends without a newline is used as typed, and empty input
  is an error.

* The encrypted file format is unchanged. Files made by 2026.102 and
  2026.103 are the same, and fdecrypt still decrypts files from every
  earlier release.

REMOVED RHEL 6 AND 7 SUPPORT
----------------------------
Release 2026.103:

* RHEL 6 and RHEL 7 builds are no longer supported. makefile_rhel6 and
  makefile_rhel7 are removed, along with the RHEL 6 and 7 cases in
  linux.env, smart_card.cpp and run_build_tests.sh. Both releases are
  past the end of Red Hat support and ship OpenSSL 1.0.x, which no
  longer gets security fixes.

* Supported Linux builds are RHEL 8, 9 and 10, with RHEL 10 the
  default.

* Backwards compatibility is unchanged: fdecrypt still decrypts files
  encrypted by every earlier fcrypt release, including files made on
  RHEL 6 and 7, and fmigrate still converts them to the 2026102 format.
  Copy such files to a RHEL 8, 9 or 10 host to decrypt them.

FIPS 140-3 MODE AND FILE FORMAT 2026102 IN RELEASE 2026.102
----------------------------------------------------------
Release 2026.102 adds FIPS 140-3 mode and a new encrypted file format,
version 2026102, that uses only FIPS approved algorithms:

	PBKDF2-HMAC-SHA256 (SP 800-132), 600000 iterations by default
	A random 256 bit key for each file
	AES-256 Key Wrap (SP 800-38F) for the password or key file
	RSA-OAEP with SHA-256 for RSA keys and smart cards, 2048 bit
	minimum
	KBKDF with HMAC-SHA256 (SP 800-108) for the file's working keys
	AES-256-CBC with HMAC-SHA256 on every 64 KB record
	(encrypt-then-MAC)

Every record and the header, including the list of users, is
authenticated, so changed, removed, reordered, added or truncated data
is detected before any output is kept.

Backwards compatibility:

* fdecrypt still decrypts files from every older release. No switches
  are needed outside FIPS mode.

* fcrypt writes only the 2026102 format. Older releases cannot decrypt
  these files, so upgrade fdecrypt everywhere the files are read.

* fcrypt --add-rsa-key and --add-smartcard-cert still work on files
  from older releases, outside FIPS mode.

* fdecrypt --iter applies only to files from older releases. New files
  store their iteration count.

FIPS mode is on when:

* --fips is given, or
* FCRYPT_FIPS=1 is set, or
* the system is in FIPS mode: /proc/sys/crypto/fips_enabled is 1 on
  Linux, the "System cryptography: Use FIPS compliant algorithms"
  policy is enabled on Windows, or the OpenSSL configuration sets
  fips=yes.

In FIPS mode every crypto operation uses only the OpenSSL FIPS
provider. If the FIPS provider cannot be loaded or fails its self-test,
the programs stop with an error. "fcrypt --version" shows the mode and
the provider in use.

In FIPS mode fdecrypt refuses files from older releases, because their
format uses algorithms that are not FIPS approved. To decrypt one, run
fdecrypt with --no-fips, which turns FIPS mode off for that run, even
on a system in FIPS mode:

$ ./fdecrypt --no-fips --password testfile.enc

To convert old files to the 2026102 format, use fmigrate. See
CONVERTING OLD FILES WITH FMIGRATE below.

In FIPS mode a private RSA key with a passphrase must be in PKCS#8
format, since the older PEM format derives its key with MD5. To convert
a key, including an SSH-RSA key:

$ openssl pkcs8 -topk8 -v2 aes-256-cbc -v2prf hmacWithSHA256 -in ~/.ssh/id_rsa -out ~/.keys/id_rsa_pkcs8.pem
$ chmod 600 ~/.keys/id_rsa_pkcs8.pem

FIPS mode needs OpenSSL 3.0 or later with a FIPS provider:

* RHEL 9 and 10: enable FIPS mode with "fips-mode-setup --enable" and
  reboot. The system OpenSSL FIPS provider is used.

* RHEL 8: install the rhel8 build (install_fcrypt.sh picks it on a host
  in FIPS mode). It uses Red Hat's FIPS-validated system OpenSSL 1.1.1,
  which runs in FIPS mode on a host in FIPS mode; --fips is refused on a
  host that is not. The rhel8_openssl35 build has no FIPS provider: on a
  host in FIPS mode it refuses to run (FIPS provider not found) unless
  given --no-fips, and install_fcrypt.sh warns if it is chosen there.
  Tested 11/19/2026 on a RHEL 8.10 host in FIPS mode: the rhel8 build
  reports FIPS mode on and passes the build, keymgmt, security and
  compatibility tests. Give it RSA keys with a passphrase in PKCS#8
  format: in FIPS mode the RHEL 8 openssl command cannot make or read a
  traditional (MD5 based) PEM key with a passphrase either.

* Windows: build the OpenSSL 3.5.x LTS FIPS provider, see FIPS MODE ON
  WINDOWS in README_windows_openssl.txt.

For FIPS 140-3 compliance the FIPS provider version must have a CMVP
certificate. On Linux use the FIPS provider that comes with the OS. On
Windows use the FIPS provider from the OpenSSL 3.5.x LTS release used
for the build, and check the validated versions at
https://openssl-library.org/source/ before relying on FIPS mode for
compliance.

SECURITY UPDATE IN RELEASE 2025.105
-----------------------------------
Release 2025.105 fixes security problems found in a code review. All
users should upgrade. The file format is unchanged: files encrypted by
older releases decrypt with this release, and files encrypted by this
release decrypt with older releases.

* fdecrypt no longer accepts forged files. Older releases accepted a
  specially made file under any password.

* Restored file paths. Without --outfile, fdecrypt restores the path
  stored in the encrypted file relative to the current directory or
  --outdir. Leading /, drive letters and UNC prefixes are removed, and
  stored paths with .. are rejected. To restore the exact stored path,
  for example a full restore from a backup, use --absolute-path. To
  restore only the file name use --no-path.

  Example: a file encrypted as /home/user/docs/report.txt is restored to
  ./home/user/docs/report.txt by default, to /home/user/docs/report.txt
  with --absolute-path, and to ./report.txt with --no-path.

* fdecrypt does not overwrite existing files unless -o is given.

* Decrypted files are created readable only by their owner, and are
  written to a temp file that is renamed only after the whole file
  decrypts and passes its integrity checks. Nothing is left behind if a
  file fails to decrypt.

* Files encrypted with this release carry a whole-file integrity check,
  so removed, reordered, added or truncated data blocks are detected.
  Files from older releases are still checked block by block.

* Files encrypted with mode 0 (no encryption, for testing) need the
  fdecrypt --allow-unencrypted switch.

* fcrypt --iter must be at least 1000. (Release 2026.102: 1000 to
  10000000, default 600000.)

* Memory safety fixes for long file names, RSA user data stored in the
  encrypted file, console input and key file reads.

Run console/linux/run_security_tests.sh, run_compat_tests.sh and
run_migrate_tests.sh to test a build. Give run_compat_tests.sh and
run_migrate_tests.sh the console/linux directories of older release
builds. Set FCRYPT_FIPS=1 to run them in FIPS mode.

QUANTUM-RESISTANT USERS (2026.110)
----------------------------------
A hybrid user's key slot needs both the user's RSA key (or smart card)
and the user's ML-KEM-1024 key. The file key is wrapped with AES-256
Key Wrap under KEK = KBKDF-HMAC-SHA384(ss || r, "fcrypt hybrid key
slot", slot type || user name || SHA-384(RSA ciphertext || ML-KEM
ciphertext)): ss is the ML-KEM-1024 shared secret, and r is 32 random
bytes encrypted with RSA-OAEP (SHA-256) for the RSA key or card cert.
The RSA and ML-KEM ciphertexts are kept in part slots of at most 1008
bytes, so older releases can still read the key slot area. See
include/fcfile.h.

Example: give alice hybrid access to secret.enc.

alice:
$ fcrypt --generate-pq-key=$HOME/.keys/alice_pq --pq-key-passphrase-file=$HOME/.keys/pq_pass
(gives $HOME/.keys/alice_pq and $HOME/.keys/alice_pq.pub.pem; send the
.pub.pem and her RSA public key to the file owner)

the file owner:
$ fcrypt --password-file=$HOME/.keys/pw --add-rsa-key=alice.pub --rsa-key-username=alice --add-pq-public-key=alice_pq.pub.pem secret.enc

alice:
$ fdecrypt --rsa-key=$HOME/.keys/alice.pem --rsa-key-username=alice --pq-key=$HOME/.keys/alice_pq --pq-key-passphrase-file=$HOME/.keys/pq_pass secret.enc

Move every RSA user of a file to a hybrid user:
$ printf 'rsa:alice=alice.pub,pq=alice_pq.pub.pem\nrsa:bob=bob.pub,pq=bob_pq.pub.pem\n' | fcrypt --password-file=$HOME/.keys/pw --rekey secret.enc

Smart cards (DoD CAC, PIV) hold RSA keys only, so the card is the RSA
half and the ML-KEM key comes from the user's key file:
$ fcrypt --password-file=$HOME/.keys/pw --add-smartcard-cert --smartcard-username=alice --smartcard-cert-id=03 --add-pq-public-key=alice_pq.pub.pem secret.enc
$ fdecrypt --smartcard-cert --smartcard-username=alice --smartcard-cert-id=03 --pq-key=$HOME/.keys/alice_pq secret.enc

TO BUILD THE FCRYPT AND FDECRYPT PROGRAMS FOR WINDOWS
-----------------------------------------------------
For Windows the current release supports Microsoft Visual Studio 2022 or 2026. 

For instructions on how to install Microsoft Visual Studio 2022 please
see the following readme file: README_VisualStudio_2022.txt 

For instructions on how to install Microsoft Visual Studio 2026 please
see the following readme file: README_VisualStudio.txt 

The Windows build requires the OpenSSL library. Use only an OpenSSL
3.5.x LTS release, built as 64-bit x64 (and as 32-bit x86 only for
legacy builds). The build stops with an error for any other OpenSSL
version. FIPS mode also needs the OpenSSL 3.5.x FIPS provider,
fips.dll, see FIPS MODE ON WINDOWS in README_windows_openssl.txt.

For instructions on how to build OpenSSL for Windows please see the
following readme file: README_windows_openssl.txt 

For instructions on how to build Windows 11 or 2025 server development
VM please see the following readme file: README_windows_setup.txt 

To build the Windows executables download the latest release or clone
the GIT repo. In the Windows build example below this document will
assume we placed the code on a data drive in a git directory.  

On the data drive change your directory to the fcrypt build subdirectory:  
> E:
> cd E:\git\fcrypt\console\msvc

Setup your Visual Studio environment for a 64-bit x64 build, which is
the default:

> msvc.bat

For a 32-bit x86 build for legacy systems use msvc32_vs2026.bat
instead of msvc.bat. Use a new command prompt and run "nmake clean"
when you switch between 32-bit and 64-bit builds. Files encrypted by
the 32-bit and 64-bit builds use the same file format, so either build
decrypts files from the other and from older releases.

Edit the msvc.env file to setup the path to your OpenSSL and ZLIB
builds. The 64-bit paths are used by default and the 32-bit paths are
used when the ENV is set with msvc32_vs2026.bat:

> notepad msvc.env

!IF "$(VSCMD_ARG_TGT_ARCH)" == "x86"
# Setup path to ZLIB
ZCODE_DIR = ../../../../3plibs/zlib32-1.3.1

# Setup path to OPENSSL library
OPENSSL_DIR = ../../../../3plibs/openssl32
!ELSE
# Setup path to ZLIB
ZCODE_DIR = ../../../../3plibs/zlib64-1.3.1

# Setup path to OPENSSL library
OPENSSL_DIR = ../../../../3plibs/openssl64
!ENDIF

Run nmake to build the executables:

> nmake

To run a simple test of the utilities:

> fcrypt.exe testfile.txt

The above command will encrypt the input file and create a .enc file
with the same file name. 

To decrypt the file:

> fdecrypt.exe testfile.enc 

This will decrypt the file creating the unencrypted file using the
original file name.  

nmake also builds fmigrate.exe, which converts files from older
releases to the 2026102 format. See CONVERTING OLD FILES WITH FMIGRATE.


TO BUILD THE FCRYPT AND FDECRYPT PROGRAMS FOR LINUX
---------------------------------------------------
$ mkdir -pv ${HOME}/git
$ cd ${HOME}/git
$ wget https://datareel.com/downloads/fcrypt/fcrypt-<version>.tar.gz
$ tar xzf fcrypt-<version>.tar.gz
$ mv fcrypt-<version> fcrypt
$ cd fcrypt/console/linux
$ make

The default Linux build is for RHEL 10 and uses the operating system's
OpenSSL (sudo dnf install gcc-c++ make openssl-devel). For an older
RHEL release use the makefile for that release:

$ make -f makefile_rhel9     (or makefile_rhel8)

Since 2026.110 every build needs OpenSSL 3.5 LTS or later. RHEL 9 and
10 have it as the system OpenSSL (openssl-devel). RHEL 8 has two builds:

For hosts not in FIPS mode, OpenSSL 3.5 LTS built in. Build the static
OpenSSL 3.5.9 once (the tarball's sha256 is pinned in the script), then
fcrypt:

$ sudo dnf install gcc-c++ make perl perl-IPC-Cmd perl-Time-Piece curl
$ bash build_openssl35.sh $HOME/openssl-3.5.9
$ make -f makefile_rhel8_openssl35 OPENSSL35_PREFIX=$HOME/openssl-3.5.9

For hosts in FIPS mode, Red Hat's FIPS-validated system OpenSSL 1.1.1
(no hybrid ML-KEM users):

$ sudo dnf install gcc-c++ make openssl-devel
$ make -f makefile_rhel8

Use a separate copy of the source for each, or make clean between them.

RHEL 6 and 7 builds are no longer supported, see REMOVED RHEL 6 AND 7
SUPPORT below.

Run "make clean" first when you switch between RHEL builds.

To run a simple test of the utilities:

$ ./fcrypt testfile.txt

The above command will encrypt the input file and create a .enc file with the same file name.

To decrypt the file:

$ ./fdecrypt testfile.enc 

This will decrypt the file creating the unencrypted file using the original file name. 
If the file was encrypted with a directory path, the path is recreated
under the current directory. Use -o to overwrite an existing file.

The build also makes fmigrate, see CONVERTING OLD FILES WITH FMIGRATE.

CONVERTING OLD FILES WITH FMIGRATE
----------------------------------
fmigrate converts files encrypted by releases before 2026.102 to the
2026102 file format. Using it is optional: fdecrypt still decrypts old
files outside FIPS mode. Convert old files to use them in FIPS mode,
or to give them the stronger protection of the new format.

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 and decrypted again to check it against a SHA-256
hash of the data. Only then does it replace the old file. If anything
fails, the old file is left as it was.

The new file keeps the stored file name and opens with the same
password or key file as the old one.

To find old files:

$ ./fmigrate --check *.enc
$ ./fmigrate --check -R ${HOME}/encrypted_files

To convert files in place:

$ ./fmigrate --password testfile.enc
$ ./fmigrate --key=${HOME}/.keys/master.key -R ${HOME}/encrypted_files

To keep the old files and write the new files to another directory:

$ ./fmigrate --key=${HOME}/.keys/master.key --outdir=${HOME}/new_files testfile.enc

Files whose only access is an RSA key, for example after the temp key
was removed, can be converted with that key:

$ ./fmigrate --rsa-key=${HOME}/.ssh/id_rsa --rsa-key-username=testuser testfile.enc

The RSA user who converts the file keeps RSA access to the new file.
Other RSA and smart card users of the old file cannot be carried over,
because the old file holds only their encrypted copy of the key, not
their public key. fmigrate lists them. Add each one again with fcrypt
--add-rsa-key or --add-smartcard-cert, using the same password or key
file as the old file. Files converted with an RSA key keep the
password or key file the old file was encrypted with.

If the old files were encrypted with fcrypt --iter, give fmigrate the
same --iter. Use --new-iter to set the PBKDF2 iterations of the new
files, 600000 by default.

Reading the old format needs algorithms FIPS mode does not allow, so on
a system in FIPS mode run fmigrate with --no-fips. The new files can
then be decrypted in FIPS mode.

USING A MASTER KEY FOR AES SYMMETRIC FILE ENCRYPTION
----------------------------------------------------
Create a master file encryption key:

$ dd if=/dev/urandom of=master.key bs=1 count=128
$ chmod 600 master.key

Encrypt the file:

> ./fcrypt --key=master.key testfile.txt

Decrypt the file:

> ./fdecrypt --key=master.key testfile.enc

USING RSA KEYS FOR MULTI USER ACCESS TO THE ENCRYPTED FILE
----------------------------------------------------------
Use openssl to make some test keys:

> mkdir ${HOME}/.keys
> chmod 700 ${HOME}/.keys
> openssl genrsa -aes256 -out ${HOME}/.keys/private.pem 2048
> chmod 600 ${HOME}/.keys/private.pem
> openssl rsa -in ${HOME}/.keys/private.pem -outform PEM -pubout -out ${HOME}/.keys/public.pem

Create a master file encryption key:

> dd if=/dev/urandom of=${HOME}/.keys/master.key bs=1 count=128
> chmod 600 ${HOME}/.keys/master.key

Encrypt a file:

> ./fcrypt --key=${HOME}/.keys/master.key testfile.txt

Add your RSA key:

> ./fcrypt --key=${HOME}/.keys/master.key --add-rsa-key=${HOME}/.keys/public.pem --rsa-key-username=testuser testfile.enc

Decrypt the file using your private key that is passphrase protected
and ensure you private key is never shared with anyone:

> ./fdecrypt --rsa-key=${HOME}/.keys/private.pem --rsa-key-username=testuser testfile.enc

USING SSH-RSA FOR MULTI USER ACCESS TO THE ENCRYPTED FILE
---------------------------------------------------------
Create a temp key to encrypt the file

> mkdir ${HOME}/.keys
> chmod 700 ${HOME}/.keys
> dd if=/dev/urandom of=${HOME}/.keys/temp.key bs=1 count=128
> chmod 600 ${HOME}/.keys/temp.key

Encrypt a file:

> ./fcrypt --key=${HOME}/.keys/temp.key testfile.txt

Add your SSH-RSA key to the encrypted file:

> ssh-keygen -f ~/.ssh/id_rsa.pub -m 'PKCS8' -e | ./fcrypt --key=${HOME}/.keys/temp.key --add-rsa-key --rsa-key-username=testuser testfile.enc

Decrypt the file using your SSH-RSA private key:

> ./fdecrypt --rsa-key=${HOME}/.ssh/id_rsa --rsa-key-username=testuser testfile.enc

Have your users that need access to the encrypted file give you a copy
of their public ~/.ssh/id_rsa.pub SSH-RSA key.

Once you have a copy of all the public RSA keys that need access to the
encrypted file add each key. After all the user are added you can remove
the file encrytion key:

> rm -fv ${HOME}/.keys/temp.key


All users will only be able to decrypt the file using their SSH-RSA
private key. All user should ensure their private key is passphrase
protected and never shared with anyone.  

For users that do not have passphrase protected keys a passphrase can be
added with the following command:

> ssh-keygen -p -f ~/.ssh/id_rsa

USING A SMART CARD FOR MULTI USER ACCESS TO THE ENCRYPTED FILE
--------------------------------------------------------------
Create a temp key to encrypt the file

> mkdir ${HOME}/.keys
> chmod 700 ${HOME}/.keys
> dd if=/dev/urandom of=${HOME}/.keys/temp.key bs=1 count=128
> chmod 600 ${HOME}/.keys/temp.key

Encrypt a file:

> ./fcrypt --key=${HOME}/.keys/temp.key testfile.txt

Make sure your smart card is in the card reader and you know the ID
number for the cert you are using. You can list the smart card objects
with the 'pkcs11-tool --list-objects' command. 

Add your smart card cert to the encrypted file:

> ./fcrypt --key=${HOME}/.keys/temp.key --add-smartcard-cert --smartcard-cert-id=01 --smartcard-username=testuser testfile.enc

Decrypt the file using your smart card:

> ./fdecrypt --smartcard-cert --smartcard-cert-id=01 --smartcard-username=testuser testfile.enc

You will be prompted to enter your smart card pin.

Have your users that need access to the encrypted file add their smart
card cert. 

Once you have all the users added that need access to the encrypt file
add each key. After all the user are added you can remove 
the file encryption key:

> rm -fv ${HOME}/.keys/temp.key

All users will only be able to decrypt the file using their smart
card.

USING A SMART CARD EXPORTED CERT file FOR MULTI USER ACCESS TO THE ENCRYPTED FILE
---------------------------------------------------------------------------------
Create a temp key to encrypt the file

> mkdir ${HOME}/.keys
> chmod 700 ${HOME}/.keys
> dd if=/dev/urandom of=${HOME}/.keys/temp.key bs=1 count=128
> chmod 600 ${HOME}/.keys/temp.key

Encrypt a file:

> ./fcrypt --key=${HOME}/.keys/temp.key testfile.txt

For all users that need access each user will need to use the p11tool
to export a PEM formated X509 cert that contains the public key. 

Add your cert file to the encrypted file:

> ./fcrypt --key=${HOME}/.keys/temp.key --add-smartcard-cert-file=/usr/local/sc_certs/testuser_cert.pem  --smartcard-username=testuser testfile.enc

Decrypt the file using your smart card:

> ./fdecrypt --smartcard-cert --smartcard-cert-id=01 --smartcard-username=testuser testfile.enc

You will be prompted to enter your smart card pin.

Add all your users that need access to the encrypted file.

Once you have all the users added that need access to the encrypt file
add each key. After all the user are added you can remove 
the file encryption key:

> rm -fv ${HOME}/.keys/temp.key

All users will only be able to decrypt the file using their smart
card.

SMART CARD REQUIREMENTS AND OPENSSL 3
-------------------------------------
Builds that use OpenSSL 3, which includes RHEL 9, RHEL 10 and Windows,
load the smart card PKCS#11 module directly. The OpenSSL pkcs11 engine
(libp11 or the openssl-pkcs11 package) is not used or needed. The
OpenSSL ENGINE API is deprecated in OpenSSL 3 and is not built into
RHEL 10 or the OpenSSL 3.5.x LTS builds used for Windows. Builds that
use OpenSSL 1.x, such as RHEL 8, still use the pkcs11 engine.

Files given smart card access by earlier fcrypt releases still decrypt
with the same card. The smart card key data stored in the file has not
changed.

Linux, RHEL 9 and RHEL 10, using the operating system's OpenSSL:

> sudo dnf install opensc pcsc-lite
> sudo systemctl enable --now pcscd

The default PKCS#11 module is /usr/lib64/opensc-pkcs11.so. Use
--smartcard-provider to select a different PKCS#11 module.

Windows, using only an OpenSSL 3.5.x LTS build, see
README_windows_openssl.txt:

Install OpenSC from https://github.com/OpenSC/OpenSC/releases using
the 64-bit installer for the default 64-bit build (the 32-bit installer
is only for 32-bit legacy builds). The default PKCS#11 module is:

"C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll"

With OpenSSL 3 builds --smartcard-engine is accepted for older scripts
but is ignored.

The --smartcard-cert-id value can be the hex ID of the key and cert on
the card, such as 01, or any of these forms:

  id_01                Hex ID
  label_name           Object label
  4:01, slot_4-id_01   PKCS#11 slot ID and hex ID
  slot_4-label_name    PKCS#11 slot ID and object label
  "pkcs11:id=%01"      PKCS#11 URI with id= and/or object=

With more than one card or token inserted (for example a CAC and a
YubiKey, which both have ID 03 with OpenSC), select the card with
--smartcard-slot=N, the slot ID shown in parentheses by
pkcs11-tool --list-token-slots (decimal or 0x hex). Only that slot is
used. Without it, a cert ID found on more than one card, or on no card
when several are inserted, is refused and no PIN is sent.

List the objects on the card with:

> pkcs11-tool --list-objects

Cards that cannot do RSA-OAEP with SHA-256 themselves, such as PIV
cards, are supported by decrypting with raw RSA on the card and
removing the OAEP padding in fcrypt.

DOD CAC and PIV cards: OpenSC supports CAC and PIV cards. With OpenSC
the PIV Authentication key is ID 01, Digital Signature is ID 02 and
Key Management (encryption) is ID 03. Use the encryption key, ID 03,
for files you need to keep, since DOD can recover escrowed encryption
keys when a card is replaced and the other keys cannot be recovered.
Add access for a new card before the old card expires. A wrong PIN is
never retried, CAC cards lock after three wrong PINs. After any failed
card login no more logins are made in that run. The PIN is not sent
when it is empty or too long, or when the card reports its PIN is
locked; when the card reports low PIN tries or one try left, use
--smartcard-allow-pin-count-low or --smartcard-allow-final-try to send
it. Some modules do not report the PIN tries, check them with the card
software first. Keys that ask
for the PIN before every use are supported. On Windows, if ActivClient
is installed, fcrypt uses the ActivClient PKCS#11 module by default:

"C:\Program Files\HID Global\ActivClient\acpkcs211.dll"

otherwise it uses OpenSC. Use --smartcard-provider to pick one. The
key IDs from ActivClient are not the same as the OpenSC IDs above, so
list them with the OpenSC pkcs11-tool and use that ID or label_name:

> pkcs11-tool --module "C:\Program Files\HID Global\ActivClient\acpkcs211.dll" --list-objects

ActivClient uses a long hex ID, for example a 64 character SHA-256
hash, and labels such as "Encryption - name". Quote a label with
spaces:

> fdecrypt --smartcard-cert --smartcard-username=testuser "--smartcard-cert-id=label_Encryption - name" testfile.enc

Smart card access added on Linux with OpenSC works on Windows with
ActivClient for the same card and key, only the cert ID may differ.
ActivClient does not do RSA-OAEP with SHA-256 on the card, fcrypt uses
raw RSA on the card for it. A YubiKey used with ActivClient needs the
PIV CHUID and CCC objects, which ykman can write:

> ykman piv objects generate chuid
> ykman piv objects generate ccc

FINDING THE SLOT AND CERT ID WITHOUT A PIN
------------------------------------------
List the readers, cards and certs without a PIN:

  fcrypt --smartcard-list [--smartcard-provider=module]
           lists every card (reader slot, token label, manufacturer,
           model, serial, the PIN status and PIN length) and the
           certificates and public keys the card shows before login
           (cert ID, label, RSA or EC and the key size, subject, issuer
           and expiry, and the SHA-256 of the public key). It never logs
           in and never asks for a PIN. Add --smartcard-match=cert.pem
           (PEM or DER cert or public key, more than once is allowed) to
           show which card and cert ID hold that key, for example:
             fcrypt --smartcard-list --smartcard-match=mycert.pem
  Linux:   console/scripts/smartcard_list.sh [module]
           (the default module is /usr/lib64/opensc-pkcs11.so)
  Windows: smartcard_list.bat (in the Windows package, or
           console/msvc/smartcard_list.bat), lists the cards through
           ActivClient and OpenSC and writes smartcard_list.log in
           %TEMP%

Each slot is shown as "Slot n (0xID)": use the 0xID with
--smartcard-slot. Under each slot, use the ID or label of the
encryption cert:

  OpenSC (CAC, PIV, YubiKey):  ID 03, "Certificate for Key Management"
  ActivClient (CAC):           the long hex ID, or the label
                               "Encryption - LAST.FIRST.MIDDLE.1234567890"
                               as label_Encryption - LAST.FIRST...

Do not use ID 01 (PIV Authentication), 02 (Digital Signature) or 04
(Card Authentication). For a YubiKey, ID 03 is PIV slot 9D.

The card key must be RSA. EC keys (P-256 or P-384, found on some PIV
cards and YubiKey slots) are refused, the file key is wrapped with RSA.

Remote Desktop: when smart card redirection is on in the RDP client
(Local Resources, More, Smart cards), programs in the RDP session see
only the client's cards, not the readers of the remote computer or
VM. Turn it off or use the computer's own console to use its readers.
