From: Hamish <dmishd@gmail.com>
To: sup-devel <sup-devel@rubyforge.org>
Subject: [sup-devel] more gpgme fixes
Date: Sun, 30 Jan 2011 23:53:42 +0000 [thread overview]
Message-ID: <1296431335-sup-781@whisper> (raw)
I've pushed a couple more patches to the gpgme branch and to next.
One fixes the issue where sup would send a message you wanted signed
or encrypted without signing or encrypting it when the key (or
gpg-agent) is not available. For some reason GPGME doesn't complain
but just returns an empty string. The patch checks for this case and
complains.
The other one shows the full fingerprint of keys used to sign messages
if the key is not trusted.
Hamish Downer
commit ac321bd89a72dba74e9b2ff182be0b5fc89a61fc
Author: Hamish Downer <dmishd@gmail.com>
Date: Sun Jan 30 23:37:45 2011 +0000
Catch case where gpg-agent not running or key not available
GPGME does not raise an Error when the key is not available (say
gpg-agent is not running, or the key is on removable media and has
been removed). In these cases GPGME returns a zero length string.
This patch checks the returned string and raises an error if it has
zero length.
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
index 5f1b730..6f6797b 100644
--- a/lib/sup/crypto.rb
+++ b/lib/sup/crypto.rb
@@ -68,6 +68,13 @@ EOS
raise Error, "GPG command failed. See log for details."
end
+ # if the key (or gpg-agent) is not available GPGME does not complain
+ # but just returns a zero length string. Let's catch that
+ if sig.length == 0
+ info "GPG failed to generate signature: check that gpg-agent is running and your key is available."
+ raise Error, "GPG command failed. See log for details."
+ end
+
envelope = RMail::Message.new
envelope.header["Content-Type"] = 'multipart/signed; protocol=application/pgp-signature'
@@ -96,6 +103,13 @@ EOS
raise Error, "GPG command failed. See log for details."
end
+ # if the key (or gpg-agent) is not available GPGME does not complain
+ # but just returns a zero length string. Let's catch that
+ if cipher.length == 0
+ info "GPG failed to generate cipher text: check that gpg-agent is running and your key is available."
+ raise Error, "GPG command failed. See log for details."
+ end
+
encrypted_payload = RMail::Message.new
encrypted_payload.header["Content-Type"] = "application/octet-stream"
encrypted_payload.header["Content-Disposition"] = 'inline; filename="msg.asc"'
commit 9b1721cce09fc18bd9975d9b24918c8c314aaabe
Author: Hamish Downer <dmishd@gmail.com>
Date: Sun Jan 30 23:43:14 2011 +0000
Add full fingerprint for untrusted keys
When the key that signed a message is not trusted, show the full
fingerprint, as the gpg binary does.
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
index 6f6797b..5a38f27 100644
--- a/lib/sup/crypto.rb
+++ b/lib/sup/crypto.rb
@@ -307,6 +307,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(":")
else
trusted = true
end
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
reply other threads:[~2011-01-31 0:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1296431335-sup-781@whisper \
--to=dmishd@gmail.com \
--cc=sup-devel@rubyforge.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox