开发者

Is System.Security.Cryptography namespace supported by the Portable Class Library

I a开发者_开发问答m converting an existing multi-target Silverlight/.NET project to a Portable Class Library project in order to reduce the number of projects that are required to support multiple Microsoft platforms.

I have an error in one class that is using the System.Security.Cryptography namespace

The type or namespace name 'Cryptography' does not exist in the namespace 'System.Security' (are you missing an assembly reference?)

This namespace is available in Silverlight and I am wondering why the Portable Class Library does not support it?

One reason could be that this behaviour is by design: any cryptography related code should not be present in a client side API.


No unfortunately, Portable Library does not support Crypto. However, we've added support for it in PclContrib.


I would suspect it does not support it. Members on classes in that Namespace are marked with an image:

You can find which members are supported by the Portable Class Library project in the reference topics for the .NET Framework Class Library. In the members table for a class, the following Portable Class Library icon appears next to supported members.

Is System.Security.Cryptography namespace supported by the Portable Class Library

That image is lacking in every class I examined in the documentation.

This namespace is available in Silverlight and I am wondering why the Portable Class Library does not support it?

I can't say for sure; but it does appear to be lacking under XNA for the XBox 360 platform. Even then, I believe your conclusion is correct - it isn't an API that is very popular on a front end. Then underlying code is also extremely non-portable. A large portion of the Crypto namespace is accomplished by P/Invoking down to the operating system. I suspect they could make it portable as they did with Silverlight; but that may just not have been on their radar just yet.


I suggest you use PclCrypto. It's the simplest to use and invokes platform crypto rather than trying to implement it itself, which means less security risk and faster performance.


"You can find which members are supported by the Portable Class Library project in the reference topics for the .NET Framework Class Library. In the members table for a class, the following Portable Class Library icon appears next to supported members. "

I would recommend using the object browser, as I have found examples of classes that the MSDN indicates are supported in the PCL, but are missing from the framework. Such an example is Lazy

(as of 2011-9-11)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜