[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sup-devel] couple more gpg related patches



I've uploaded a couple more patches to the gpgme branch and merged
them into next:

* one fixes the fingerprint of untrusted keys
* the other adds "untrusted" to the signature summary line when the
key is untrusted - ie when there is no web of trust from you to that
key.

Patches below for your reading pleasure. Someone tell me if you'd
rather have less detail from me.

Hamish Downer


commit 6f1b9d7e94496543eacc63807b99fa29059ed300
Author: Hamish Downer <dmishd@gmail.com>
Date:   Wed Feb 2 21:06:22 2011 +0000

    show the FULL key fingerprint, not just the first half

diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
index 967c09e..978e145 100644
--- a/lib/sup/crypto.rb
+++ b/lib/sup/crypto.rb
@@ -313,7 +313,7 @@ private
       if signature.validity != GPGME::GPGME_VALIDITY_FULL &&
signature.validity != GPGME::GPGME_VALIDITY_MARGINAL
         output_lines << "WARNING: This key is not certified with a
trusted signature!"
         output_lines << "There is no indication that the signature
belongs to the owner"
-        output_lines << "Full fingerprint is: " + (0..9).map {|i|
signature.fpr[(i*2),2]}.join(":")
+        output_lines << "Full fingerprint is: " + (0..9).map {|i|
signature.fpr[(i*4),4]}.join(":")
       else
         trusted = true
       end



commit 0e1f5e56dc7063104c52f1b2d03a3fd85573bc47
Author: Hamish Downer <dmishd@gmail.com>
Date:   Wed Feb 2 21:02:05 2011 +0000

    signature summary now states "untrusted" if the signing key is not trusted

diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
index 5a38f27..967c09e 100644
--- a/lib/sup/crypto.rb
+++ b/lib/sup/crypto.rb
@@ -153,16 +153,18 @@ EOS
       end
     end

+    summary_line =
simplify_sig_line(verify_result.signatures[0].to_s, all_trusted)
+
     if all_output_lines.length == 0
       Chunk::CryptoNotice.new :valid, "Encrypted message wasn't
signed", all_output_lines
     elsif valid
       if all_trusted
-        Chunk::CryptoNotice.new(:valid,
simplify_sig_line(verify_result.signatures[0].to_s), all_output_lines)
+        Chunk::CryptoNotice.new(:valid, summary_line, all_output_lines)
       else
-        Chunk::CryptoNotice.new(:valid_untrusted,
simplify_sig_line(verify_result.signatures[0].to_s), all_output_lines)
+        Chunk::CryptoNotice.new(:valid_untrusted, summary_line,
all_output_lines)
       end
     elsif !unknown
-      Chunk::CryptoNotice.new(:invalid,
simplify_sig_line(verify_result.signatures[0].to_s), all_output_lines)
+      Chunk::CryptoNotice.new(:invalid, summary_line, all_output_lines)
     else
       unknown_status all_output_lines
     end
@@ -274,8 +276,12 @@ private
   end

   # remove the hex key_id and info in ()
-  def simplify_sig_line sig_line
-    sig_line.sub(/from [0-9A-F]{16} /, "from ")
+  def simplify_sig_line sig_line, trusted
+    sig_line.sub!(/from [0-9A-F]{16} /, "from ")
+    if !trusted
+      sig_line.sub!(/Good signature/, "Good (untrusted) signature")
+    end
+    sig_line
   end

   def sig_output_lines signature
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel