Reputation: 1
in WP7 I Tried to load certificate to get a public key from it and I use this
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)
any one have an idea about this problem ? there anther way to read cert file in WP7 ?
Upvotes: 0
Views: 85
Reputation: 16826
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. To quote 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. This member is security-critical, which restricts its use.
Upvotes: 1