From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 Received: by 10.96.157.163 with HTTP; Sat, 10 May 2014 09:54:58 -0700 (PDT) In-Reply-To: <1399708417-sup-4178@ultralap.site> References: <1399708417-sup-4178@ultralap.site> Date: Sat, 10 May 2014 18:54:58 +0200 Message-ID: Subject: Re: [sup-devel] check keys before sending From: Gaute Hope To: Sup developer discussion Content-Type: multipart/alternative; boundary=f46d0432b276043a7304f90e9318 --f46d0432b276043a7304f90e9318 Content-Type: text/plain; charset=UTF-8 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 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 > > --f46d0432b276043a7304f90e9318 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I think this can be included if you test and verify the pa= tch. 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. =C2=A0However, 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. =C2=A0I 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
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {:operation =3D> "encrypt&qu= ot;, :options =3D> gpg_opts}) || gpg_opts
=C2=A0 =C2=A0 =C2=A0recipients =3D to + [from]
=C2=A0 =C2=A0 =C2=A0recipients =3D HookManager.run("gpg-expand-keys&qu= ot;, { :recipients =3D> recipients }) || recipients
+
+ =C2=A0 =C2=A0# make sure all recipients can be encrypted-to
+ =C2=A0 =C2=A0recipients.each do |recipient|
+ =C2=A0 =C2=A0 =C2=A0if GPGME::Key.find(:public, recipient).length =3D=3D = 0 and !BufferManager.ask_yes_or_no("Could not encrypt to #{recipient}.= Really send?")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0raise Error, "Send message cancelled.&quo= t;
+ =C2=A0 =C2=A0 =C2=A0end
+ =C2=A0 =C2=A0end
+
=C2=A0 =C2=A0 =C2=A0begin
=C2=A0 =C2=A0 =C2=A0 =C2=A0if GPGME.respond_to?('encrypt')
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cipher =3D GPGME.encrypt(recipients, form= at_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


--f46d0432b276043a7304f90e9318--