views:

53

answers:

3

Hi,

I am using RijndaelManaged in my current project to encrypt data , is there any way tht I can check whether the data is already encrypted or not so i don't end up encrypting it twice?

A: 

If data can be compressed, then it normally means encryption (or other compression) has not been applied.

leppie
any idea how to check whether data is compressed or not in .net
Punit
Compress it, and see if it the same size or larger.
leppie
A: 

I think this question is a close match to what you are asking. Please leave a comment if the answers to that question were not enough.

Ando
i checked the solution given in the link, but do you think it is really good tht we shud unecessarily decrypt the value to check whether data is encrypted or not, i don't think so, it impacts perfomance.
Punit
A: 

No, there is no reliable way to know whether the data you are examining has already been encrypted. Most plaintext has biases or patterns that can be detected, but those techniques are not guaranteed to work in general. You need to add additional structure to the ciphertext (or the plaintext), for example each ciphertext message or block begins with a 128-bit pattern.

GregS