[git] GPGME - branch, ben/howto-update-02, updated. gpgme-1.10.0-172-g56bbfd3
by Ben McGinnes
cvs at cvs.gnupg.org
Thu Mar 29 00:51:26 CEST 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".
The branch, ben/howto-update-02 has been updated
via 56bbfd39acea90eb87a28b11a515b0314cdda54c (commit)
via 5a553f5a317e5ad5ab0274d58854df1ecf390e0d (commit)
from 2f507b045909d32bf29d23da04db02b078e5fb9d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 56bbfd39acea90eb87a28b11a515b0314cdda54c
Author: Ben McGinnes <ben at adversary.org>
Date: Thu Mar 29 09:49:08 2018 +1100
example: key signing
* Added script for signing or certifying keys.
diff --git a/lang/python/examples/howto/sign-key.py b/lang/python/examples/howto/sign-key.py
new file mode 100755
index 0000000..b1afe13
--- /dev/null
+++ b/lang/python/examples/howto/sign-key.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+from __future__ import absolute_import, division, unicode_literals
+
+# Copyright (C) 2018 Ben McGinnes <ben at gnupg.org>
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU
+# Lesser General Public Licensefor more details.
+#
+# You should have received a copy of the GNU General Public License and the GNU
+# Lesser General Public along with this program; if not, see
+# <http://www.gnu.org/licenses/>.
+
+import gpg
+import os.path
+
+print("""
+This script signs or certifies a key.
+
+The gpg-agent and pinentry are invoked to enter the passphrase.
+""")
+
+c = gpg.Context()
+
+homedir = input("Enter the GPG configuration directory path (optional): ")
+fpr0 = input("Enter the fingerprint of the key to sign: ")
+userid = input("Enter the UID to sign (case sensitive, optional): ")
+sig_type = input("Enter the certification type (local or normal): ")
+
+if homedir.startswith("~"):
+ if os.path.exists(os.path.expanduser(homedir)) is True:
+ c.home_dir = os.path.expanduser(homedir)
+ else:
+ pass
+elif os.path.exists(homedir) is True:
+ c.home_dir = homedir
+else:
+ pass
+
+fpr = "".join(fpr0.split())
+key = c.get_key(fpr, secret=False)
+
+if len(userid) > 0 and sig_type.lower() == "local":
+ c.key_sign(key, uids=userid, local=True)
+elif len(userid) > 0 and sig_type.lower() != "local":
+ c.key_sign(key, uids=userid)
+elif len(userid) == 0 and sig_type.lower() == "local":
+ c.key_sign(key, local=True)
+else:
+ c.key_sign(key)
commit 5a553f5a317e5ad5ab0274d58854df1ecf390e0d
Author: Ben McGinnes <ben at adversary.org>
Date: Thu Mar 29 09:22:17 2018 +1100
doc: python bindings howto
* Fixed a typo.
diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org
index 1be9369..4cd4098 100644
--- a/lang/python/docs/GPGMEpythonHOWTOen.org
+++ b/lang/python/docs/GPGMEpythonHOWTOen.org
@@ -1259,7 +1259,7 @@
The =key_sign= method takes four arguments: =key=, =uids=,
=expires_in= and =local=. The default value of =uids= is =None=
and which results in all user IDs being selected. The default
- values of =expires_in= snd =local= is =False=; which result in the
+ values of =expires_in= and =local= is =False=; which result in the
signature never expiring and being able to be exported.
The =key= is the key being signed rather than the key doing the
-----------------------------------------------------------------------
Summary of changes:
lang/python/docs/GPGMEpythonHOWTOen.org | 2 +-
.../examples/howto/{add-userid.py => sign-key.py} | 25 +++++++++++-----------
2 files changed, 14 insertions(+), 13 deletions(-)
copy lang/python/examples/howto/{add-userid.py => sign-key.py} (74%)
hooks/post-receive
--
GnuPG Made Easy
http://git.gnupg.org
More information about the Gnupg-commits
mailing list