On 10.04.2022 23:29, br...@apache.org wrote:
Author: brane
Date: Sun Apr 10 21:29:50 2022
New Revision: 1899719

URL: http://svn.apache.org/viewvc?rev=1899719&view=rev
Log:
* tools/dist/release.py:
   - Generate public key algorithm names in the same format as GnuPG 2.
   - Support DSA and RSA Sign Only keys.


This was pure guesswork based on what I have in my key file, which includes everything from KEYS:

$ gpg --list-public-keys | grep '^pub' | cut -w -f 2 | sort -u
dsa1024
dsa2048
dsa3072
ed25519
rsa1024
rsa2048
rsa3072
rsa3200
rsa4096



Modified:
     subversion/trunk/tools/dist/release.py

Modified: subversion/trunk/tools/dist/release.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/release.py?rev=1899719&r1=1899718&r2=1899719&view=diff
==============================================================================
--- subversion/trunk/tools/dist/release.py (original)
+++ subversion/trunk/tools/dist/release.py Sun Apr 10 21:29:50 2022
@@ -1323,10 +1323,13 @@ PUBLIC_KEY_ALGORITHMS = {
      # These values are taken from the RFC's registry at:
      # 
https://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-parameters-12
      #
-    # The values are callables that produce gpg1-like key length and type
-    # indications, e.g., "4096R" for a 4096-bit RSA key.
-    1: (lambda keylen: str(keylen) + 'R'), # RSA
-    22: (lambda keylen: str(keylen) + 'EDD'), # EDDSA
+    # The values are callables that produce gpg2-like key length and type
+    # indications, e.g., "rsa4096" for a 4096-bit RSA key.
+    1:  lambda keylen, _: 'rsa' + str(keylen),  # RSA
+    3:  lambda keylen, _: 'rsa' + str(keylen),  # RSA Sign Only
+    17: lambda keylen, _: 'dsa' + str(keylen),  # DSA
+    # This index is not registered with IANA but is used by gpg2
+    22: lambda _, parts: parts[16],             # EdDSA
  }

parts[16] is the name of the curve, gpg helpfully gives us that for EdDSA (and I expect for ECDSA and ECDH as well, but I don't have any such keys to test with).

def _make_human_readable_fingerprint(fingerprint):
@@ -1420,7 +1423,7 @@ def get_siginfo(args, quiet=False):
                  keytype = int(parts[3])
                  formatter = PUBLIC_KEY_ALGORITHMS[keytype]
                  long_key_id = parts[4]
-                length_and_type = formatter(keylen) + '/' + long_key_id
+                length_and_type = formatter(keylen, parts) + '/' + long_key_id
                  del keylen, keytype, formatter, long_key_id
                  break
          else:

Reply via email to