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

2011-05-16 Thread Werner Koch
On Thu, 12 May 2011 04:49, li...@mgreg.com said:

 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...?

$ fortune | gpg2 -er alpha@example -r bravo@example x
[...]
$ gpg2 --status-fd 1 --with-colons --list-only --batch x
[GNUPG:] ENC_TO 5381EA4EE29BA37F 16 0
[GNUPG:] ENC_TO 6AE6D7EE46A871F8 16 0
[GNUPG:] ENC_TO B58845F7F409CD54 1 0
[GNUPG:] BEGIN_DECRYPTION
[GNUPG:] END_DECRYPTION

The ENC_TO lines show you the recipients:

ENC_TO  long_keyid  keytype  keylength
The message is encrypted to this LONG_KEYID.  KEYTYPE is the
numerical value of the public key algorithm or 0 if it is not
known, KEYLENGTH is the length of the key or 0 if it is not
known (which is currently always the case).  Gpg prints this
line always; Gpgsm only if it knows the certificate.

The first line above is for the bravo key, the second line for the alpha
key and the third line is my own encryption key.  If a hidden recipient
(option -R) is used you see  for the long keyid.


Shalom-Salam,

   Werner


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.


___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


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

2011-05-12 Thread Peter Pentchev
On Thu, May 12, 2011 at 06:11:14AM +0200, Jerome Baum wrote:
 On Thu, May 12, 2011 at 04:49, li...@mgreg.com li...@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  r...@ringlet.net r...@freebsd.org pe...@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?


signature.asc
Description: Digital signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


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

2011-05-11 Thread li...@mgreg.com
Hi All,

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...?

Regards,

Michael
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


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

2011-05-11 Thread Charly Avital
li...@mgreg.com 6c0bda71-fd0a-4c30-ae59-50d5fb8e4...@mgreg.com wrote
on 5/11/11 10:49:04 PM:
 Hi All,
 
 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...?
 
 Regards,
 
 Michael

You can try this, but I don't know how to integrate it into your
application:

- launch Terminal and type gpg. This will output:
gpg: Go ahead and type your message ...

- copy/page the encrypted message. If it was encrypted to your public
key, your will be prompted to enter your passphrase. After you enter it,
the output will display to which user IDs and public keys the message
was encrypted, like:
-
You need a passphrase to unlock the secret key for
user: Charly Avital shavi...@mac.com
4096-bit RSA key, ID 02345678, created 2011-03-26 (main key ID ABCDEF1)

[and after you type in the passphrase]:

gpg: encrypted with [the second recipient's key]
  [the second recipient's user ID]
gpg: encrypted with 4096-bit RSA key, ID 02345678, created 2011-03-26
  Charly Avital shavi...@mac.com


Charly



___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


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

2011-05-11 Thread Jerome Baum
On Thu, May 12, 2011 at 04:49, li...@mgreg.com li...@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
 :pubkey enc packet: version 3, algo 1, keyid 
 data: [2048 bits]
 gpg: public key is 
 :encrypted data packet:
 length: unknown
 mdc_method: 2


Normally, the key IDs would be in there of course, I just always throw them.

-- 
Jerome Baum

tel +49-1578-8434336
email jer...@jeromebaum.com
-- 
PGP: A0E4 B2D4 94E6 20EE 85BA E45B 63E4 2BD8 C58C 753A
PGP: 2C23 EBFF DF1A 840D 2351 F5F5 F25B A03F 2152 36DA
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users