[gnome-keysign: 14/16] Merge branch 'master' into dnd



commit b2e6644442b0327f9f20abb953b55b5a362c04f4
Merge: e87039c 596935d
Author: Ludovico de Nittis <aasonykk gmail com>
Date:   Wed Aug 7 09:08:29 2019 +0200

    Merge branch 'master' into dnd

 ...-key.man.rst => gnome-keysign-sign-key.man.rst} |     4 +-
 data/org.gnome.Keysign-symbolic.svg                |    36 +
 data/org.gnome.Keysign.svg                         |   190 +-
 keysign/app.py                                     |     8 +-
 keysign/avahioffer.py                              |    11 +-
 keysign/gpgmeh.py                                  |    43 +-
 keysign/keyconfirm.py                              |     8 +
 keysign/locale/da/LC_MESSAGES/keysign.po           |   461 +
 keysign/locale/es/LC_MESSAGES/keysign.po           |    26 +-
 keysign/locale/hr/LC_MESSAGES/keysign.po           | 19589 +++++++++++++++++++
 keysign/locale/hu/LC_MESSAGES/keysign.po           |    21 +-
 keysign/locale/id/LC_MESSAGES/keysign.po           |   487 +
 keysign/locale/pl/LC_MESSAGES/keysign.po           |    12 +-
 keysign/locale/pt_BR/LC_MESSAGES/keysign.po        |    23 +-
 keysign/offer.py                                   |     8 +-
 keysign/receive.py                                 |    44 +-
 keysign/receive.ui                                 |   140 +-
 keysign/util.py                                    |     9 +-
 18 files changed, 21013 insertions(+), 107 deletions(-)
---
diff --cc keysign/gpgmeh.py
index cee161f,bc4d35b..b6274c4
--- a/keysign/gpgmeh.py
+++ b/keysign/gpgmeh.py
@@@ -473,49 -511,4 +514,49 @@@ def sign_keydata_and_encrypt(keydata, e
                                                 # in order for it to work out of the box
                                                 always_trust=True,
                                                 sign=False)
-                 yield (UID.from_gpgme(uid), ciphertext)
+                 yield (UID.from_gpgme(uid), ciphertext, uid_data)
 +
 +
 +def import_signature(encrypted_sig, homedir=None):
 +    ctx = DirectoryContext(homedir)
 +
 +    # Check if we are really importing a signature
 +    temp_ctx = TempContextWithAgent(ctx)
 +    signature = temp_ctx.decrypt(encrypted_sig)
 +    temp_ctx.op_import(signature[0])
 +    result = temp_ctx.op_import_result()
 +
 +    if result.imported != 0:
 +        log.warning("Trying to import a new key instead of a signature!")
 +        raise GPGMEError
 +
 +    if result.new_signatures == 0 or result.revocations != 0 or result.new_sub_keys != 0:
 +        log.warning("The signature that we were importing is not as we expected!")
 +        raise GPGMEError
 +
 +    signature = ctx.decrypt(encrypted_sig)
 +
 +    # Try Seahorse DBus
 +    name = "org.gnome.seahorse"
 +    path = "/org/gnome/seahorse/keys"
 +    bus = dbus.SessionBus()
 +    result = []
 +
 +    try:
 +        proxy = bus.get_object(name, path)
 +    except dbus.exceptions.DBusException:
 +        log.debug("Seahorse DBus is not available")
 +    else:
 +        iface = "org.gnome.seahorse.KeyService"
 +        gpg_iface = dbus.Interface(proxy, iface)
 +        payload = base64.b64encode(signature[0]).decode('latin-1')
 +        payload = '\n'.join(payload[i:(i + 64)] for i in range(0, len(payload), 64))
 +        payload = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\n" + payload + "\n-----END PGP PUBLIC KEY 
BLOCK-----"
 +        result = gpg_iface.ImportKeys("openpgp", payload)
 +
 +    # If Seahorse failed we try op_import
 +    if len(result) < 1:
 +        ctx.op_import(signature[0])
 +        result = ctx.op_import_result()
 +        if len(result.imports) < 1:
 +            raise GPGMEError


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