{"id":24233,"library":"pgpy13","title":"PGPy","description":"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.","status":"active","version":"0.6.1rc1","language":"python","source_language":"en","source_url":"https://github.com/memory/PGPy","tags":["pgp","encryption","cryptography","fork","python3.13"],"install":[{"cmd":"pip install pgpy13","lang":"bash","label":"Install pgpy13"}],"dependencies":[{"reason":"Underlying cryptographic operations","package":"cryptography","optional":false},{"reason":"Python 2/3 compatibility (original dependency)","package":"six","optional":true}],"imports":[{"note":"PGPKey is a top-level class, not in constants","wrong":"from pgpy.constants import PGPKey","symbol":"PGPKey","correct":"from pgpy import PGPKey"},{"note":"PGPMessage is exported at package level","wrong":"from pgpy.message import PGPMessage","symbol":"PGPMessage","correct":"from pgpy import PGPMessage"}],"quickstart":{"code":"import pgpy\nfrom pgpy.constants import (\n    PubKeyAlgorithm,\n    KeyFlags,\n    HashAlgorithm,\n    SymmetricKeyAlgorithm,\n    CompressionAlgorithm\n)\n\n# Generate a new RSA key\nkey = pgpy.PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 2048)\nuid = pgpy.PGPUID.new('Alice', email='alice@example.com')\nkey.add_uid(uid, usage={KeyFlags.EncryptCommunications, KeyFlags.SignData},\n            hashes=[HashAlgorithm.SHA256],\n            ciphers=[SymmetricKeyAlgorithm.AES256],\n            compression=[CompressionAlgorithm.ZLIB])\n\n# Save private key\nwith open('private.key', 'wb') as f:\n    f.write(str(key).encode())\n\n# Encrypt a message\nmsg = pgpy.PGPMessage.new('Hello, world!')\nencrypted = key.encrypt(msg)\nprint(encrypted)","lang":"python","description":"Generate a PGP key, save to file, encrypt a message."},"warnings":[{"fix":"Uninstall pgpy before installing pgpy13 or vice versa.","message":"pgpy13 is a temporary fork with a different import path. Do not use both pgpy and pgpy13 in the same environment.","severity":"breaking","affected_versions":"all"},{"fix":"Use 'import pgpy' after pip install pgpy13.","message":"The package is named 'pgpy13' but the module import is still 'pgpy'.","severity":"gotcha","affected_versions":"0.x"},{"fix":"Switch back to original pgpy once it gains Python 3.13 support.","message":"This fork may be temporary; original PGPy might later update to support Python 3.13. Monitor the original repo.","severity":"deprecated","affected_versions":"0.6.1rc1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip uninstall pgpy' then 'pip install pgpy13'.","cause":"The pip package is named pgpy13, not pgpy, but the import is 'pgpy'. Users often install 'pgpy' instead.","error":"ModuleNotFoundError: No module named 'pgpy'"},{"fix":"Ensure the key is correctly read and parsed: key, _ = pgpy.PGPKey.from_file('path/to/key.asc')","cause":"Key was not properly loaded or not found when trying to encrypt.","error":"AttributeError: 'NoneType' object has no attribute 'encrypt'"},{"fix":"When generating key, add usage={KeyFlags.EncryptCommunications} to the UID or generate a key with encryption subkey.","cause":"The primary key can sign but not encrypt. Must add an encryption subkey or use a key with encryption capabilities.","error":"ValueError: This key has no usable encryption subkey"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}