EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SBPGPExceptions.EElPGPInvalidPacketException: Invalid PGP packet

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
Posted: 10/23/2006 08:31:36
by Ken Ivanov (Team)

What exactly do you mean by 'corruption'? Are these bytes absent or incorrect?

Besides, is the .asc file loaded by PGPKeysDemo correctly?
Posted: 10/23/2006 08:33:33
by Rav Panesar (Basic support level)
Joined: 10/19/2006
Posts: 14

sorry i mean they are incorrect, they both have a length of 1185 but the last 60 are incorrect. I think the PGPKeys demo files are loaded correctly.
Posted: 10/23/2006 09:11:48
by Ken Ivanov (Team)

Just a guess... The 'Export key' button of PGPKeys demo application exports only a *public* key (i.e., the secret part of a key is not exported). Probably, that's the real reason for the problem (i.e., you are passing a public key to the TElPGPSecretKey.LoadFromStream() method). To teach the demo export secret keys too, please patch the ExportKey() method in the following way:
   Private Sub ExportKey()
      Dim key As TElPGPPublicKey

        If (Not (tvKeyring.SelectedNode Is Nothing)) AndAlso (TypeOf tvKeyring.SelectedNode.Tag Is TElPGPPublicKey) Then
            key = tvKeyring.SelectedNode.Tag
            If (saveFileDialog.ShowDialog() = DialogResult.OK) Then
                key.SaveToFile(saveFileDialog.FileName, True)
                If Not (key.SecretKey Is Nothing) Then
                    key.SecretKey.SaveToFile(saveFileDialog.FileName + ".skr", True)
                End If
                Status("Key saved")
            End If
        End If
   End Sub
Posted: 10/23/2006 09:21:32
by Rav Panesar (Basic support level)
Joined: 10/19/2006
Posts: 14


Now i am getting the following error
SBPGPExceptions.EElPGPInvalidKeyException: Invalid PGP key data at SBPGPKeys.TElPGPSecretKey.LoadFromStream(Stream Stream) at TestSSO_v1.SignAndEncryptToken() in c:\inetpub\wwwroot\PortalComponents\TestSSO_v1.aspx.vb:line 106

is there a number that i can go through with you just to see whether i am going wrong somewhere.

Posted: 10/23/2006 09:35:39
by Ken Ivanov (Team)

Most likely, you are passing a public key to TElPGPSecretKey.LoadFromStream() method. Please check if the *secret* key is passed (it's header is 'BEGIN PGP PRIVATE KEY BLOCK').
Posted: 10/23/2006 09:40:19
by Rav Panesar (Basic support level)
Joined: 10/19/2006
Posts: 14

actually when looking at the code from the webconfig both headers say public key, so the question is how to use the PGPKeysdemo to convert a .gpg to a .asc file?
Posted: 10/23/2006 09:51:29
by Ken Ivanov (Team)

Please read one of my previous posts (10/23/2006 09:11:48), it describes how to improve PGPKeysDemo to make it support export of secret keys.
Posted: 10/23/2006 10:10:33
by Rav Panesar (Basic support level)
Joined: 10/19/2006
Posts: 14


I have read your post on the following URL


I used the keys demo in 2 different ways

1) I loaded a keyring and selected the public and private keys then exported them with the new code you sent.
2) I clicked the button add a key and then exported that

When I look at both the headers they are the same

Version: SecureBlackbox 4 (PGPBlackbox)


Version: SecureBlackbox 4 (PGPBlackbox)

The keys are slightly different at the bottom of both.

I just want to make sure I have the right private key in an .asc format, then I will re-test and let you know. Was I looking at the right post? If not could you please point me to the right URL.

Posted: 10/23/2006 10:26:26
by Ken Ivanov (Team)

The demo improved in a way I described above creates two key files (e.g., 'mykey' and 'mykey.skr'). The first one contains a public key, and the second one stores a secret key. The header for the secret key should look like 'BEGIN PGP PRIVATE KEY BLOCK'.
Posted: 10/23/2006 10:32:59
by Rav Panesar (Basic support level)
Joined: 10/19/2006
Posts: 14

excellent that has worked, will now continue the code, thanks for the help.
Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.



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