Hi,
While working on a derived SymmetricAlgorithm class I ran into issues
considering the CTS CipherMode. None of built-in classes seem to implement
this mode, and while it isn't even a recommended mode, I still wanted to add
support in my own class for backwards compatibility. I however can't seem to
get the final two blocks to be passed in TransformFinalBlock. In fact, when
the "to be" encrypted source stream equals a multiple of BlockSize the
method is not called at all, only TransformBlock. Because of this, I don't
know how to determine I have to perform the final transformation. In fact,
this does not only affect CTS mode, but it also affects padding in certain
situations for other modes (where padding of BlockSize in bits is required,
even if the stream length equals a multiple of BlockSize).
Does anybody have any idea where I am going wrong or is the only solution
inheriting CryptoStream and adding this support, only to hope MS will add
support for this later? I prefer not to write a custom inherited
CryptoStream.
Working with VS 2003, C#. I hope I made myself clear enough...
Kind regards/thanks in advance,
Martijn
|