views:

213

answers:

3

Is there any implementation of AES-XTS written in C# available in the Internet? Bouncy Castle disappointed me :( I took the source codes of TrueCrypt and FreeOTFE but they are written in C which is very hard for me to understand... Anyone?

+1  A: 

I guess you can implement it yourself: http://axelkenzo.ru/index.php?downloads=1619-2007-NIST-Submission.pdf

FractalizeR
+1  A: 

Here is the link to a site which gives a C code to download which implements C and XTS. I did not test it. You can wrap C code to C#.

Thanx john, but I have already downloaded it :( If only i could understand the code in it :D
Ranhiru Cooray
+1  A: 

I don't know XTS mode, but.... I had a similar situation with AES in CTR mode and C#. The AES encryption capability that's built-in to the .NET Framework does not include CTR mode.

I studied a bit more and found out that the block transform for CTR mode is really just the result of XOR'ing the plaintext with an AES ECB transform of a monotinically-increasing counter. With that understanding, I was able to implement a AES CTR mode pretty easily on top of the AES ECB mode that is built into the .NET BCL.

Is XTS mode similar? I don't know.


EDIT Looks like XTS is an Xor-Encrypt-Xor approach, with a Tweaked Code book and Cipher Text Stealing. (I didn't know this). In that case, you should be able to implement XTS building upon the existing AES stuff in the .NET Framework BCL.

Cheeso
XTS i think is too much for me to handle. There's not much references and code samples except in C/C++ for it and too much maths involved. I think AES+CBC+CTS would be a good choice of encryption and mode of operation.
Ranhiru Cooray