EldoS | Feel safer!

Software components for data protection, secure storage and transfer

DecryptAndVerify unsuccessful, but no exception generated

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#31872
Posted: 01/12/2015 17:40:37
by Tom Gauthreaux (Basic support level)
Joined: 07/22/2009
Posts: 6

I am attempting to test the decryption of a file with the wrong key. I am invoking method DecryptAndVerify on SBPGP.TElPGPReader class. I have wrappered the call in a try/catch block, but no exception is being raised. The file that I am attempting to decrypt is still encrypted after the call. Is this expected behavior? Is there a flag somewhere indicating that the decryption was/was not successful?

Thanks.
#31873
Posted: 01/13/2015 00:21:46
by Eugene Mayevski (EldoS Corp.)

DecryptAndVerify doesn't decrypt the file in-place but writes the decrypted data to the stream referenced by OutputStream property which you need to set. So if there's no data in the output stream, then decryption was not successful.


Sincerely yours
Eugene Mayevski
#31891
Posted: 01/13/2015 09:59:09
by Tom Gauthreaux (Basic support level)
Joined: 07/22/2009
Posts: 6

There is data in the OutputStream, but it is the encrypted data.
#31892
Posted: 01/13/2015 10:14:07
by Ken Ivanov (EldoS Corp.)

Hi Tom,

If TElPGPReader is unable to decrypt a file for some reason, an exception is thrown. As there is no exception in your case and you've got some data that looks like protected in the output stream, I suspect that the file you've got is not a valid encrypted file (or, as a really unlikely alternative, it is a rubbish file encrypted with an empty password).

What I suggest you to start with is to take a PGPFiles sample and check if it exposes the same behaviour. Knowing that we could decide on further steps to take to investigate the issue.

Ken
#31893
Posted: 01/13/2015 10:15:43
by Eugene Mayevski (EldoS Corp.)

This should not happen.

Is the problem reproducible with our PGPFiles sample (you will find it in <SecureBlackbox>\Samples\<language>\OpenPGPBlackbox folder) ?


Sincerely yours
Eugene Mayevski
#31894
Posted: 01/13/2015 10:22:28
by Tom Gauthreaux (Basic support level)
Joined: 07/22/2009
Posts: 6

I found the issue, and it was 'user error'. This was in the context of unit tests for some new code. The process is to encrypt the file, and subsequently decrypt it, comparing the result of the decryption to the input file. The file that I was encrypting, however, was already encrypted, therefore, once decrypted, it was still encrypted. (Encrypt re-encrypted the input file and decrypt successfully decrypted it to the original encrypted version.) Thanks for your help.
#31895
Posted: 01/13/2015 10:33:40
by Ken Ivanov (EldoS Corp.)

Hi Tom,

Great, glad to hear you've pinpointed it. Thank you for keeping us updated.

Ken
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

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