-->

Use TripleDESCryptoServiceProvider class in Silver

2020-07-29 17:56发布

问题:

I use a web service to authenticate. And this web service use the TripleDes algorithm to encrypt to user name and password. Im my silverlight application I have to encrypt these value for calling web service but I can not add reference of System.Security.Cryptography dll.

How can I use this dll file for Silverlight application?

回答1:

There is no such thing as a System.Security.Cryptography dll.

System.Security.Cryptography is a namespace present in several assemblies that Microsoft ships. In case of TripleDESCryptoServiceProvider the type is present inside mscorlib.dll.

Sadly Silverlight profile does not ship with TripleDESCryptoServiceProvider inside it's own (minimal) mscorlib.dll (or inside any other assembly).

However you can get a fully compatible (and 100% managed) version of 3DES from the Mono project (MIT X.11 licensed). You simply have to add the source file (and other files it depends on) to your own project, rebuild and use it like the normal desktop .NET framework.