Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Recently our Web hosting provider moved to a medium trust level for all shared ASP.NET site hosting. As a result, we're having some issues completing transactions via PayPal's SOAP API. Specifically, a SecurityException exception is being thrown with the following stack trace:

[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +58
   System.Net.ServicePointManager.set_CertificatePolicy(ICertificatePolicy value) +54
   com.paypal.sdk.core.APICallerBase.SetTrustManager() +30
   com.paypal.sdk.core.soap.SOAPAPICaller..ctor() +14
   com.paypal.sdk.services.CallerServices..ctor() +23
...

I tracked down the source to the offending method in the PayPal SOAP SDK.

/// <summary>
/// To Accept all un-trusted certificate
/// </summary>
private void SetTrustManager()
{
    //This code is added to accept all un-trusted certificate i.e self-signed certificate
    if (Config.Instance.TrustAll)
    {
       //ServicePointManager.CertificatePolicy = TrustAllCertificatePolicy.Instance;
       ServicePointManager.CertificatePolicy = new MyPolicy();                          
    }
} // SetTrustManager

Does any know what change(s) need to be made to our project and/or the server to allow the SDK to function in a medium trust environment? Is it a necessity that all un-trusted certificates be accepted?

share|improve this question
    
i may be wrong, but this might do better on StackOverflow –  Jimsmithkka Aug 27 '09 at 19:33
    
i initially posted it there, but my thought was a server admin may have some insight too. –  user18619 Aug 27 '09 at 20:39
add comment

1 Answer 1

I'm afraid that's not supported, you need to use the classic HTTPS interface integration. Otherwise if you want to use the SDK by any means, then you have to enable the full trust mode on your server.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.