[Pgp-tools-commit] r738 - trunk/keyart

Aaron Toponce atoponce-guest at moszumanska.debian.org
Thu Nov 27 16:58:40 UTC 2014


Author: atoponce-guest
Date: 2014-11-27 16:58:40 +0000 (Thu, 27 Nov 2014)
New Revision: 738

Modified:
   trunk/keyart/keyart
Log:
improve stripping non-hex chars from fpr code


Modified: trunk/keyart/keyart
===================================================================
--- trunk/keyart/keyart	2014-11-24 22:17:00 UTC (rev 737)
+++ trunk/keyart/keyart	2014-11-27 16:58:40 UTC (rev 738)
@@ -5,6 +5,7 @@
 
 import argparse
 import os
+import re
 import subprocess
 import sys
 
@@ -251,12 +252,12 @@
 
 if __name__ == '__main__':
     gpg_bin = test_env()
+    strip_nonhex = re.compile('[^a-fA-F0-9]+')
 
     cmd = [gpg_bin, '--no-options', '--with-colons', '--fingerprint']
     if ARGS.fingerprint:
         for fpr in ARGS.fingerprint:
-            # remove any possible colons, as is common with fingerprints
-            fpr = fpr.translate(None, ':')
+            fpr = strip_nonhex.sub('',fpr)
             if len(fpr) % 8 != 0:
                 print("Hex string must be a multiple of 8 bytes.")
                 sys.exit(2)




More information about the Pgp-tools-commit mailing list