GUN-101-TPM: Hardware-bound File Encryption
🛡️ Platform Support
GUN-101-TPM is currently Linux-only. TPM 2.0 hardware binding is not yet supported on Windows or macOS. This limitation is due to the tpm2-pytss library's reliance on Linux-specific kernel interfaces ( /dev/tpm0, /dev/tpmrm0 ) and the kernel's TPM 2.0 device model.
- Linux: Fully supported with
/dev/tpm0or/dev/tpmrm0 - Windows: Not supported — requires a native TBS-based backend (planned for future)
- 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
GUN-101-TPM creates encrypted files that can only be decrypted on the machine that created them. ...
GUN-101-TPM creates encrypted files that can only be decrypted on 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.
⚠️ 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 TPM's Endorsement Key (EK) public area is hashed to form a fingerprint, stored in the container. During decryption, the fingerprint is checked first — if it doesn't match, the operation fails immediately without contacting the TPM.
- 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
🛡️ License
MIT License - see LICENSE file for details.
🐛 Reporting Issues
Please report security issues and bugs via the GitHub issue tracker.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gun101_tpm-1.0.0.tar.gz.
File metadata
- Download URL: gun101_tpm-1.0.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a0b5b75fd1af954cd72c035c9418afc5829345fa18339677bb51346b9da3dfd
|
|
| MD5 |
62520ac5ade4e942f0e23c2a0d3de72e
|
|
| BLAKE2b-256 |
275c7af0a79ff35ae528bc27f7f3a2c36422d0983b17f2e179b4c635bea903f5
|
Provenance
The following attestation bundles were made for gun101_tpm-1.0.0.tar.gz:
Publisher:
publish.yml on dialga-cmd/gun101-tpm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gun101_tpm-1.0.0.tar.gz -
Subject digest:
5a0b5b75fd1af954cd72c035c9418afc5829345fa18339677bb51346b9da3dfd - Sigstore transparency entry: 2530097206
- Sigstore integration time:
-
Permalink:
dialga-cmd/gun101-tpm@7a52c969c4d1636e877f25f544f9509f09056ca2 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/dialga-cmd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7a52c969c4d1636e877f25f544f9509f09056ca2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file gun101_tpm-1.0.0-py3-none-any.whl.
File metadata
- Download URL: gun101_tpm-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89bf2d3c6f7209431a038d8fde546ae10b34eeda3e93191a7e5b67836d95b711
|
|
| MD5 |
8ecfa738d89aa687c8f7cc1af8a20531
|
|
| BLAKE2b-256 |
60f9cf7e2ece3bed501fea0093a64563acc4d3db6629ceeb5ffcfe4ed0a94889
|
Provenance
The following attestation bundles were made for gun101_tpm-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on dialga-cmd/gun101-tpm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gun101_tpm-1.0.0-py3-none-any.whl -
Subject digest:
89bf2d3c6f7209431a038d8fde546ae10b34eeda3e93191a7e5b67836d95b711 - Sigstore transparency entry: 2530097947
- Sigstore integration time:
-
Permalink:
dialga-cmd/gun101-tpm@7a52c969c4d1636e877f25f544f9509f09056ca2 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/dialga-cmd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7a52c969c4d1636e877f25f544f9509f09056ca2 -
Trigger Event:
release
-
Statement type: