[Pgp-tools-commit] r830 - in trunk: debian gpg-key2latex

Guilhem Moulin guilhem-guest at moszumanska.debian.org
Tue Feb 2 18:04:53 UTC 2016


Author: guilhem-guest
Date: 2016-02-02 18:04:53 +0000 (Tue, 02 Feb 2016)
New Revision: 830

Modified:
   trunk/debian/changelog
   trunk/debian/copyright
   trunk/gpg-key2latex/gpg-key2latex
Log:
gpg-key2latex: show curve name for EC (sub)keys.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2016-02-02 18:04:49 UTC (rev 829)
+++ trunk/debian/changelog	2016-02-02 18:04:53 UTC (rev 830)
@@ -15,6 +15,8 @@
       independently in uppercase.)
     + Enclose (sub)key capabilities in square brackets, to match GnuPG 2.1.11+'s
       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.
 
  -- Guilhem Moulin <guilhem at guilhem.org>  Tue, 02 Feb 2016 14:31:32 +0100
 

Modified: trunk/debian/copyright
===================================================================
--- trunk/debian/copyright	2016-02-02 18:04:49 UTC (rev 829)
+++ trunk/debian/copyright	2016-02-02 18:04:53 UTC (rev 830)
@@ -91,7 +91,7 @@
 License:  BSD-2-clause
 
 Files: gpg-key2latex/*
-Copyright: © 2014  Guilhem Moulin <guilhem at guilhem.org>
+Copyright: © 2014-2016  Guilhem Moulin <guilhem at guilhem.org>
 License:  GPL-3+
 
 License: GPL-3+

Modified: trunk/gpg-key2latex/gpg-key2latex
===================================================================
--- trunk/gpg-key2latex/gpg-key2latex	2016-02-02 18:04:49 UTC (rev 829)
+++ trunk/gpg-key2latex/gpg-key2latex	2016-02-02 18:04:53 UTC (rev 830)
@@ -3,7 +3,7 @@
 # gpg-key2latex -- Generate a LaTeX file for fingerprint slips.
 # $Id$
 #
-# Copyright (c) 2014 Guilhem Moulin <guilhem at guilhem.org>
+# Copyright (c) 2014-2016 Guilhem Moulin <guilhem at guilhem.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
@@ -109,7 +109,7 @@
                         next;
                     }
                     chomp;
-                    if (/^pub:([^:]*):([^:]*):([^:]*):([0-9A-F]{16}):(\d+):(\d*):(?:[^:]*:){4}([^:]*)/) {
+                    if (/^pub:([^:]*):([^:]*):([^:]*):([0-9A-F]{16}):(\d+):(\d*):(?:[^:]*:){4}([^:]*)(:.*)?$/) {
                         my $keyid = $4;
                         if ($1 =~ /[eir]/ or $7 =~ /D/) {
                             warn "Ignoring unusable key $keyid.\n";
@@ -120,6 +120,7 @@
                             $key{creation} = $5;
                             $key{expiration} = $6 if $6 ne '';
                             $key{caps} = $7;
+                            $key{curve} = $1 if defined $8 and $8 ne '' and $8 =~ /^(?::[^:]*){4}:([^:]+)/;
                         }
                         next;
                     }
@@ -133,7 +134,7 @@
                         push @{$key{uids}}, { type => 'uid', text => Encode::decode_utf8($text) };
                         next;
                     }
-                    if (/^sub:([^:]+):([^:]*):([^:]*):([0-9A-F]{16}):(\d+):(\d*):(?:[^:]*:){4}([^:]*)/) {
+                    if (/^sub:([^:]+):([^:]*):([^:]*):([0-9A-F]{16}):(\d+):(\d*):(?:[^:]*:){4}([^:]*)(:.*)?$/) {
                         undef $sub;
                         next if $1 =~ /[eir]/ or $7 =~ /D/; # ignore unsable subkey
                         $sub = {};
@@ -142,6 +143,7 @@
                         $sub->{creation} = $5;
                         $sub->{expiration} = $6 if $6 ne '';
                         $sub->{caps} = $7;
+                        $sub->{curve} = $1 if defined $8 and $8 ne '' and $8 =~ /^(?::[^:]*){4}:([^:]+)/;
                         next;
                     }
                     if (/^fpr:(?:[^:]*:){8}([0-9A-F]{40})(?::.*)?$/) {
@@ -268,7 +270,10 @@
             $key->{algo} == 16 ? 'elg'.$key->{length} : # Elgamal encrypt only
             $key->{algo} == 17 ? 'dsa'.$key->{length} : # DSA
             $key->{algo} == 20 ? 'xxx'.$key->{length} : # Elgamal encrypt+sign (legacy)
-                                 '?'  .$key->{length};
+            $key->{algo} == 18 ? $key->{curve} // ('ecdh'.$key->{length}) :  # ECDH
+            $key->{algo} == 19 ? $key->{curve} // ('ecdsa'.$key->{length}) : # ECDSA
+            $key->{algo} == 22 ? $key->{curve} // ('eddsa'.$key->{length}) : # EDDSA
+                                 "unknown_$key->{algo}";
     $str .= '/'.substr($key->{fpr},-8).' ';
     $str .= strftime '%Y-%m-%d', localtime($key->{creation});
     $str .= ' [expires: '.strftime('%Y-%m-%d', localtime($key->{expiration})).']'




More information about the Pgp-tools-commit mailing list