Hi,
       I think as a newbie I was confused because --list-packets and BC
API printed two different ID's. Correct me if I am wrong.


It looks like when I use a user id like this and encrypt

gpg --output readme.gpg --recipient [email protected] --encrypt
CHANGE.txt     

the output from "--list-packets readme.gpg" is 2048-bit RSA key, ID
6540BD43, created 2010-02-11 (main key ID 202AAEDC)


but when I use code like this to get a key for encrption

            while ( rings.hasNext()) {

                PGPPublicKeyRing ring = (PGPPublicKeyRing) rings.next();

                key = ring.getPublicKey();

                                if( null == key ){
                                        throw new
KeyNotFoundException();
                                }

                        for( Iterator userIds = key.getUserIDs() ;
userIds.hasNext() ; ){

                                userId = ( String )userIds.next();

                        }
                                //Read from properties file
                                if( userId.equals( "[email protected]"
)){
                                        break;
                                }
            }

The output from --list-packets is 2048-bit RSA key, ID 202AAEDC, created
2010-02-11

So it looks like in the first instance it shows the sub-key but in the
second case it seems to be showing the main key.

Thanks,
Mohan

-----Original Message-----
From: MFPA [mailto:[email protected]] 
Sent: Tuesday, July 27, 2010 6:16 PM
To: Mohan Radhakrishnan on GnuPG-Users
Cc: Mohan Radhakrishnan
Subject: Re: Find correct key id's

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi


On Tuesday 27 July 2010 at 12:29:19 PM, in
<mid:[email protected]>,
Mohan Radhakrishnan wrote:


> Hi,

> I have some questions about matching key id's.

> 1. I am trying to find the key id of the key that
> encrypted a file so that I can use the corresponding
> decrypting key.

Is "--try-all-secrets" not helping you?

- --
Best regards

MFPA                    mailto:[email protected]

There is no job so simple that it cannot be done wrong
-----BEGIN PGP SIGNATURE-----

iQCVAwUBTE7U/6ipC46tDG5pAQpXXgP/WKyGdIHaUJGiRAhKE+xg3u77S7P/PoMu
vBrtgc8/VPt9qTKzm8viDNKf/oB6pCn1Km8IhYI+9QtxEpLpz4tNuR5WuUBFae8a
IB9P4NKCmDV+GROUpfZQtDskks259lMkUfDICsMvOvlmWRs6k7AdMQA70ITaHQSS
AVGZz8cSB/o=
=VSsN
-----END PGP SIGNATURE-----


_______________________________________________
Gnupg-users mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to