Home All Groups Group Topic Archive Search About

Any Obfuscator can hide the Key & iv?

Author
6 Oct 2006 4:56 PM
Jon
Hi,
In my program i use the TripleDES class to do the encryption, and i have
key( ) and iv( ) in that class for encrypt/decrypt a string.

I do not have any full version of obfuscate, and I only use dotfuscator
which comes FREE with VS2005. However my problem is that, now using
Reflector, I can clearly see my Key & iv, and this is really a big problem
for me....

Do you know any good obfuscator that can hide the key & iv? I am willing to
purchase it, if it can do the job.

Otherwise are there any suggestion?

Currently my program need to decrypt a string(serial no.) everytime it load
on the client machine.

Any help is appreciate, Many thanks.
Jon

Author
7 Oct 2006 10:21 AM
Claus Konrad
Hi

This will not present the "ultimate" solution - but does make it much harder
to retrieve the secret key used for symmetric encryption (3DES).

1) Write a random string like below.
2) Compute the hash (bytearray) of this string
3) Take the ness. bytes from this large bytearray (step 2)
4) Do an array copy to populate the IV and KEY (see below)

Now you have your key (m_sysKey) and IV (m_sysVector).
They are not known to anybody (incl. yourself!), but is consistently
generated at runtime and will produce the same result every time.


//value used for creating hashvalue
byte[] originalValue =
System.Text.Encoding.Unicode.GetBytes("kdksdiekdiealksdjfklasjfdslfkjasl..........<very long string>................fæa");

//create a hash over the key and initialization vector
SHA256Managed sha = new SHA256Managed();
m_sysKey = sha.ComputeHash(originalValue);


/// <summary>
/// Perform encryption
/// </summary>
public string Encrypt(string data)
{

//get appropriate key and IV
byte[] sysKey = new byte[m_requiredKeyLength];
byte[] sysVector = new byte[m_requiredIVLength];

Array.Copy(m_sysKey, sysKey, m_requiredKeyLength);
Array.Copy(m_sysKey, sysVector, m_requiredIVLength);


....stuff...




Show quoteHide quote
"Jon" wrote:

> Hi,
> In my program i use the TripleDES class to do the encryption, and i have
> key( ) and iv( ) in that class for encrypt/decrypt a string.
>
> I do not have any full version of obfuscate, and I only use dotfuscator
> which comes FREE with VS2005. However my problem is that, now using
> Reflector, I can clearly see my Key & iv, and this is really a big problem
> for me....
>
> Do you know any good obfuscator that can hide the key & iv? I am willing to
> purchase it, if it can do the job.
>
> Otherwise are there any suggestion?
>
> Currently my program need to decrypt a string(serial no.) everytime it load
> on the client machine.
>
> Any help is appreciate, Many thanks.
> Jon
Author
7 Oct 2006 10:40 AM
Marcello Cantelmo
Hi Jon,

a good obfuscator confuses the code but *not* the inner methods, property,
ect. of the classes of .NET FW (.key, .iv, ect.)

..NET FW is much vulnerable!  an aggressor can modify the .NET FW just so as
to to make to visualize yours key :-o

....in this way, it turns out superfluous, also the decompilation of the .NET
code :'-(

best regards,
Marcello Cantelmo
www.cantelmosoftware.com