Registry / auth-security / pgpy13

pgpy13

JSON →
library0.6.1rc1pypypi✓ verified 83d ago

PGPy is a Python library for Pretty Good Privacy (PGP) encryption and signing. This temporary fork (pgpy13) provides Python 3.13 compatibility for the original PGPy library. Current version 0.6.1rc1 targets Python >=3.9.

pip install pgpy13
INSTALL
IMPORT
SIG · PGPY13
P
pgpy13
auth-securitypythonv0.6.1rc1
Install
2.6s avg
Import
189ms
Disk
34MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.1rc1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.204s · 36MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.6s · import 0.174s · 36MB
34MB installed
● package 34MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PGPKey
from pgpy import PGPKey
from pgpy.constants import PGPKey
PGPKey is a top-level class, not in constants
PGPMessage
from pgpy import PGPMessage
from pgpy.message import PGPMessage
PGPMessage is exported at package level

Generate a PGP key, save to file, encrypt a message.

import pgpy from pgpy.constants import ( PubKeyAlgorithm, KeyFlags, HashAlgorithm, SymmetricKeyAlgorithm, CompressionAlgorithm ) # Generate a new RSA key key = pgpy.PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 2048) uid = pgpy.PGPUID.new('Alice', email='alice@example.com') key.add_uid(uid, usage={KeyFlags.EncryptCommunications, KeyFlags.SignData}, hashes=[HashAlgorithm.SHA256], ciphers=[SymmetricKeyAlgorithm.AES256], compression=[CompressionAlgorithm.ZLIB]) # Save private key with open('private.key', 'wb') as f: f.write(str(key).encode()) # Encrypt a message msg = pgpy.PGPMessage.new('Hello, world!') encrypted = key.encrypt(msg) print(encrypted)
Debug
Known issues
breakingpgpy13 is a temporary fork with a different import path. Do not use both pgpy and pgpy13 in the same environment.
fix
Uninstall pgpy before installing pgpy13 or vice versa.
affects: all
gotchaThe package is named 'pgpy13' but the module import is still 'pgpy'.
fix
Use 'import pgpy' after pip install pgpy13.
affects: 0.x
deprecatedThis fork may be temporary; original PGPy might later update to support Python 3.13. Monitor the original repo.
fix
Switch back to original pgpy once it gains Python 3.13 support.
affects: 0.6.1rc1
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pgpy'
The pip package is named pgpy13, not pgpy, but the import is 'pgpy'. Users often install 'pgpy' instead.
fix
Run 'pip uninstall pgpy' then 'pip install pgpy13'.
AttributeError: 'NoneType' object has no attribute 'encrypt'
Key was not properly loaded or not found when trying to encrypt.
fix
Ensure the key is correctly read and parsed: key, _ = pgpy.PGPKey.from_file('path/to/key.asc')
ValueError: This key has no usable encryption subkey
The primary key can sign but not encrypt. Must add an encryption subkey or use a key with encryption capabilities.
fix
When generating key, add usage={KeyFlags.EncryptCommunications} to the UID or generate a key with encryption subkey.
Upgrade
Version history
0.6.1rc1latest on PyPI · released Mar 1, 2025
Audit
Dependencies
cryptographyrequiredUnderlying cryptographic operations
sixoptionalPython 2/3 compatibility (original dependency)
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
pgpy13 — pip install pgpy13 · libregistry