summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen McGinnes <ben@adversary.org>2018-05-30 09:11:28 +1000
committerBen McGinnes <ben@adversary.org>2018-05-30 09:11:28 +1000
commitfd4226429d923537ad5a04141163fdb5ee7c04db (patch)
treecbfce8f48a06db121bce64ca37aa7f13ac983244
parent93bdf4b50aca884859125d041685e0b2cfe2b4fe (diff)
downloadgpgme-ben/howto-update-05.tar.gz
examples: exporting keysben/howto-update-05
* Fixed the descriptions and explanation of what happens if no search/user ID/key ID data is included (it exports the lot).
-rwxr-xr-xlang/python/examples/howto/export-key.py7
-rwxr-xr-xlang/python/examples/howto/export-secret-key.py10
2 files changed, 12 insertions, 5 deletions
diff --git a/lang/python/examples/howto/export-key.py b/lang/python/examples/howto/export-key.py
index 108881de..5c3280b9 100755
--- a/lang/python/examples/howto/export-key.py
+++ b/lang/python/examples/howto/export-key.py
@@ -33,7 +33,10 @@ c = gpg.Context(armor=True)
k = gpg.Data()
print("""
-This script exports a secret key to a file.
+This script exports one or more public keys to a file.
+
+If the uer or key IDs are not included then all available public keys will be
+exported to a file (ASCII aroured).
""")
if len(sys.argv) > 3:
@@ -51,7 +54,7 @@ elif len(sys.argv) == 2:
else:
filepth = input("Enter the filename and path of the key file: ")
homedir = input("Enter the GPG configuration directory path (optional): ")
- keytext = input("Enter the user or key ID for export: ")
+ keytext = input("Enter the user or key ID for export (optional): ")
if homedir.startswith("~"):
if os.path.exists(os.path.expanduser(homedir)) is True:
diff --git a/lang/python/examples/howto/export-secret-key.py b/lang/python/examples/howto/export-secret-key.py
index fa3aa7e5..2ee59bc4 100755
--- a/lang/python/examples/howto/export-secret-key.py
+++ b/lang/python/examples/howto/export-secret-key.py
@@ -33,9 +33,13 @@ c = gpg.Context(armor=True)
k = gpg.Data()
print("""
-This script exports a secret key to a file.
+This script exports one or more secret keys to a file.
-Will prompt for passphrase using gpg-agent and pinentry.
+Will prompt for passphrase using gpg-agent and pinentry for each key to be
+exported.
+
+If the user or key ID(s) are not entered then it will attempt to export all
+available keys and will prompt for the passphrase of each one.
""")
if len(sys.argv) > 3:
@@ -53,7 +57,7 @@ elif len(sys.argv) == 2:
else:
filepth = input("Enter the filename and path of the key file: ")
homedir = input("Enter the GPG configuration directory path (optional): ")
- keytext = input("Enter the user or key ID for export: ")
+ keytext = input("Enter the user or key ID for export (optional): ")
if homedir.startswith("~"):
if os.path.exists(os.path.expanduser(homedir)) is True: