GUN-101-TPM: Hardware-bound File Encryption
Platform Support
GUN-101-TPM is currently Linux-first. TPM 2.0 hardware binding is fully supported on Linux. Windows support is work in progress — a native TBS-based backend exists but its seal/unseal is still emulated and not yet provably hardware-bound. macOS is not yet supported.
- Linux: Fully supported with
/dev/tpm0or/dev/tpmrm0 - Windows: Work in progress — native TBS-backed backend (
tbs.dll, x64/ARM64) withcheck-tpmand fingerprint support, but seal/unseal currently uses a software-emulated blob rather than genuine TPM binding - macOS: Not supported — most Mac hardware lacks TPM 2.0 chips; would require a Secure Enclave-based backend (planned for future)
Installation implications:
pip install gun101-tpm[tpm]installs cleanly on any OS via the conditional dependencytpm2-pytss>=2.3.0; sys_platform == 'linux'inpyproject.toml- On non-Linux OS, the runtime check
_check_platform_supported()intpm.pyraises a clearRuntimeErrorwithout importingtpm2_pytss - The non-TPM GUN-101 modes (password-only) work cross-platform
What problem does this solve?
Traditional encryption protects data with a password alone. If that password leaks or is brute-forced, anyone can decrypt the file on any machine. What if the encrypted data should only be readable on the specific device that produced it?
GUN-101-TPM solves this by binding encrypted files to the physical TPM 2.0 chip of the machine that created them. Even with the correct password, decryption fails on any other machine, because the encryption key is sealed inside the Trusted Platform Module (TPM 2.0) hardware and cannot be exported. This makes it ideal for protecting sensitive data on a single trusted device against password theft, key exfiltration, and offline decryption on attacker-owned hardware.
Important Security Notes
- Hardware-bound: Without the original TPM, decryption is impossible — even with the password.
- Two-layer protection: Requires both the password-derived key and the TPM seal.
- No recovery: If your machine's TPM fails or you lose the machine, you cannot recover your files. Do not use this mode for files that require portability or long-term archival without backup.
- Not quantum-resistant: AES-256 provides ~128-bit post-quantum security; TPM sealing varies by vendor.
- TPM 2.0 chip and proper drivers are required.
- A random data encryption key (DEK) is generated for each file.
- The DEK is encrypted with a Key Encryption Key (KEK) derived from your password via Argon2id.
- The encrypted DEK is sealed to the TPM using a symmetric key bound to the TPM.
- The file itself is encrypted with the DEK using AES-256-GCM.
- The DEK is sealed to the TPM. The encrypted container contains no TPM fingerprint or other encrypting-device identifier; during decryption, the TPM itself must successfully unseal the DEK.
- TPM 2.0 chip
tpm2-pytssPython package (optional install)
Installation
# Install base package (without TPM support)
pip install gun101-tpm
# Install with TPM support
pip install gun101-tpm[tpm]
Usage
Check TPM Availability
gun101tpm check-tpm
Encrypt a File
gun101tpm encrypt secret.pdf
# Enter password when prompted
# Output: secret.pdf.gun101
Decrypt a File
gun101tpm decrypt secret.pdf.gun101
# Enter password when prompted
# Output: secret.pdf (if on the same machine)
When to Use Which GUN-101 Mode
| Mode | Key Binding | Portability | Use Case |
|---|---|---|---|
| GUN-101 | Password only | High | General purpose, cross-device |
| GUN-101-GKP | Password + GPG key | Medium | Shared environments with key distribution |
| GUN-101-TPM | Password + TPM 2.0 seal | None | Maximum security on a single trusted device |
Documentation
- Command-line and Python interface
- Build Guide
- Assurance Case
- Continuity Plan
- Dependency Policy
- Secure MFA Policy
- Release Verification
- Secrets Policy
- System Design
- Governance and Access Roles
- Web Hardening Record
- Security Assessment
- Security Model
- Threat Model
- TPM Setup Guide
- Upgrade Guide
- Vulnerability Exploitability (VEX) Policy
License
MIT License - see LICENSE file for details.
Reporting Issues
Please report reproducible bugs and enhancement requests via the GitHub issue tracker. For security vulnerabilities, do not open a public issue; follow the private vulnerability reporting process.
Contributing
See CONTRIBUTING.md for setup instructions, coding standards, security-specific contribution requirements, testing expectations, and pull request guidance.
Metadata
Release files for gun101-tpm 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gun101_tpm-1.1.0.tar.gz | 28.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gun101_tpm-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 54.5 kB
Release files / gun101_tpm-1.1.0.tar.gz
| Download URL | gun101_tpm-1.1.0.tar.gz |
|---|---|
| Size | 28.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7692751cf58c1927c837bb71afbbab76b3632f035553023489a81840621b5872
|
|
BLAKE2b-256 checksum How to use checksums |
ba18afdf28c9ef1fd08dd4ffc7180819f00ad633a9ff1bc4e786137a22a182f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logRelease files / gun101_tpm-1.1.0-py3-none-any.whl
| Download URL | gun101_tpm-1.1.0-py3-none-any.whl |
|---|---|
| Size | 25.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
219804d221d554570b6e3e0226d433a49e7ad66d392196c0485976b273cfb988
|
|
BLAKE2b-256 checksum How to use checksums |
851be13239a66e33168f88205bafccdb33ab8611febed103c8f14f4418c5732b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logSecurity for gun101-tpm 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for gun101_tpm-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.