Home All Groups Group Topic Archive Search About

must use weak key in 3des

Author
15 Sep 2005 7:57 AM
Steen
Hi,

I am trying to convert this Java code into C#:

JAVA:
SecretKeySpec systemKey = new SecretKeySpec("TEST KEYTEST KEYTEST
KEY".getBytes(), "TripleDES");
Cipher cipher = Cipher.getInstance(DESEDE_ECB_NONE);
cipher.init(Cipher.ENCRYPT_MODE, systemKey);
byte[] eac = cipher.doFinal(cardRandom); //CardRandom is a byte-array

I have tried various approaches, but everytime I get stuck at the same point:
I am not allowed to use "TEST KEYTEST KEYTEST KEY" in TripleDES, as it is a
wek key.

Does anyone see how to convert the above Java-code ?

I will be very thankfull !

Author
15 Sep 2005 8:51 AM
Flensted
Found the solution myself:
I need to use DES, not TripleDES.
One TripleDES with "TEST KEYTEST KEYTEST KEY" is apparently the same as
three DES with "TEST KEY".
Logical when you think about it...


Show quoteHide quote
"Steen" wrote:

> Hi,
>
> I am trying to convert this Java code into C#:
>
> JAVA:
> SecretKeySpec systemKey = new SecretKeySpec("TEST KEYTEST KEYTEST
> KEY".getBytes(), "TripleDES");
> Cipher cipher = Cipher.getInstance(DESEDE_ECB_NONE);
> cipher.init(Cipher.ENCRYPT_MODE, systemKey);
> byte[] eac = cipher.doFinal(cardRandom); //CardRandom is a byte-array
>
> I have tried various approaches, but everytime I get stuck at the same point:
> I am not allowed to use "TEST KEYTEST KEYTEST KEY" in TripleDES, as it is a
> wek key.
>
> Does anyone see how to convert the above Java-code ?
>
> I will be very thankfull !
>
>