pharmaship.core.gpg¶
Utilities for GPG signature handling.
-
class
pharmaship.core.gpg.
KeyManager
¶ Class used to manage PGP keys used for external data import.
-
add_key
(import_file)¶ Add a key to the keyring.
- Parameters
import_file (file-object) – File object containing the key data.
- Returns
True if the key is successfully added.
- Return type
- Example
>>> from pathlib import Path >>> my_key_file = Path("pharmaship.pub").open() >>> km = KeyManager() >>> km.add_key(my_key_file) True
-
check_signature
(signed_data)¶ Check signed data has a valid known signature.
-
delete_key
(fingerprint)¶ Delete key from the keyring.
- Parameters
fingerprint (str) – The fingerprint of the key to delete.
- Returns
True if the key is successfully deleted.
- Return type
- Example
>>> km = KeyManager() >>> km.delete_key("0123456789ABCDEF0123456789ABCDEF01234567") True
-
get_key
(fingerprint)¶ Return a key of the keyring from its fingerprint.
-