Re: How to activate a given GPG key through a macro...
- To: mutt-users@xxxxxxxx
- Subject: Re: How to activate a given GPG key through a macro...
- From: Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx>
- Date: Sun, 23 Sep 2007 22:35:39 -0500
- Comment: DomainKeys? See http://domainkeys.sourceforge.net/
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=memoryhole.net; h=date:from:to:subject:message-id:references:mime-version:content-type:in-reply-to; q=dns/txt; s=default; bh=5O53qTnuWbLyvEYP6fVqbJ63cq8=; b=K1VDtRPaH/luG4AZKOSy5zjMWBDTDTb96zr9mrisgnnREq83RmpCNlpbDcmww58VVR6a5qKlKeU7619rq+/37U/BGMeMhY+Jyr8F/3xE2bJyhDtYpbAMjflmGU0Jyh4Od8Gca3NMS2UkCBSM+xNcx4BrH5UZHSpH3bxT7ceus+M=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=memoryhole.net; b=OFcguEYIOd5wTeQ+mecfoQEb+lEg9CkAU626Q+80ZC3DHirODMUNntQbu+4x9GuNwaRiDXSE6Rj9rHeB67XZ4StFgnISN2gknPEdK3iBnhyiaduSJcbV0GbktmLYN098OQOpOP34c0I/sTANjqfjmZKwCAmdSPhX/2buU6vfNZg=; h=Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent;
- In-reply-to: <140542.22237.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- List-post: <mailto:mutt-users@mutt.org>
- List-unsubscribe: send mail to majordomo@mutt.org, body only "unsubscribe mutt-users"
- Mail-followup-to: mutt-users@xxxxxxxx
- References: <20070923215759.GO8500@xxxxxxxxxxxxx> <140542.22237.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Sender: owner-mutt-users@xxxxxxxx
- User-agent: Mutt/1.5.16 (2007-09-10)
-----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-----