[gnome-keysign: 3/6] gpgmeh: Split signature importing off into a separate function



commit 6942608fe8617e25e304d1fbbe4b43b5b1e7c208
Author: Tobias Mueller <muelli cryptobitch de>
Date:   Thu Dec 19 10:24:13 2019 +0100

    gpgmeh: Split signature importing off into a separate function
    
    This allows to test the separate functions more easily. Hopefully.

 keysign/gpgmeh.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/keysign/gpgmeh.py b/keysign/gpgmeh.py
index a726698..0fa6e31 100755
--- a/keysign/gpgmeh.py
+++ b/keysign/gpgmeh.py
@@ -540,7 +540,18 @@ def decrypt_signature(encrypted_sig, homedir=None):
 
 def decrypt_and_import_signature(encrypted_sig, homedir=None):
     signature = decrypt_signature(encrypted_sig, homedir=homedir)
+    import_signature(signature)
 
+def import_signature(signature, homedir=None):
+    """
+    Imports an OpenPGP TPK to the local keyring
+
+    The purpose is to import a certification (hence the name of the function)
+    but it is in fact agnostic about what the TPK contains.
+
+    This function will try to import the TPK via DBus first and,
+    if that failed, resort to using gpgme directly.
+    """
     # Try Seahorse DBus
     name = "org.gnome.seahorse"
     path = "/org/gnome/seahorse/keys"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]