From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.42.240.136 with SMTP id la8cs110665icb; Sun, 30 Jan 2011 16:12:45 -0800 (PST) Received: by 10.229.229.83 with SMTP id jh19mr3477521qcb.234.1296432764902; Sun, 30 Jan 2011 16:12:44 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id d13si24498087vcs.109.2011.01.30.16.12.44; Sun, 30 Jan 2011 16:12:44 -0800 (PST) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org; dkim=neutral (body hash did not verify) header.i=@gmail.com Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 14EF719783BE; Sun, 30 Jan 2011 19:12:44 -0500 (EST) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by rubyforge.org (Postfix) with ESMTP id 483881858356 for ; Sun, 30 Jan 2011 18:53:50 -0500 (EST) Received: by wyb42 with SMTP id 42so5383003wyb.23 for ; Sun, 30 Jan 2011 15:53:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:content-type:subject:from:to:date:message-id :user-agent:content-transfer-encoding; bh=J9I/9L/WJSExDGelhDyo/C1LFj3QHtaRR571CZUyjWk=; b=me+lEynJYCKOW03/EjMC5g6boO23fHxGq+8ggEC2zjHwwzOKZ9H5NZRxOII/UOUlAz es1JnPaJifvCQ1MHwCWS9cRBkq03wNEZ9dIQ+Es9i6tr9ND74D5PbFWbxHOM0BiJaw4C NNpHajLTbghs/VbZAaphgIU1Y1PW4JbOFuTMY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:subject:from:to:date:message-id:user-agent :content-transfer-encoding; b=J7H/vbpbB1Nc6oL9GtXJc9tnqrZ8NFvSbEOYOxK3qaomwxYeJJEpzi//VS+26jueu1 Qx0uLJ6yaacc7U4GpMQKLAOS+WCGgSpo6IIvqChoRooPbqZXVi++wROHp8QW3w6TK3O3 Mt7Gk7dUK3H1iN5hhr5lu2GI64l3mTJiA2FA4= Received: by 10.216.162.70 with SMTP id x48mr10305641wek.4.1296431629574; Sun, 30 Jan 2011 15:53:49 -0800 (PST) Received: from localhost (cpc12-cmbg15-2-0-cust81.5-4.cable.virginmedia.com [86.30.247.82]) by mx.google.com with ESMTPS id n1sm10457810weq.31.2011.01.30.15.53.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 30 Jan 2011 15:53:48 -0800 (PST) From: Hamish To: sup-devel Date: Sun, 30 Jan 2011 23:53:42 +0000 Message-Id: <1296431335-sup-781@whisper> User-Agent: Sup/git Subject: [sup-devel] more gpgme fixes X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org 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 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 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