From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.86.59.13 with SMTP id h13cs369827fga; Mon, 1 Mar 2010 06:36:41 -0800 (PST) Received: by 10.224.95.202 with SMTP id e10mr2323851qan.171.1267454200547; Mon, 01 Mar 2010 06:36:40 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 6si9915095qwd.4.2010.03.01.06.36.40; Mon, 01 Mar 2010 06:36:40 -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 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 1C9FF1588076; Mon, 1 Mar 2010 09:36:40 -0500 (EST) Received: from peer.zerties.org (peer.zerties.org [188.40.33.175]) by rubyforge.org (Postfix) with ESMTP id 8695E18582D7 for ; Mon, 1 Mar 2010 09:36:18 -0500 (EST) Received: from stettberger by peer.zerties.org with local (Exim 4.69) (envelope-from ) id 1Nm6jH-00022K-24 for sup-devel@rubyforge.org; Mon, 01 Mar 2010 15:36:15 +0100 From: Christian Dietrich To: sup-devel In-reply-to: <1267450467-sup-4411@midna.zekjur.net> References: <1266493070-sup-7733@midna.zekjur.net> <1267219197-sup-2428@zyrg.net> <1267276103-sup-6406@midna.zekjur.net> <1267293663-sup-2241@zyrg.net> <1267450467-sup-4411@midna.zekjur.net> Date: Mon, 01 Mar 2010 15:36:10 +0100 Message-Id: <1267454104-sup-9569@peer.zerties.org> User-Agent: Sup/git MIME-Version: 1.0 Subject: Re: [sup-devel] [PATCH] Implement inline GPG 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: , Content-Type: multipart/mixed; boundary="===============0441420463==" Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org --===============0441420463== Content-Transfer-Encoding: 8bit Content-Type: multipart/signed; micalg="pgp-sha1"; boundary="=-1267454175-60393-7813-7505-1-="; protocol="application/pgp-signature" --=-1267454175-60393-7813-7505-1-= Content-Type: text/plain; charset=UTF-8 Excerpts from Michael Stapelberg's message of Mo Mär 01 14:45:54 +0100 2010: > Hi Rich, > > Excerpts from Rich Lane's message of Sa Feb 27 19:05:58 +0100 2010: > > The problem is sign_start will be nil if the text isn't on a line by > > itself, causing a crash a few lines later. This happened to me when I > How about using the following solution? > > gpg_start = "-----BEGIN PGP SIGNED MESSAGE-----" > gpg_end = "-----END PGP SIGNED MESSAGE-----" > gpg = lines.select { |l| true if l =~ /#{gpg_start}/ .. l =~ /#{gpg_end}/ } > msg.body = gpg.join("\n") > > Is there a way to avoid the ugly "true if"? When just leaving it out, ruby > complained saying "ArgumentError: bad value for range". Hi, there, tried this, but broke on this specific message, cause the string was included but there was no signature. This works for me: 517 ## Check for inline-PGP 518 if body =~ /^-----BEGIN PGP SIGNED MESSAGE-----/ 519 gpg_start = "^-----BEGIN PGP SIGNED MESSAGE-----" 520 gpg_signature = "^-----BEGIN PGP SIGNATURE-----" 521 gpg_end = "^-----END PGP SIGNED MESSAGE-----" 522 gpg = lines.select { |l| true if l =~ /#{gpg_start}/ .. l =~ /#{gpg_end}/ } 523 body = lines.select { |l| true if l =~ /#{gpg_start}/ .. l =~ /#{gpg_signature}/ } 524 msg = RMail::Message.new 525 msg.body = gpg.join("\n") 526 527 payload = RMail::Message.new 528 payload.body = body[1..-2].join("\n") 529 530 File.open("/tmp/msg", "w+") {|f| f.write(msg.body)} 531 File.open("/tmp/payload", "w+") {|f| f.write(payload.body)} 532 return [CryptoManager.verify(nil, msg, false), message_to_chunks(payload)].flatten.compact 533 end greetz didi -- No documentation is better than bad documentation -- Das Ausdrucken dieser Mail wird urheberrechtlich verfolgt. --=-1267454175-60393-7813-7505-1-= Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBAgAGBQJLi9DaAAoJEBQksfbRvb+aPNEP/R/BAMCkxlifeRU956n19CIo z7qfh4VynSpE3Z9UZPaSQB5boaa74Fou6463DrhAaL2lR4/6rVq6XPJKlbfBKzxl N4lcF+/3MMkFpZQ42elYXhuL3Vxvx+HtekNdCzUX/TidCX/rZJNUv3wIrLvCvY4P BRh57KsOGoYYxwP5u54NF8r9G4Mem34sKz3ViH8DaZS4Adq1VAmuNt/RJ6q7g2u+ 1eEnvtXWqczbsJ2dAcZw/yYuyMlZ67/UW95rgPCH1Ezoii+JBQIDhmgSJCp7gE1E W/X3do74ntLEsBL//fyBUrW3g8q/1w5bMR51DNIvTNRLjhtqVJQTBelNMP6+e9aH KqaBZSqWAocsRWDAl2VKjcqC785ROiS/ul2V/M3+Goeazhk/0ZzRTJcg6xqIyZYp a7A4MQge5bUzLpgd70BWWuhXF4A8jnWt4BeLZ0GM4jzL2u0uVco663jhMgVN24W6 oGxk1WQHg1vol+YO047mD830RzGThqM2VGcjEqlXSzjIIicqVGkZvaOGIHEnQKxa KbmmMixxJ82SAMispZ1GepNXaJoQhpN6SCgprwKGSfY+B/I9Jcy7JnJ3Hj2Y7vGG 0EP4b6G6rqW+RYHO+c/yx7IAFBJKK7kRUAemm9RNrtFIx74+IlhFXIfw44fd1ZmQ T1RMdKeEeBRP4JVcSe6q =uyVc -----END PGP SIGNATURE----- --=-1267454175-60393-7813-7505-1-=-- --===============0441420463== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel --===============0441420463==--