EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Importing GnuPG private key into OpenPGP gives Invalid PGP Packet err

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
Posted: 03/28/2007 09:13:08
by Mike Coates (Basic support level)
Joined: 03/28/2007
Posts: 4

I am pretty new to the world of PGP so apologies for anything daft I happen to say.
We have a public and private key generated using GnuPG which we would like to use in a .Net implementation of OpenPG. As part of this I am trying to import the GnuPG keys into OpenPG for the purpose of decryption. Using the sample PGPKeysDemo application I am able to import a public key with no problem. If I try and import the private key however, an "Invalid PGP Packet" error is issued.
The code for this is:
tempKeyring.Load("", openFileDialog.FileName, True)
'I replaced the public key part with private key.

I have also tried within my own code using the following to import both the public and private keys but again to no avail:

Public Function PGPImportKeyFiles(ByVal publicKey As String, ByVal privateKey As String) As String
Dim pgpky As SBPGPKeys.TElPGPKeyring = New SBPGPKeys.TElPGPKeyring

pgpky.Load(publicKey, privateKey, True)
'whereapon it fails with the error:

End Function

Is this something which is not supposed to work? (and therefore me being ignorant!) or is there something obvious I am missing?

Any help would be greatly appreciated!



ps: I forgot to mention that the same keys import with no error into GnuPG so it's unlikely to do with a data corruption
Posted: 03/28/2007 10:07:12
by Eugene Mayevski (Team)

FYI: the name of the package is OpenPGPBlackbox, not OpenPGP or OpenPG. OpenPGP is a different library.

Regarding the key loading:
are you loading a key or keyring? These are different entities. If you are loading the key, try creating an instance of TElPGPSecretKey and use its loading methods to read the data.

Also you can use HelpDesk ( http://www.eldos.com/support/ticket_list.php ) to pass the key to us for checking.

Sincerely yours
Eugene Mayevski
Posted: 03/28/2007 10:31:43
by Mike Coates (Basic support level)
Joined: 03/28/2007
Posts: 4

Hi Eugene,

Thanks for the prompt reply. I am loading a key not a keyring. I have now tried using an instance of TElGPSecretKey and used the loadfromfile method but still the same error. Is this the only method I need to call or do I need to supply the object with other properties first?
Not sure about sending a private key for checking...
The key definitely imports into GnuPG. Is there a possible key versioning issue here?
The header reads:
Version: GnuPG v1.2.1 (GNU/Linux)

Also, from the code I sent, was the Load method of a TE1PGPKeyRing not correct for loading keys into a keyring?

Again, any further help much appreciated.

Kind Regards,

Posted: 03/28/2007 11:03:54
by Eugene Mayevski (Team)

This is the only method you need to call. Unfortunately we can't help you without having a key. You can create some sample key and if it doesn't work either, post a sample key.

Sincerely yours
Eugene Mayevski



Topic viewed 2362 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!