diff options
author | Justus Winter <[email protected]> | 2017-02-17 14:44:35 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2017-02-17 15:28:00 +0000 |
commit | 48634e651fcd02431c0518d42ada1f3b402feb2c (patch) | |
tree | 1bb947a1e09e96982f44d47d15dd3d6b5a825964 /lang/python/gpg/core.py | |
parent | python: Fix teardown of ephemeral contexts. (diff) | |
download | gpgme-48634e651fcd02431c0518d42ada1f3b402feb2c.tar.gz gpgme-48634e651fcd02431c0518d42ada1f3b402feb2c.zip |
python: Support quick key signing.
* NEWS: Update.
* doc/gpgme.texi (gpgme_op_keysign): Fix the description of the
'expire' argument.
* lang/python/gpg/constants/__init__.py: Import new file.
* lang/python/gpg/constants/keysign.py: New file.
* lang/python/gpg/core.py (Context.key_sign): New function.
* lang/python/tests/Makefile.am (py_tests): Add new test.
* lang/python/tests/t-quick-key-signing.py: New test.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'lang/python/gpg/core.py')
-rw-r--r-- | lang/python/gpg/core.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lang/python/gpg/core.py b/lang/python/gpg/core.py index 28d4629e..cb4ccf73 100644 --- a/lang/python/gpg/core.py +++ b/lang/python/gpg/core.py @@ -675,6 +675,47 @@ class Context(GpgmeWrapper): """ self.op_revuid(key, uid, 0) + def key_sign(self, key, uids=None, expires_in=False, local=False): + """Sign a key + + Sign a key with the current set of signing keys. Calling this + function is only valid for the OpenPGP protocol. + + If UIDS is None (the default), then all UIDs are signed. If + it is a string, then only the matching UID is signed. If it + is a list of strings, then all matching UIDs are signed. Note + that a case-sensitive exact string comparison is done. + + EXPIRES_IN specifies the expiration time of the signature in + seconds. If EXPIRES_IN is False, the signature does not + expire. + + Keyword arguments: + uids -- user ids to sign, see above (default: sign all) + expires_in -- validity period of the signature in seconds + (default: do not expire) + local -- create a local, non-exportable signature + (default: False) + + Raises: + GPGMEError -- as signaled by the underlying library + + """ + flags = 0 + if uids == None or util.is_a_string(uids): + pass#through unchanged + else: + flags |= constants.keysign.LFSEP + uids = "\n".join(uids) + + if not expires_in: + flags |= constants.keysign.NOEXPIRE + + if local: + flags |= constants.keysign.LOCAL + + self.op_keysign(key, uids, expires_in, flags) + def assuan_transact(self, command, data_cb=None, inquire_cb=None, status_cb=None): """Issue a raw assuan command |