EldoS | Feel safer!

Software components for data protection, secure storage and transfer

KeyRing.Save and Key.Save produce different results?

Posted: 06/07/2006 14:40:07
by Brian Pavlich (Basic support level)
Joined: 06/07/2006
Posts: 3

Im using .net version of PGPBlackbox. I used the PGPKeys demo, SetLiscenceKey to our live key, then generated a key and saved it to the pkr and skr files.

Then I wrote a test app and found that the following code produced two different armored files. The contents are different between pub_keyring.asc and pub_key.asc, and also between sec_keyring.asc and sec_key.asc.

SBPGPKeys.TElPGPKeyring keyRing = new SBPGPKeys.TElPGPKeyring();

keyRing.Load("pub_keyring.pkr", "sec_keyring.skr", true);
keyRing.Save("pub_keyring.asc", "sec_keyring.asc", true);

SBPGPKeys.TElPGPSecretKey secKey = keyRing.get_SecretKeys(0);
secKey.SaveToFile("sec_key.asc", true);

SBPGPKeys.TElPGPPublicKey pubKey = keyRing.get_PublicKeys(0);
pubKey.SaveToFile("pub_key.asc", true);

Also, if I try to load the files saved from the keyring I get EElPGPInvalidPacketException:

keyRing.Load("pub_keyring.asc", "sec_keyring.asc", true);

Although, it handles the files saved from the keys:

keyRing.Load("pub_key.asc", "sec_key.asc", true);

Should I avoid using keyRing.Save to save armored files? Please explain why I am seeing differences. Thank you.
Posted: 06/07/2006 16:34:17
by Ken Ivanov (Team)

TElPGPPublicKey.SaveToXXX() is intended to write standalone keys. It does not write several keyring-specific packets, such as trust packets. That's why these methods produce different results. You can use either TElPGPKeyring.Save() or TElPGPPublicKey.SaveToXXX for saving your keys.

However, it is recommended to use TElPGPKeyring.Load() for loading PGP keys, since a lot of PGP implementations do not conform to the PGP specification when saving standalone keys. Roughly speaking, TElPGPKeyring.Load is more liberal than TElPGPPublicKey.Load().

Also, if I try to load the files saved from the keyring I get EElPGPInvalidPacketException:

It is quite strange. Does this error appear with PGPKeys demo application (it uses TElPGPKeyring.Save() to save the keys)?
Posted: 06/08/2006 10:15:07
by Brian Pavlich (Basic support level)
Joined: 06/07/2006
Posts: 3

Yes, it happens with the PGPKeys demo. I have tried differrent variations and it seems like it has something to do with the email domain.

In SaveKeyRing(), I added one line to also save an armored version of the keys:

keyring.Save(dlg.tbPublicKeyring.Text, dlg.tbSecretKeyring.Text, false);
keyring.Save(dlg.tbPublicKeyring.Text + ".asc", dlg.tbSecretKeyring.Text + ".asc", true);
Status("Keyring saved");

I only seem to get the packet error when I use our company's domain in the address. I have tried variations of the [person]@[domain], where I change [person] and different passphrases. It only seems to happen when I use our company's [domain].

I have attached a sample key for you to examine.

[ Download ]
Posted: 06/08/2006 10:21:40
by Brian Pavlich (Basic support level)
Joined: 06/07/2006
Posts: 3

To be clear, I only have the error when I am loading the armored ".asc" version of the keys. It does not have a problem with the non-armored version.

Its not a show stopper, just an anomaly I figured you guys might want to know about.
Posted: 06/09/2006 01:26:23
by Ken Ivanov (Team)

Thank you very much for the sample key. We will investigate the issue and give you an answer you then.
Posted: 06/09/2006 04:55:38
by Ken Ivanov (Team)

There is a small bug in the implementation that results in incorrect armouring of some PGP keys. We are working on a fix at the moment. The fix will be included to the following build of SecureBlackbox.

Thank you very much for pointing us at this problem.



Topic viewed 9148 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!