How do I list all recipient of a message (including myself)?

Peter Pentchev roam at ringlet.net
Thu May 12 12:07:37 CEST 2011


On Thu, May 12, 2011 at 06:11:14AM +0200, Jerome Baum wrote:
> On Thu, May 12, 2011 at 04:49, lists at mgreg.com <lists at mgreg.com> wrote:
> >
> > I am writing application in which I need to know if a GnuPG encrypted
> > message was sent to me.  It seems that whenever you list the recipients of a
> > message it will list every recipient but you -- even if you're one of them.
> >  Surely there's a way to reveal whether or not you're one of those
> > recipients...?
> >
> 
> There doesn't seem to be a with-colons version of this, but it's a start:
> 
> $ gpg -vv --list-only cron.log.gpg

Well, there's always gpg --list-packets --with-colons, which outputs
something like:

:pubkey enc packet: version 3, algo 1, keyid 08D014DED0B337AA
        data: [4095 bits]
:pubkey enc packet: version 3, algo 16, keyid 921EB6497074473C
        data: [1024 bits]
        data: [1021 bits]
:encrypted data packet:
        length: 69
        mdc_method: 2
:compressed packet: algo=2
:literal data packet:
        mode b (62), created 1305194688, name="foo.txt",
        raw data: 4 bytes

...so just look for the "pubkey enc packet" lines, get the key IDs and
possibly pass them through another round of "gpg --list-keys --with-colons"
or something.

G'luck,
Peter

-- 
Peter Pentchev	roam at ringlet.net roam at FreeBSD.org peter at packetscale.com
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
If I were you, who would be reading this sentence?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: </pipermail/attachments/20110512/fb0e4f3c/attachment.pgp>


More information about the Gnupg-users mailing list