EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Invalid keyrin packet sequence on third party .asc public key

Posted: 05/21/2015 08:31:38
by Nick Cerny (Basic support level)
Joined: 05/21/2015
Posts: 3

Hi All,

We are trying to implement a third parties public key into our PGP key database. I am getting the following error trying to load the key through our application which uses SBPGP:

SBPGPExceptions.EElPGPInvalidPGPKeyringPacketSequence: Invalid keyring packet sequence

The public key is a .asc file. It is not armored, and I have confirmed that they are using the IDEA algorithm. Our application typically generates armored keys in base64, so the issue may be in the format of the key itself. However, since they only sent a public key for encryption purposes I am somewhat confused by the exception thrown. Can someone please elaborate on what this exception is referring to?

Posted: 05/21/2015 08:39:29
by Eugene Mayevski (Team)

Thank you for contacting us.

PGP file format contains a sequence of so-called packets of various types. For the keyring it's expected that the file contains certain packets and doesn't contain other packets. In your case the sequence of packets doesn't match the one defined in the specification.

You are welcome to post the key file to the HelpDesk ( https://www.eldos.com/helpdesk/ ). I have created a new support ticket based on your above message. You will see your (and only your) support tickets by following this URL. You will also get e-mail notifications about updates related to your support ticket.

Sincerely yours
Eugene Mayevski
Posted: 05/21/2015 08:40:47
by Nick Cerny (Basic support level)
Joined: 05/21/2015
Posts: 3

To give more information, the public key is converted from a byte() to a memory stream and then loaded into a TELPGPKeyring with the following code:

Public Function GetKeyId(ByVal pstmKey As IO.Stream, ByVal pblnPrivate As Boolean) As String
Dim arrKeyId As Byte()
Using rngKeys As New TElPGPKeyring
If pblnPrivate Then
rngKeys.Load(Nothing, pstmKey, True)
If rngKeys.SecretCount > 0 Then
arrKeyId = rngKeys.SecretKeys(0).KeyID
End If
rngKeys.Load(pstmKey, Nothing, True)
If rngKeys.PublicCount > 0 Then
arrKeyId = rngKeys.PublicKeys(0).KeyID
End If
End If
End Using
If arrKeyId Is Nothing Then
Return ""
Return Convert.ToBase64String(arrKeyId)
End If
End Function

Since I am just loading a public key we deal with the inner else clause. The exception is thrown on the line "rngKeys.Load(pstmKey, Nothing, True)."

Hope that helps paint a better picture.



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