[git] GPGME - branch, howto-update-01, updated. gpgme-1.10.0-164-g40a9dea

by Ben McGinnes cvs at cvs.gnupg.org
Sun Mar 25 03:13:10 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, howto-update-01 has been updated
       via  40a9dea5d56506400b67b0c11f6e55a1629dc6fe (commit)
       via  3b724aae423f2de01812165d54df2a7b524c82f6 (commit)
       via  dde1aae312958776fab475d6c0cdfa19cc255863 (commit)
      from  22247f658ce2f8e527c26746358cfc2643c4832f (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 40a9dea5d56506400b67b0c11f6e55a1629dc6fe
Author: Ben McGinnes <ben at adversary.org>
Date:   Sun Mar 25 11:54:05 2018 +1100

    script: temp homedir
    
    * Fixed whitespace.

diff --git a/lang/python/examples/howto/temp-homedir-config.py b/lang/python/examples/howto/temp-homedir-config.py
index f49de63..368cace 100755
--- a/lang/python/examples/howto/temp-homedir-config.py
+++ b/lang/python/examples/howto/temp-homedir-config.py
@@ -51,7 +51,7 @@ existing data.
 
 If the directory already exists, the script will terminate with a
 message telling you to specify a new directory name.  There is no
-default directory name.  
+default directory name.
 """
 
 gpgconf = """# gpg.conf settings for key generation:

commit 3b724aae423f2de01812165d54df2a7b524c82f6
Author: Ben McGinnes <ben at adversary.org>
Date:   Sun Mar 25 11:35:11 2018 +1100

    doc: python bindings howto
    
    * Added a reference to new script which will setup a temporary homedir
      for a user.

diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org
index 4d1124f..08f9ef7 100644
--- a/lang/python/docs/GPGMEpythonHOWTOen.org
+++ b/lang/python/docs/GPGMEpythonHOWTOen.org
@@ -1091,6 +1091,10 @@
    permissions set to only permit access by the directory owner.  On
    posix systems this means setting the directory permissions to 700.
 
+   The =temp-homedir-config.py= script in the HOWTO examples directory
+   will create an alternative homedir with these configuration options
+   already set and the correct directory and file permissions.
+
    The successful generation of the key can be confirmed via the
    returned =GenkeyResult= object, which includes the following data:
 

commit dde1aae312958776fab475d6c0cdfa19cc255863
Author: Ben McGinnes <ben at adversary.org>
Date:   Sun Mar 25 11:26:26 2018 +1100

    script: temporary homedir creation
    
    * Script to create a temporary gnupg homedir in the user's directory
      for testing or scripting purposes.
    * Creates a hidden directory on POSIX systems with the correct
      permissions (700).
    * Creates a gpg.conf in that directory containing the same
      configuration options as used in the "Danger Mouse" example in the
      HOWTO with the correct permissions (600).

diff --git a/lang/python/examples/howto/temp-homedir-config.py b/lang/python/examples/howto/temp-homedir-config.py
new file mode 100755
index 0000000..f49de63
--- /dev/null
+++ b/lang/python/examples/howto/temp-homedir-config.py
@@ -0,0 +1,119 @@
+#!/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 os
+import os.path
+import sys
+
+intro = """
+This script creates a temporary directory to use as a homedir for
+testing key generation tasks with the correct permissions, along
+with a gpg.conf file containing the same configuration options
+listed in the HOWTO.
+
+You may wish to change the order of the cipher preferences or
+remove those not relevant to your installation.  These
+configuration parameters assume that all ciphers and digests are
+installed and available rather than limiting to the default
+ciphers and digests.
+
+The script prompts for a directory name to be installed as a hidden
+directory in the user's home directory on POSIX systems.  So if you
+enter "gnupg-temp" on a Linux, BSD or OS X system, it will create
+"~/.gnupg-temp" (you do not need to enter the leading dot).
+
+This script has not been tested on Windows systems and may have
+unpredictable results.  That said, it will not delete or copy over
+existing data.
+
+If the directory already exists, the script will terminate with a
+message telling you to specify a new directory name.  There is no
+default directory name.  
+"""
+
+gpgconf = """# gpg.conf settings for key generation:
+expert
+allow-freeform-uid
+allow-secret-key-import
+trust-model tofu+pgp
+tofu-default-policy unknown
+enable-large-rsa
+enable-dsa2
+cert-digest-algo SHA512
+default-preference-list TWOFISH CAMELLIA256 AES256 CAMELLIA192 AES192 CAMELLIA128 AES BLOWFISH IDEA CAST5 3DES SHA512 SHA384 SHA256 SHA224 RIPEMD160 SHA1 ZLIB BZIP2 ZIP Uncompressed
+personal-cipher-preferences TWOFISH CAMELLIA256 AES256 CAMELLIA192 AES192 CAMELLIA128 AES BLOWFISH IDEA CAST5 3DES
+personal-digest-preferences SHA512 SHA384 SHA256 SHA224 RIPEMD160 SHA1
+personal-compress-preferences ZLIB BZIP2 ZIP Uncompressed
+"""
+
+if len(sys.argv) == 1:
+    print(intro)
+    new_homedir = input("Enter the temporary gnupg homedir name: ")
+elif len(sys.argv) == 2:
+    new_homedir = sys.argv[1]
+else:
+    new_homedir = " ".join(sys.argv[1:])
+
+userdir = os.path.expanduser("~")
+
+if new_homedir.startswith("~"):
+    new_homdir.replace("~", "")
+else:
+    pass
+
+if new_homedir.startswith("/"):
+    new_homdir.replace("/", "")
+else:
+    pass
+
+if new_homedir.startswith("."):
+    new_homdir.replace(".", "_")
+else:
+    pass
+
+if new_homedir.count(" ") > 0:
+    new_homedir.replace(" ", "_")
+else:
+    pass
+
+nh = "{0}/.{1}".format(userdir, new_homedir)
+
+if os.path.exists(nh) is True:
+    print("The {0} directory already exists.".format(nh))
+else:
+    print("Creating the {0} directory.".format(nh))
+    os.mkdir(nh)
+    os.chmod(nh, 0o700)
+    with open("{0}/{1}".format(nh, "gpg.conf"), "w") as f:
+        f.write(gpgconf)
+    os.chmod("{0}/{1}".format(nh, "gpg.conf"), 0o600)
+    print("""You may now use the {0} directory as an alternative GPG homedir:
+
+gpg --homedir {0}
+gpg --homedir --full-gen-key
+
+Or with GPGME scripts, including the GPGME Python bindings.
+""")

-----------------------------------------------------------------------

Summary of changes:
 lang/python/docs/GPGMEpythonHOWTOen.org           |   4 +
 lang/python/examples/howto/temp-homedir-config.py | 119 ++++++++++++++++++++++
 2 files changed, 123 insertions(+)
 create mode 100755 lang/python/examples/howto/temp-homedir-config.py


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list