EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Cannot Decrypt File

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
Posted: 02/28/2012 07:07:29
by Andrew Humphries (Standard support level)
Joined: 02/28/2012
Posts: 4

Hello all
I have downloaded the evaluation version Of SecureBlackBox, and am having trouble using the PGPWriter.Encrypt method. I can output the resultant stream to a file, however, when we attempt to Decrypt it, we are getting an Empty file. - with no errors showing.
The PGP Encrypted file Looks OK when finished (in notepad)

We are using a 3rd Party FTP decryption software. The Solution works when implementing the PGPWriter.EncryptFile method. but we need the Streaming functionality.

Please can someone tell me why this may be happening?

Public Sub gsubPGPEncodeStream()
Dim i  As Integer
Dim ADOStreamIN As ADODB.Stream
Dim ADOStreamOUT As ADODB.Stream

Dim pstrLine(5) As String
   pstrLine(1) = "Hello"
   pstrLine(2) = "This is a test"
   pstrLine(3) = "It should contain 5 lines"
   pstrLine(4) = "All on a separate line in the File."
   pstrLine(5) = "This is the Last line."
   Set ADOStreamIN = New ADODB.Stream
   Set ADOStreamOUT = New ADODB.Stream
   ADOStreamIN.Charset = "ascii"
   ADOStreamIN.LineSeparator = adCRLF
   For i = 1 To 5
      ADOStreamIN.WriteText pstrLine(i), adWriteLine
   Next i
   ElPGPKeyringx.LoadFromFiles "C:\PublicKey.asc", "", True
   If ElPGPKeyringx.GetPublicCount = 0 Then
      MsgBox "No encryption keys specified"
      Exit Sub
   End If
   ElPGPWriterX.EncryptingKeys = ElPGPKeyringx.Object
   ElPGPWriterX.EncryptionType = etPublicKey
   ' setting up signing properties
   ElPGPWriterX.UseNewFeatures = False
   ElPGPWriterX.UseOldPackets = False
   ElPGPWriterX.Armor = True
   ElPGPWriterX.ArmorHeaders.Add "Version: EldoS PGPBlackbox (ActiveX edition)"
   ElPGPWriterX.ArmorBoundary = "PGP MESSAGE"
   ElPGPWriterX.Compress = True
   ElPGPWriterX.FileName = "TestPGP.M11"
   ElPGPWriterX.TimeStamp = Now
   ElPGPWriterX.Protection = ptHigh
   ElPGPWriterX.SymmetricKeyAlgorithm = SB_PGP_ALGORITHM_SK_AES256
   ADOStreamOUT.Charset = "ascii"
   ElPGPWriterX.Encrypt ADOStreamIN, ADOStreamOUT, 0
   ADOStreamOUT.SaveToFile "C:\PGP\TestOUT.txt.PGP", adSaveCreateOverWrite
End sub
Posted: 02/28/2012 07:18:27
by Ken Ivanov (EldoS Corp.)

Thank you for contacting us.

Apparently, you are not rewinding the position of the ADOStreamIN stream back to the beginning of the stream after writing data to it and before passing the stream to ElPGPWriterX. This results in an empty chunk of data being encrypted.
Posted: 02/28/2012 08:19:18
by Andrew Humphries (Standard support level)
Joined: 02/28/2012
Posts: 4

schoolboy error!

Setting the ADOStreamIN.position = 0 before passing it to the Encryption worked.
thank you!




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