Module ploigos_step_runner.utils.pgp
Shared utils for dealing with PGP keys.
Note that these functions use the "gpg" program to interact with PGP keys, but as PGP is the standard and GPG is an implementation of that standard, we universally refer to anything having to do with PGP keys as "PGP" rather then "GPG".
Functions
def detach_sign_with_pgp_key(file_to_sign_path, pgp_private_key_fingerprint, output_signature_path)
-
Does a detached sign of a given file using a given users private key.
Parameters
file_to_sign_path
:str
- Path to file to create a detached PGP signature for.
pgp_private_key_fingerprint
:str
- PGP private key fingerprint to sign the given file with.
output_signature_path
:str
- File path to put the detached signature in.
Raises
RuntimeError
- If error signing given file with given key.
def export_pgp_public_key(pgp_private_key_fingerprint)
-
Exports a PGP public key given a private key fingerprint.
Parameters
pgp_private_key_fingerprint
:str
- PGP fingerprint.
Returns
str
- Public key from the private key fingerprint.
Raises
RuntimeError
- If error getting exported PGP public key
def import_pgp_key(pgp_private_key)
-
Imports a PGP key.
Parameters
pgp_private_key
:str
- PGP key to import.
Returns
str
- Fingerprint of the imported PGP key.
Raises
RuntimeError
- If error getting PGP fingerprint for imported PGP key If error importing PGP key.