transfer private key data between applications

David Shaw dshaw at jabberwocky.com
Tue Aug 12 16:18:41 CEST 2008


On Aug 12, 2008, at 5:16 AM, Lorenz, Michael wrote:

> Hello GNU-PG users,
>
> I have a question regarding the export of a private key.
>
> I want to transfer the key-pair of a GPG installation to a Java  
> program (using for example the GNU-Crypto library). Since there is a  
> very large amount of encrypted records I want to avoid to create a  
> big convert-process that decrypts with GPG and encrypts again with  
> Java.
>
> As GNU-Crypto supports "ElGamal" I thought it would be possible to  
> export the private key as bytes and use this information in Java to  
> decrypt the data. But I have difficulties doing this.

You could probably work through this and get it to work, but it's not  
going to be easy.  For one, OpenPGP uses a somewhat strange cipher  
mode (a variant on CFB).  You'd also have to deal with the OpenPGP  
encoding on the packets.

Rather than do all that, take a look at http://www.bouncycastle.org/   
They have a Java library that can do OpenPGP directly.

David



More information about the Gnupg-users mailing list