I am using PGP to encrypt files and then transfer using apache-camel. I was able to encrypt and decrypt using camel-crypto.
PGPDataFormat pgpDataFormat=new PGPDataFormat();
pgpDataFormat.setKeyFileName("0x6E1A09A4-pub.asc");
pgpDataFormat.setKeyUserid("user@domain.com");
pgpDataFormat.marshal(exchange, exchange.getIn().getBody(File.class), exchange.getIn().getBody(OutputStream.class));
I need to provide the KeyUserId
and public key. I want to extract this user id from public key.
$ gpg --import 0x6E1A09A4-pub.asc
gpg: key 6E1A09A4: public key "User <user@domain.com>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
If i import it using gpg
command line cli, it shows the userId. How can get that userId from public key in java?