简体   繁体   English

在WP7中加载证书

[英]load certificate in WP7

in WP7 I Tried to load certificate to get a public key from it and I use this 在WP7中,我试图加载证书以从中获取公钥,我使用了它

X509Certificate x509 = null;
x509 = X509Certificate.CreateFromCertFile(CertificateFilePath);

and I got this exception: 我有这个例外:

{System.MethodAccessException: Attempt to access the method failed: System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromCertFile(System.String) {System.MethodAccessException:尝试访问该方法失败:System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromCertFile(System.String)

any one have an idea about this problem ? 有人对这个问题有想法吗? there anther way to read cert file in WP7 ? 还有另一种方法可以读取WP7中的证书文件?

This is an inherent limitation put in place because your application is running in a sandboxed environment, and therefore is not exactly an app that would be classified as "trusted" by Silverlight standards. 这是一个固有的限制,因为您的应用程序在沙盒环境中运行,因此,它并不是完全由Silverlight标准归类为“受信任”的应用程序。 To quote MSDN : 引用MSDN

This member can be used only by trusted applications. 该成员只能由受信任的应用程序使用。 If you try to use this member in a partial-trust application, your code will throw a MethodAccessException exception. 如果您尝试在部分信任应用程序中使用此成员,则您的代码将引发MethodAccessException异常。 This member is security-critical, which restricts its use. 该成员对安全性至关重要,因此限制了其使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM