Skip to main content

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/tpm0 or /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 dependency tpm2-pytss>=2.3.0; sys_platform == 'linux' in pyproject.toml
  • On non-Linux OS, the runtime check _check_platform_supported() in tpm.py raises a clear RuntimeError without importing tpm2_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.
  1. A random data encryption key (DEK) is generated for each file.
  2. The DEK is encrypted with a Key Encryption Key (KEK) derived from your password via Argon2id.
  3. The encrypted DEK is sealed to the TPM using a symmetric key bound to the TPM.
  4. The file itself is encrypted with the DEK using AES-256-GCM.
  5. 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-pytss Python 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

gun101_tpm-1.0.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gun101_tpm-1.0.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

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

Hashes for gun101_tpm-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5a0b5b75fd1af954cd72c035c9418afc5829345fa18339677bb51346b9da3dfd
MD5 62520ac5ade4e942f0e23c2a0d3de72e
BLAKE2b-256 275c7af0a79ff35ae528bc27f7f3a2c36422d0983b17f2e179b4c635bea903f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for gun101_tpm-1.0.0.tar.gz:

Publisher: publish.yml on dialga-cmd/gun101-tpm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for gun101_tpm-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89bf2d3c6f7209431a038d8fde546ae10b34eeda3e93191a7e5b67836d95b711
MD5 8ecfa738d89aa687c8f7cc1af8a20531
BLAKE2b-256 60f9cf7e2ece3bed501fea0093a64563acc4d3db6629ceeb5ffcfe4ed0a94889

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page