Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Gaudenz Steinlin <gaudenz@soziologie.ch>
To: sup-devel@rubyforge.org
Subject: [sup-devel] [PATCH] Explicitly specify signature hashing algorithm
Date: Thu, 07 Oct 2010 19:50:13 +0200	[thread overview]
Message-ID: <1286473693-sup-8792@meteor.durcheinandertal.local> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1697 bytes --]

Sup used to add a micalg=pgp-sha1 parameter in Content-Type header of a
signed message, but used whatever the user had configured as his
preferred hasing algorithm in gpg.conf. This lead to unverifiable
signatures in some MUAs.

This adds an explicit --digest-algo option to the gpg call to override
any user configured setting. It also upgrades the algorithm to sha256 as
sha1 is being phased out now.
---
 lib/sup/crypto.rb |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
index 289fb0e..2bd5350 100644
--- a/lib/sup/crypto.rb
+++ b/lib/sup/crypto.rb
@@ -45,14 +45,14 @@ EOS
 
     sig_fn = Tempfile.new "redwood.signature"; sig_fn.close
 
-    message = run_gpg "--output #{sig_fn.path} --yes --armor --detach-sign --textmode --local-user '#{from}' #{payload_fn.path}", :interactive => true
+    message = run_gpg "--output #{sig_fn.path} --yes --armor --detach-sign --textmode --digest-algo sha256 --local-user '#{from}' #{payload_fn.path}", :interactive => true
     unless $?.success?
       info "Error while running gpg: #{message}"
       raise Error, "GPG command failed. See log for details."
     end
 
     envelope = RMail::Message.new
-    envelope.header["Content-Type"] = 'multipart/signed; protocol=application/pgp-signature; micalg=pgp-sha1'
+    envelope.header["Content-Type"] = 'multipart/signed; protocol=application/pgp-signature; micalg=pgp-sha256'
 
     envelope.add_part payload
     signature = RMail::Message.make_attachment IO.read(sig_fn.path), "application/pgp-signature", nil, "signature.asc"
-- 
1.7.1

--
Ever tried. Ever failed. No matter.
Try again. Fail again. Fail better.
~ Samuel Beckett ~

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 482 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

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

             reply	other threads:[~2010-10-07 18:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-07 17:50 Gaudenz Steinlin [this message]
2010-10-08  4:20 ` Rich Lane

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=1286473693-sup-8792@meteor.durcheinandertal.local \
    --to=gaudenz@soziologie.ch \
    --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