Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Gaute Hope <eg@gaute.vetsj.com>
To: Sup developer discussion <sup-devel@rubyforge.org>
Subject: Re: [sup-devel] check keys before sending
Date: Sat, 10 May 2014 18:54:58 +0200	[thread overview]
Message-ID: <CABKe4Msvczo6zDWpBCT9OZspuNObDpVdeTZ0qSDrR4Zv9djDXQ@mail.gmail.com> (raw)
In-Reply-To: <1399708417-sup-4178@ultralap.site>

[-- Attachment #1: Type: text/plain, Size: 1719 bytes --]

I think this can be included if you test and verify the patch. Definetely
very useful.


On Sat, May 10, 2014 at 10:23 AM, Troy Sankey <sankeytms@gmail.com> wrote:

> Hi sup developers,
>
> Recently I sent an encrypted message to a group of recipients, thinking
> that all their keys were still valid.  However, one of them had an
> expired key, so the message was not encrypted to that recipient and he
> could not read it.
>
> I want sup to prompt the user about potentially invalid keys before
> sending a message.  I think the code will look something like this:
>
>
> diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
> index fd8f824..88ae3cc 100644
> --- a/lib/sup/crypto.rb
> +++ b/lib/sup/crypto.rb
> @@ -167,6 +167,14 @@ EOS
>                                 {:operation => "encrypt", :options =>
> gpg_opts}) || gpg_opts
>      recipients = to + [from]
>      recipients = HookManager.run("gpg-expand-keys", { :recipients =>
> recipients }) || recipients
> +
> +    # make sure all recipients can be encrypted-to
> +    recipients.each do |recipient|
> +      if GPGME::Key.find(:public, recipient).length == 0 and
> !BufferManager.ask_yes_or_no("Could not encrypt to #{recipient}. Really
> send?")
> +        raise Error, "Send message cancelled."
> +      end
> +    end
> +
>      begin
>        if GPGME.respond_to?('encrypt')
>          cipher = GPGME.encrypt(recipients, format_payload(payload),
> gpg_opts)
>
>
> I have not tested this patch, so if it looks wrong then it probably is!
> Does anybody have any thoughts on this feature?
>
> Troy
>
> _______________________________________________
> Sup-devel mailing list
> Sup-devel@rubyforge.org
> http://rubyforge.org/mailman/listinfo/sup-devel
>
>

[-- Attachment #2: Type: text/html, Size: 2430 bytes --]

      reply	other threads:[~2014-05-10 16:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-10  8:23 Troy Sankey
2014-05-10 16:54 ` Gaute Hope [this message]

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=CABKe4Msvczo6zDWpBCT9OZspuNObDpVdeTZ0qSDrR4Zv9djDXQ@mail.gmail.com \
    --to=eg@gaute.vetsj.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