EldoS | Feel safer!

Software components for data protection, secure storage and transfer

ERROR : SBPGPExceptions.EElPGPInvalidDataException was unhandled

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
#17154
Posted: 07/27/2011 05:28:10
by Taylor Mouse (Basic support level)
Joined: 07/27/2011
Posts: 8

This is my code

Code

            TElPGPKeyring keyring = new TElPGPKeyring();
            TElPGPPublicKey publicKey = new TElPGPPublicKey();
            TElPGPSecretKey privateKey = new TElPGPSecretKey();
            
            SBUtils.Unit.SetLicenseKey(SBUtils.Unit.BytesOfString("..."));

            publicKey.LoadFromFile(publicKeyFile);
            privateKey.LoadFromFile(privateKeyFile);
            keyring.AddPublicKey(publicKey);
            keyring.AddSecretKey(privateKey);

            TElPGPReader reader = new TElPGPReader();
            reader.DecryptingKeys = keyring;
            reader.KeyPassphrase = passPhrase;

            Stream outputStream = new FileStream(destFile, FileMode.OpenOrCreate);
            Stream inputStream = new FileStream(sourceFile, FileMode.Open);
            reader.OutputStream = outputStream;
            reader.DecryptAndVerify(inputStream, 0);


Followed the steps on this url:
[URL]http://www.eldos.com/documentation/sbb/documentation/ref_howto_pgp_files_verify.html[/URL]


but I get this error everytime:

Code
SBPGPExceptions.EElPGPInvalidDataException was unhandled
  Message=Unexpected packet
  Source=SecureBlackbox.PGP
  StackTrace:
       at SBPGP.TElPGPProcessingUnit.CreateProcessingStream()
       at SBPGP.TElPGPProcessingUnit.Write(Byte[] Buffer, Int32 Offset, Int32 Count)
       at SBPGP.TElPGPReader.Synchronize()
       at SBPGP.TElPGPReader.DecryptAndVerify(Stream ASourceStream, Int64 Count)
       at Euphony.ASpider.BlackBox.Decrypt(String sourceFile, String destFile) in G:\Euphony\Projects\AspiderSync\Euphony.ASpider\BlackBox.cs:line 115
       at Euphony.ASpider.OverallProcess..ctor() in G:\Euphony\Projects\AspiderSync\Euphony.ASpider\OverallProcess.cs:line 48
       at Test_ASpiderServer.Program.Main(String[] args) in G:\Euphony\Projects\AspiderSync\Test_ASpiderServer\Program.cs:line 13
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()



I'm spending too much time finding a solution, can someone please help

VS2010 .NET 3.5

T.
#17155
Posted: 07/27/2011 05:38:59
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

Hi. Have you tried our PGPFilesDemo? Does it work with your files?
#17158
Posted: 07/27/2011 05:54:54
by Taylor Mouse (Basic support level)
Joined: 07/27/2011
Posts: 8

No, there is an application that needs to be rewritten, and part of the code is the decrypting of some files, send to us by a 3rd party.

The code seems to be working there, but not when I use it in my code, could this be that the initial code was written in .NET 2.0 and I'm now using 3.5 ?

T.
#17159
Posted: 07/27/2011 06:06:45
by Taylor Mouse (Basic support level)
Joined: 07/27/2011
Posts: 8

Btw, where can I find this PGPFilesDemo ?

T.
#17160
Posted: 07/27/2011 06:10:59
by Vsevolod Ievgiienko (EldoS Corp.)

Hello.

You can find them in \EldoS\SecureBlackbox.NET\Samples\C#\OpenPGPBlackbox folder.
#17161
Posted: 07/27/2011 06:15:57
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

I asked about the demo to localize the problem - is it inside your code, our library or in files sent to you.
Also a good idea is to try your code with our sample keys and files, produced by PGPFilesDemo.
#17162
Posted: 07/27/2011 06:29:21
by Taylor Mouse (Basic support level)
Joined: 07/27/2011
Posts: 8

YOu mean I need to install it first, because I only copied the assemblies I needed such as
SecureBlackBox
SecureBlackBox.PGP
SecureBlackBox.PKI


and nothing more, well except for the public and secure pgp keyfiles of course ?


T.
#17163
Posted: 07/27/2011 06:38:42
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

Yeah, you need to install SecureBlackbox to access demos, documentation and all other stuff.
#17164
Posted: 07/27/2011 06:43:03
by Taylor Mouse (Basic support level)
Joined: 07/27/2011
Posts: 8

Btw, the code I provided in the first topic, is it already the correct approach for decrypting files ?

downloading now

T.
#17166
Posted: 07/27/2011 06:52:59
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

Yes, your code looks ok.
Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.

Reply

Statistics

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