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

[sup-devel] [PATCH] Stop worrying notice when encrypted email not signed



Stop worrying notice when encrypted email not signed

When no signature is present, there was a message saying
"Unable to determine validity of cryptographic signature".
This fix means that if there are no error messages and no
messages about signature verification then the message is
assumed to not be signed at all. This fix also saves the
encrypted messages to a temp file with a suffix of .asc
to stop gpg complaining about "unknown suffix".

Hamish Downer
From 38e01f89178f06c3a29d494b56fe28c0aa82de81 Mon Sep 17 00:00:00 2001
From: Hamish Downer <dmishd@gmail.com>
Date: Sun, 17 Oct 2010 23:25:20 +0100
Subject: [PATCH] Stop worrying notice when no signature present

When no signature is present, there was a message saying
"Unable to determine validity of cryptographic signature".
This fix means that if there are no error messages and no
messages about signature verification then the message is
assumed to not be signed at all. This fix also saves the
encrypted messages to a temp file with a suffix of .asc
to stop gpg complaining about "unknown suffix".
---
 lib/sup/crypto.rb |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
index 386dbb8..fd4c91c 100644
--- a/lib/sup/crypto.rb
+++ b/lib/sup/crypto.rb
@@ -108,6 +108,9 @@ EOS
       else
         Chunk::CryptoNotice.new :invalid, $1, output_lines
       end
+    elsif output_lines.length == 0 && rc == 0
+      # the message wasn't signed
+      Chunk::CryptoNotice.new :valid, "Encrypted message wasn't signed", output_lines
     else
       unknown_status output_lines
     end
@@ -139,7 +142,7 @@ EOS
   def decrypt payload, armor=false # a RubyMail::Message object
     return unknown_status(cant_find_binary) unless @cmd
 
-    payload_fn = Tempfile.new "redwood.payload"
+    payload_fn = Tempfile.new(["redwood.payload", ".asc"])
     payload_fn.write payload.to_s
     payload_fn.close
 
-- 
1.7.1

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