Find correct key id's

Mohan Radhakrishnan mohanr at fss.co.in
Tue Jul 27 16:00:42 CEST 2010


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 test123 at test.co.in --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( "test123 at test.co.in"
)){
	        			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:expires2010 at ymail.com] 
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:0EE14841E1FD8545B7E084F22AEF9681031FAE84 at fssbemail.fss.india>,
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:expires2010 at ymail.com

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




More information about the Gnupg-users mailing list