Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /pius [6f5843] .. [e4108c] Maximize Restore

  Switch to side-by-side view

--- a/pius
+++ b/pius
@@ -103,6 +103,32 @@
 
 Generated by PIUS (http://www.phildev.net/pius/).
 '''
+
+CERT_LEVEL_INFO = '''Each certification level means something specific and is a
+public statement by you about this UID on this key. The following definitions
+are taken from the GnuPG man page.
+
+0   means you make no particular claim as to how carefully you verified the
+    key.
+
+1   means you believe the key is owned by the person who claims to own it but
+    you could not, or did not verify the key at all. This is useful for a
+    "persona" verification, where you sign the key of a pseudonymous user.
+
+2   means you did casual verification of the key. For example, this could mean
+    that you verified the key fingerprint and checked the user ID on the key
+    against a photo ID.
+
+3   means you did extensive verification of the key. For example, this could
+    mean that you verified the key fingerprint with the owner of the key in
+    person, and that you checked, by means of a hard to forge document with a
+    photo ID (such as a passport) that the name of the key owner matches the
+    name in the user ID on the key, and finally that you verified (by exchange
+    of email) that the email address on the key belongs to the key owner.
+
+Note that the examples given above for levels 2 and 3 are just that: examples.
+In the end, it is up to you to decide just what "casual" and "extensive" mean to
+you.'''
 
 def debug(line):
   '''Print a line, if debug is on, preceeded with DEBUG:.'''
@@ -253,6 +279,9 @@
       keyids = [ i[1] for i in key_tuples ]
     return keyids
 
+  def _print_cert_levels(self):
+    print CERT_LEVEL_INFO
+
   def check_fingerprint(self, key):
     '''Prompt the user to see if they have verified this fingerprint.'''
     cmd = ('%s %s --no-default-keyring --keyring %s --fingerprint %s'
@@ -262,30 +291,36 @@
     debug(cmd)
     gpg = subprocess.Popen(cmd, shell=True, stdin=None, stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE, close_fds=True)
-    for line in gpg.stdout.readlines():
-      if line != '\n':
-        print line.strip()
+    output = gpg.stdout.read()
+    output = output.strip()
     gpg.wait()
     retval = gpg.returncode
     if retval != 0:
       print 'WARNING: Keyid %s not valid, skipping.' % key
       return False
 
-    ans = 'y'
-    while ans == 'y':
-      ans = raw_input('\nHave you verified this user/key, and if so, what level'
-                      '\ndo you want to sign at? (0/1/2/3/N/q) [default: N] ')
+    print output
+
+    while True:
+      ans = raw_input("\nHave you verified this user/key, and if so, what level"
+                      " do you want to sign at?\n  0-3, Show again, Next, Help,"
+                      " or Quit? [0|1|2|3|s|n|h|q] (default: n) ")
+      print
+
       if ans == 'y':
-        print ('\n"Yes" is no longer a valid answer, please specify a level to'
+        print ('"Yes" is no longer a valid answer, please specify a level to'
                ' sign at.')
-
-    print
-    if ans in ('0', '1', '2', '3'):
-      return ans
-    elif ans in ('q', 'Q'):
-      print 'Dying at user request'
-      sys.exit(1)
-    return False
+      elif ans in ('n', 'N', ''):
+        return False
+      elif ans in ('s', 'S'):
+        print output
+      elif ans in ('0', '1', '2', '3'):
+        return ans
+      elif ans in ('?', 'h', 'H'):
+        self._print_cert_levels()
+      elif ans in ('q', 'Q'):
+        print 'Dying at user request'
+        sys.exit(1)
 
   def get_mail_pass(self):
     '''Prompt the user for their passphrase.'''
@@ -444,7 +479,7 @@
         debug('Filename is a duplicate')
         count = 2
         while True:
-          test = '%s_%s' % (filename, count) 
+          test = '%s_%s' % (filename, count)
           debug('Trying %s' % test)
           if test not in unique_files:
             debug('%s worked!' % test)
@@ -541,7 +576,7 @@
       # We don't catch this, but that's fine, if this errors, a stack
       # trace is what we want
       raise GpgUnknownError
-    
+
   def _export_key(self, keyring, key, path):
     '''Internal function used by other export_* functions.'''
     if os.path.exists(path):