Skip to main content

The Stateless OpenPGP Command-Line Interface

The Stateless OpenPGP Command-Line Interface (or sop) is a specification that encourages OpenPGP implementors to provide a common, relatively simple command-line API for purposes of object security.

This Python module helps implementers build such a CLI from any implementation accessible to the Python interpreter.

It does not provide such an implementation itself -- this is just the scaffolding for the command line, which should make it relatively easy to supply a handful of python functions as methods to a class.

Note that if the user has argcomplete installed, they should also get tab completion in standard shells like bash basically for free.

Example

Here is an example of a minimal command-line tool that just implements the extract_cert() interface, using (imaginary) module foo that has the appropriate

#!/usr/bin/python3
# PYTHON_ARGCOMPLETE_OK
import sop
import foo

class FooSop(sop.StatelessOpenPGP):
    def __init__(self):
        super().__init__(prog='FooPGP', version='0.17')
    # overrides go here...
    def extract_cert(self, key:bytes, armor:bool=True, **kwargs:Namespace) -> bytes:
        self.raise_on_unknown_options(**kwargs)
        return foo.bytes_to_openpgp_key(key).get_certificate(armor=armor)

if __name__ = "__main__":
    foo = FooSop()
    foo.dispatch()

Module Goals

Extensibility

An implementer who wants to extend sop in a simple way (e.g. adding an option to an existing subcommand, or adding a special option) should be able to do so without breaking this interface.

Minimal dependencies

The aim is to only depend on modules from stdlib. We make an exception for optional modules like argcomplete, which can be skipped.

Type-checking

All the code in here should be well-annotated

Self-documenting

Implementers should learn what they need to know from the docstrings, like so:

import sop
help(sop)
help(sop.StatelessOpenPGP)

Semantic Versioning

The major version number will only change when backward-incompatible changes are made.

As long as the major version number is 0, the same holds true for the minor version number.

Metadata

Release files for sop 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sop 0.5.1
File Size Uploaded Provenance Actions
sop-0.5.1.tar.gz 14.6 kB Without provenance Details for sop-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sop 0.5.1
File Interpreter ABI Platform Actions
sop-0.5.1-py3-none-any.whl Python 3 none any Details for sop-0.5.1-py3-none-any.whl

Total release size: 29.2 kB

Release files / sop-0.5.1.tar.gz

Download URL sop-0.5.1.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d43957a1cf55edca41bde6b079edd675fad33bbd50a44f6a1f14d90e3e0e5a6a
BLAKE2b-256 checksum
How to use checksums
ac45885f054108ac6e2fc330fb306a566efbe104fee4632482fd3d475559abc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / sop-0.5.1-py3-none-any.whl

Download URL sop-0.5.1-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ee2d32dbd21a7818c0beacefbff34e3f5ec9f2942ea3b3123caddd333618838
BLAKE2b-256 checksum
How to use checksums
f0b2730d82c3750dbb7be3c9afa0a3cb6f84a71313d9293c128caebdcec1db9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Security for sop 0.5.1

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.

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