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:

Code

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

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.

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'.

We use cookies to help provide you with the best possible online experience. By using this site, you agree that we may store and access cookies on your device. You can find out more about and set your own preferences here.