It seems that you need rather low level of the XTS-AES implementation instead of XtsStream
, which is high-level API.
I have made our internal XTS-AES implementation public, so you can use it now like this:
using (var xts = new Rebex.Security.Cryptography.Xts(encryptionKey, tweakingKey))
{
Console.WriteLine(BitConverter.ToString(plaintext));
xts.EncryptSector(tweak, plaintext, 0, plaintext.Length, encrypted, 0);
Console.WriteLine(BitConverter.ToString(encrypted));
xts.DecryptSector(tweak, encrypted, 0, encrypted.Length, plaintext, 0);
Console.WriteLine(BitConverter.ToString(plaintext));
}
Please note, that if you want to encrypt (or decrypt) data using more EncryptSector
calls, the input sector (data length) should be multiple of the Xts.BlockSize
(currently 16 bytes).
Also please note, that the single sector (input for the EncryptSector
method) has to be at least Xts.BlockSize
bytes long (currently at least 16 bytes).
You can download trial version here.
Update: This has been released with Rebex Security 2018 R1.