EldoS | Feel safer!

Software components for data protection, secure storage and transfer

PGPBlackBox .NET

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
Posted: 09/26/2006 05:38:35
by James Chan (Basic support level)
Joined: 09/13/2006
Posts: 3

Trying to use PGPBlackBox to encrypt with a supplier's public key and sign with our secret key...can't seem to get it working ... any help appreciated...

Public Sub SignAndEncryptToken()
Dim encryptionKey As New TElPGPKeyring
Dim signingKey As New TElPGPKeyring

Dim pgpWriter As New TElPGPWriter

Dim publicKey As New TElPGPPublicKey
Dim secretKey As New TElPGPSecretKey
Dim token As String
Dim userName As String

userName = Users.UserController.GetCurrentUserInfo.Username
pgpWriter.EncryptionType = SBPGP.TSBPGPEncryptionType.etBoth
SBUtils.Unit.SetLicenseKey("licencekey here")


signingKey.SecretKeys(0).Passphrase = "ibmfit323"
pgpWriter.Armor = True
pgpWriter.ArmorHeaders.Add("Version: EldoS PGPBlackbox (.NET edition)")
pgpWriter.ArmorBoundary = "PGP MESSAGE"

pgpWriter.EncryptingKeys = encryptionKey
pgpWriter.SigningKeys = signingKey
pgpWriter.EncryptionType = TSBPGPEncryptionType.etBoth

pgpWriter.Passphrases.Text = "xxxeeeddd"

pgpWriter.InputIsText = True

token = DateTime.UtcNow + "," + "TestUser"
Dim memStream As New MemoryStream
Dim outStream As System.IO.FileStream
outStream = New System.IO.FileStream("c:\temp\encryptedtoken.txt", FileMode.Create)

Dim data() As Byte = Encoding.Unicode.GetBytes(token)

memStream.Write(data, 0, data.Length)

pgpWriter.EncryptAndSign(memStream, outStream, 0)

pgptoken.Value = outStream.ToString()

End Sub
Private Sub pgpWriter_OnKeyPassphrase(ByVal Sender As Object, ByVal key As SBPGPKeys.TElPGPCustomSecretKey, ByRef Passphrase As String, ByRef Cancel As Boolean) Handles pgpWriter.OnKeyPassphrase
Dim pass As String

pass = "xxxeeeddd"
Passphrase = pass
End Sub
Posted: 09/26/2006 05:56:35
by Eugene Mayevski (EldoS Corp.)

What is your exact problem? Do you get an error or no output or what?

Does the sample application work?

Sincerely yours
Eugene Mayevski
Posted: 09/26/2006 06:06:21
by James Chan (Basic support level)
Joined: 09/13/2006
Posts: 3

It works, but the supplier claims it is not encrypted with their public key.

Posted: 09/27/2006 08:02:22
by Ken Ivanov (EldoS Corp.)

Your code seems to be correct at first glance. Would you be so kind to provide us the public key of your supplier so that we could try to reproduce the issue in our conditions? There won't be any security risk, since the key is public and [in general case] can be given to everyone. You can use either the helpdesk system (http://www.eldos.com/support/ticket_list.php) or support@eldos.com address to send us the key.

BTW, are you using the latest build of SecureBlackbox?
Posted: 10/19/2006 04:58:55
by Rav Panesar (Basic support level)
Joined: 10/19/2006
Posts: 14

Hi Innokentiy

I have taken over for James at the company and are still stuck with the original query, could i raise a ticket with this query?
Posted: 10/19/2006 05:16:09
by Ken Ivanov (EldoS Corp.)

Sure. Actually, we plan to publish a new build update later today, so first of all I suggest you to upgrade to it when it is available and check if the problem still exists.
Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.



Topic viewed 3988 times

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


Back to top

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

Got it!