[Mono-list] Crypto issues and workarounds

Elan Feingold efeingold@mn.rr.com
Sun, 9 Mar 2003 12:47:07 -0600


Hi,

I found a few things that presented problems when moving crypto .NET
code over to Mono:

(1) The Mono symmetric key cypto providers have CanReuseTransform ==
false, whereas .NET defines them to be true. This wouldn't have been
that much of a problem, except that this code:

Debug.Assert (encrypt.CanReuseTransform);

Didn't actually fire in any way to let me know this wasn't the case.
Anything I need to do to get these assertions to trigger?

(2) In creating a CryptoStream to compute an MD5 hash, the .NET code was
finishing up by calling:

stream.FlushFinalBlock();
stream.Close();

With .NET, it turns out that calling Flush or FlushFinalBlock or neither
before the Close results in the same hash, whereas with Mono, you *must
not* call FlushFinalBlock, or it will "screw up" the hash.

Having worked around these issues, my program (client/server, one on
.NET and one on Linux) interoperate perfectly!!

Best regards,

-elan