[Mono-list] Replace the default windows
system.security.cryptography classes with mono
spouliot at videotron.ca
Wed May 18 10:36:28 EDT 2005
> How would you do accomplish this?
1. Create a new assembly, e.g. Daniel.Crypto.dll
2. Copy the algorithms you want in it, e.g. SHA1Managed
3. Edit the machine.config file to remap SHA1 to
"System.Security.Cryptography.SHA1Managed, Daniel.Crypto, version, culture,
> Editing machine.config?
Yes. That's how the runtime will use the new, or alternate, classes.
But keep in mind that this works _only_ if the applications were written
_correctly_, i.e. that they used the Create static methods  to create new
instance of cryptographic classes. Code that directly creates an instance of
a specific type  will continue to use the MS version of the algorithm
(the constructors shouldn't have been made public but it's a little too late
 SHA1 hash = SHA1.Create ();
 SHA1 hash = new SHA1CryptoServiceProvider ();
> What happens
> then to classes like CryptographyException, which are not explicitly
> mapped in machine.config?
Your new assembly needs to link to mscorlib.dll so the
CryptographicException will still be from MS (like the underlying code that
the algorithms uses, e.g. Buffer.BlockCopy).
home: spouliot at videotron.ca
More information about the Mono-list