[Pgp-tools-commit] r842 - in trunk: debian keyart
Guilhem Moulin
guilhem-guest at moszumanska.debian.org
Fri Feb 19 16:51:06 UTC 2016
Author: guilhem-guest
Date: 2016-02-19 16:51:06 +0000 (Fri, 19 Feb 2016)
New Revision: 842
Modified:
trunk/debian/changelog
trunk/debian/copyright
trunk/keyart/LICENSE
trunk/keyart/keyart
Log:
keyart: Print the public key algorithm and length as shown by GnuPG 2.1
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2016-02-19 16:51:01 UTC (rev 841)
+++ trunk/debian/changelog 2016-02-19 16:51:06 UTC (rev 842)
@@ -31,6 +31,10 @@
output.
+ For ECDH, ECDSA, EDDSA (sub)keys, show the curve name instead of the
public key algorithm and length. This matches GnuPG 2.1.x's output.
+ * keyart:
+ + Print the public key algorithm and length as shown by GnuPG 2.1 (e.g.,
+ "rsa4096" instead of "4096R"); for ECDH, ECDSA and EDDSA keys, show the
+ curve name instead.
-- Guilhem Moulin <guilhem at guilhem.org> Tue, 02 Feb 2016 14:31:32 +0100
Modified: trunk/debian/copyright
===================================================================
--- trunk/debian/copyright 2016-02-19 16:51:01 UTC (rev 841)
+++ trunk/debian/copyright 2016-02-19 16:51:06 UTC (rev 842)
@@ -88,6 +88,7 @@
Files: keyart/*
Copyright: © 2014 Aaron Toponce <aaron.toponce at gmail.com>
+ © 2016 Guilhem Moulin <guilhem at guilhem.org>
License: BSD-2-clause
Files: gpg-key2latex/*
Modified: trunk/keyart/LICENSE
===================================================================
--- trunk/keyart/LICENSE 2016-02-19 16:51:01 UTC (rev 841)
+++ trunk/keyart/LICENSE 2016-02-19 16:51:06 UTC (rev 842)
@@ -1,4 +1,5 @@
Copyright (c) 2014, Aaron Toponce <aaron.toponce at gmail.com>
+ (c) 2016 Guilhem Moulin <guilhem at guilhem.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/keyart/keyart
===================================================================
--- trunk/keyart/keyart 2016-02-19 16:51:01 UTC (rev 841)
+++ trunk/keyart/keyart 2016-02-19 16:51:06 UTC (rev 842)
@@ -25,7 +25,7 @@
help='A key identifier (email, ID, fingerprint, etc.).')
ARGS = PARSER.parse_args()
-def draw_art(key_size, key_algo, key_fpr):
+def draw_art(key_size, key_algo, key_curve, key_fpr):
"""Execute the Drunken Bishop algorithm on a key."""
art = ''
f_bytes = []
@@ -136,26 +136,27 @@
# See https://tools.ietf.org/html/rfc4880#section-9.1
# Also https://tools.ietf.org/html/rfc6637#section4
- if key_algo == '17':
- key_algo = 'DSA'
- elif key_algo == '1' or key_algo == '2' or key_algo == '3':
- key_algo = 'RSA'
- elif key_algo == '16' or key_algo == '20':
- key_algo = 'Elg'
- elif key_algo == '18':
- key_algo = 'ECDH'
- elif key_algo == '19':
- key_algo = 'ECDSA'
- elif key_algo == '21':
- key_algo = 'X9.42'
+ if key_algo == '1' or key_algo == '2' or key_algo == '3':
+ header = 'rsa' + key_size # RSA
+ elif key_algo == '16':
+ header = 'elg' + key_size # Elgamal encrypt only
+ elif key_algo == '17':
+ header = 'dsa' + key_size # DSA
+ elif key_algo == '20':
+ header = 'xxx' + key_size # Elgamal encrypt+sign (legacy)
+ elif key_algo == '18' or key_algo == '19' or key_algo == '22':
+ if key_curve is not None and key_curve != '':
+ header = key_curve
+ elif key_algo == '18':
+ header = 'ecdh' + key_size
+ elif key_algo == '19':
+ header = 'ecdsa' + key_size
+ elif key_algo == '22':
+ header = 'eddsa' + key_size
else:
- key_algo = 'N/A'
+ header = 'N/A'
- if key_size:
- header = "["+key_algo+" "+key_size+"]"
- else:
- header = ''
-
+ header = "[%s]" % header
if len(header) > 19:
header = ''
art += '+' + header.center(19, '-') + '+\n'
@@ -231,12 +232,14 @@
for lines in gpg.communicate()[0].decode('ascii').split('\n'):
colons = lines.split(':')
if colons[0] == 'pub':
- size = colons[2]
- algo = colons[3]
+ size = colons[2]
+ algo = colons[3]
+ curve = colons[16] if 16 < len(colons) else None
elif colons[0] == 'fpr':
- print(draw_art(size, algo, colons[9]))
+ print(draw_art(size, algo, curve, colons[9]))
size = None
algo = None
+ curve = None
if __name__ == '__main__':
gpg_bin = os.getenv('GNUPGBIN', 'gpg')
More information about the Pgp-tools-commit
mailing list