PGPy: Pretty Good Privacy for Python
Homepage: None yet.
PGPy is a Python (2 and 3) library for implementing Pretty Good Privacy into Python programs.
Features
Currently, PGPy can load keys and signatures of all kinds in both ASCII armored and binary formats.
It can sign and verify RSA signatures only, at the moment.
Installation
To install PGPy, simply:
$ pip install PGPy
Examples
with pubsec.key("DEADBEEF"):
# You can sign things by specifying a private key.
# If the key is protected, you may need to unlock it first, otherwise, :py:meth:`PGPKeyring.sign` will raise an exception
if pubsec.selected_privkey.encrypted:
pubsec.unlock("C0rrectPassphr@se")
# now sign your document. This can be a path, URL, file-like object, string, or bytes.
sig = pubsec.sign("path/to/document")
# if you want to write the signature to disk, that's easy too!
sig.path = "path/to/document.asc"
sig.write()
# You can verify the signature using the public key half of the same key:
if pubsec.verify("path/to/document", str(sig)):
print("Signature in memory verified!")
# or use the signature you just wrote to disk
if pubsec.verify("path/to/document", "path/to/document.asc"):
print("Signature on disk verified!")
# When you exit the context-management block, decrypted secret key material is removed from memory,
# leaving only the encrypted key material.
# When verifying documents with signatures, you don't need to specify a specific key ahead of time.
# PGPy will figure out which key signed it using metadata in the signature:
ubuntupubkeys = pgpy.PGPKeyring("http://us.archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg")
with ubuntupubkeys.key():
# PGPKeyring.verify returns a SignatureVerification object which can be compared directly as a boolean.
# It also retains some additional information you can use:
sigv = pubsec.verify("http://us.archive.ubuntu.com/ubuntu/dists/precise/Release",
"http://us.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg")
if sigv:
print("Signature was verified using {key}".format(key=sigv.key.keyid))
Documentation
PGPy Documentation <http://commod0re.github.io/PGPy/>
Requirements
Python >= 2.7
Tested with: 3.4, 3.3, 3.2, 2.7
License
MIT licensed. See the bundled LICENSE file for more details.
Metadata
Release files for PGPy 0.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 | Actions |
|---|---|---|---|---|
| PGPy-0.1.0.tar.gz | 22.1 kB | Without provenance | Details for PGPy-0.1.0.tar.gz |
Release files / PGPy-0.1.0.tar.gz
| Download URL | PGPy-0.1.0.tar.gz |
|---|---|
| Size | 22.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a3918d730fdebca3d683d5859a6733033822b30141b25f36a33b8ccbaeea19b
|
|
BLAKE2b-256 checksum How to use checksums |
79c058408c33a4df458cbd76af06a1d45791b0e521d7a73bedb8cd157922a1bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for PGPy 0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.