[Pgp-tools-commit] r669 - in trunk/keyart: . doc

Aaron Toponce atoponce-guest at moszumanska.debian.org
Wed Jun 18 22:06:02 UTC 2014


Author: atoponce-guest
Date: 2014-06-18 22:06:02 +0000 (Wed, 18 Jun 2014)
New Revision: 669

Modified:
   trunk/keyart/doc/keyart.1
   trunk/keyart/keyart
Log:
add exit code 3 for fingerprints that are not hexadecimal

Modified: trunk/keyart/doc/keyart.1
===================================================================
--- trunk/keyart/doc/keyart.1	2014-06-18 21:54:44 UTC (rev 668)
+++ trunk/keyart/doc/keyart.1	2014-06-18 22:06:02 UTC (rev 669)
@@ -47,6 +47,16 @@
 .TP 8
 .B \-h | \-\-help
 Print the help message and quit.
+.SH EXIT Codes
+.TP 8
+.B 0
+\fBkeyart\fR was executed sucessfully.
+.TP 8
+.B 1
+\fBgpg\fR(1) or \fBgpg2\fR(1) are not installed.
+.TP 8
+.B 2
+The supplied hexadecimal string is not a multiple of 8 bytes.
 .SH SEE ALSO
 .BR gpg (1)
 .SH AUTHOR

Modified: trunk/keyart/keyart
===================================================================
--- trunk/keyart/keyart	2014-06-18 21:54:44 UTC (rev 668)
+++ trunk/keyart/keyart	2014-06-18 22:06:02 UTC (rev 669)
@@ -43,7 +43,11 @@
     visits = [0]*209
     temp = ''
 
-    key_bin = bin(int(key_fpr, 16))[2:].zfill(len(key_fpr)*4)
+    try:
+        key_bin = bin(int(key_fpr, 16))[2:].zfill(len(key_fpr)*4)
+    except ValueError:
+        print "The supplied fingerprint is not a hexadecimal string."
+        sys.exit(3)
 
     for i, char in enumerate(key_bin):
         temp += char




More information about the Pgp-tools-commit mailing list