<<< Date Index >>>     <<< Thread Index >>>

Re: How to activate a given GPG key through a macro...



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday, September 24 at 12:50 AM, quoth P.M.:
> Thank you very much for your reply.

You're quite welcome.

> I apologize for not being too quick in grasping the advice  you just 
> gave - being very new to this stuff - so please be patient with 
> me...

No problem.

> set pgp_sign_as=0x31577172
> set pgp --encrypt-to=0x31577172
>
> What would seem elegant to me is to replace those key 
> values with a $VARIABLE that can be changed on the fly 
> by changing a single value in the macro sequences I 
> use to change return address, hostname, realname, Bcc 
> field, etc. for each email address I have.

No, that would be silly. $pgp_sign_as *is* a variable that can be 
changed on the fly, so adding another one would be an extra 
redirection.

Here's how you'd set it in a macro:

macro index m '<enter-command>set pgp_sign_as=0x31577172<enter><mail>'

I can mix that into your existing send-mail macro if you include 
that in your message.

>> No, but you need to have the sign-as included in 
>> your pgp_*_command 
>> settings. For example, my pgp_encrypt_sign_command 
>> includes:
>> 
>>      %?a?-u %a?
>
> You lost me there... how that works goes beyond what I 
> am able to grasp at this time... 

Many mutt string variables that support formatting strings (such as 
%a) also support conditional formatting strings. Generally, if you 
include %a in a pgp command variable, it will be replaced by the 
sender of the email (e.g. you@xxxxxxxxxxxxxx, or whatever you've 
configured your pgp_sign_as to be). Thus, if you always set 
pgp_sign_as to something, you can put "-u %a" into your pgp command 
string (according to the gpg manual, -u means "sign as this user") and 
when "-u %a" is parsed by mutt, it becomes "-u you@xxxxxxxxxxxxxx", or 
something similar. Now then, to be generic, to take care of situations 
when pgp_sign_as may not be set to anything, we have a conditional. A 
conditional format string is in the format "%? formatletter ? iftrue ?", 
in other words, the string "%?a?foo?" means "if %a would produce 
anything, then use 'foo', otherwise ignore this". So, "%?a?-u %a?" 
means "if %a is would produce anything, then use '-u %a'".

Does that make sense?

~Kyle
- -- 
Preach the Gospel at all times and when necessary use words.
                                               -- St. Francis of Assisi
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iD8DBQFG9zCKBkIOoMqOI14RAvs+AJwNDn598wJtfVK26zPPMVxj+Xfa+QCfSnsz
U4Sza0dirByTz0528j2ZNwQ=
=yG1E
-----END PGP SIGNATURE-----