EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Encryption failed : Unexpected end of data.

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.
#13066
Posted: 04/21/2010 13:56:32
by Hamid Noorbakhsh (Basic support level)
Joined: 09/09/2008
Posts: 11

I have a piece of working code that is now throwing the error 'Encryption failed : Unexpected end of data.'

try
{
TElPGPReader pgpReader = new TElPGPReader();

pgpReader.DecryptingKeys = readingKeyring;
pgpReader.VerifyingKeys = readingKeyring;

FileStream streamInput, streamOutput;

streamInput = new FileStream(FileName, FileMode.Open);
streamInput.Position = 0;
try
{
streamOutput = new FileStream(NewOutputFileName, FileMode.Create);
try
{
pgpReader.OutputStream = streamOutput;
pgpReader.DecryptAndVerify(streamInput, 0);
}
catch (Exception e1)
{
throw e1;
}
finally
{
streamOutput.Close();
}
}
catch (Exception e2)
{
throw e2;
}
finally
{
streamInput.Close();
}
}
catch (Exception e3)
{
//More stuff here
}


The error occurs on line:
pgpReader.DecryptAndVerify(streamInput, 0);

this was working code and when I step through old code it still works, but in new code using the new version it fails. I have even tried to set the position on input stream to zero incase that was the case, but no luck.

Any suggestion to resolve this would be appreciated.
#13068
Posted: 04/21/2010 14:07:44
by Eugene Mayevski (EldoS Corp.)

What do you mean by "old code" and "new code"?


Sincerely yours
Eugene Mayevski
#13069
Posted: 04/21/2010 14:12:19
by Eugene Mayevski (EldoS Corp.)

Also, before we continue, please assign the license ticket to the user account as described in the registration e-mail.


Sincerely yours
Eugene Mayevski
#13070
Posted: 04/21/2010 15:26:32
by Hamid Noorbakhsh (Basic support level)
Joined: 09/09/2008
Posts: 11

Eugene,
I registered in 2008, so registration email is no longer available. Please provide more info since I failed to locate what you asked for "assign the license ticket to the user account" in my profile.

By old code and new code I mean we have two branches. Both have the code above and the only difference is that each use a different version of SecureBlackBox as mentioned earlier. So after upgrade our newly compiled code, with (7.2.0.167) does not work, but the one from the old branch, referencing the older version (7.0.0.156) works fine. We have not touched our code.

You may send me an email for how to 'assign the license ticket to the user account' please. I would appreciate it.
#13071
Posted: 04/21/2010 15:47:15
by Eugene Mayevski (EldoS Corp.)

I don't see your name in the list of registered customers. I will move this question to HelpDesk for resolution.


Sincerely yours
Eugene Mayevski
#13133
Posted: 04/27/2010 11:50:30
by Ankur Patel (Standard support level)
Joined: 09/24/2007
Posts: 6

Could we get some support on this please since I am the original developer back from vacation now and can see this in code, or should I start a new thread?
#13134
Posted: 04/27/2010 12:30:32
by Ken Ivanov (EldoS Corp.)

Sure. Could you please provide some more information regarding the problem:
1) Is the code in the first message of the topic the actual code you are using?
2) What software was used to create the protected file(s)?
3) The complete call stack of the exception you get.
#13137
Posted: 04/27/2010 16:45:02
by Ankur Patel (Standard support level)
Joined: 09/24/2007
Posts: 6

Innokentiy,
1.The code is same as above, it was a copy and paste from the original code.
2.We use your libraries for encyption. This was noticed in QA. It was working till we upgraded 7.0.0.156 to 7.2.0.167. It throws the exception on
pgpReader.DecryptAndVerify(streamInput, 0);
Like it is explained above if we use the 7.0.0.156 for both encryption and decryption, it works fine, but when we use the same with 7.2.0.167 it fails.
3. Here is the call stack:

at SBPGP.TElPGPReader.Synchronize()
at SBPGP.TElPGPReader.DecryptAndVerify(Stream ASourceStream, Int64 Count)
at EncryptionPlugin.AMEncryptPlugin.AMActionPluginTemplate.IAMActions.Execute(String strTagline, Int32& iErrorCode, String& strErrorText) in C:\Dev8\AutoMate7-VS\Plugins\EncryptionPlugin\EncryptionPlugin\PGPEncryption.cs:line 4188

Not very much. -COMPlusExceptionCode was -532459699 if that helps at all also.

Thanks.
#13141
Posted: 04/27/2010 22:02:47
by Ken Ivanov (EldoS Corp.)

Thank you.

Can you please encrypt some arbitrary file with your encrypting code using the sample keys included to the distribution and post it here for investigation?
#13144
Posted: 04/28/2010 10:35:51
by Ankur Patel (Standard support level)
Joined: 09/24/2007
Posts: 6

Innokentiy,
I encoded with your sample keys and tried to decrypt and got the error.

Please also be advised that the error occurs more than 50% of time but sometime it works with no error. For example today I tried three times and first two times it succeeded. So I am posting the file that did not decrypt and threw the error. It might work just fine on other times.

Other note: The keys that were used for testing to report this originally were created using your sample key management program.


[ Download ]
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

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