From: Christian Dietrich <stettberger@dokucode.de>
To: sup-devel <sup-devel@rubyforge.org>
Subject: Re: [sup-devel] [PATCH] Implement inline GPG
Date: Mon, 01 Mar 2010 15:36:10 +0100 [thread overview]
Message-ID: <1267454104-sup-9569@peer.zerties.org> (raw)
In-Reply-To: <1267450467-sup-4411@midna.zekjur.net>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1: Type: text/plain; charset=UTF-8, Size: 1903 bytes --]
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.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 143 bytes --]
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
next prev parent reply other threads:[~2010-03-01 14:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-18 11:40 Michael Stapelberg
2010-02-26 21:24 ` Rich Lane
2010-02-27 13:11 ` Michael Stapelberg
2010-02-27 18:05 ` Rich Lane
2010-03-01 13:45 ` Michael Stapelberg
2010-03-01 14:36 ` Christian Dietrich [this message]
2010-03-01 16:49 ` Michael Stapelberg
2010-03-01 17:46 ` Christian Dietrich
2010-03-09 16:43 ` [sup-devel] [PATCH] Implement inline GPG (updated) Michael Stapelberg
2010-03-10 21:23 ` Michael Stapelberg
2010-03-12 4:43 ` Rich Lane
2010-03-12 11:02 ` Michael Stapelberg
2010-03-15 5:19 ` 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=1267454104-sup-9569@peer.zerties.org \
--to=stettberger@dokucode.de \
--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