Reputation: 1307
I have to make a POST request in my app and I have a esb.dummy.com.crt certificate. I need the certificate access the server.
let request = NSMutableURLRequest(URL: NSURL(string: "https://esb.dummy.com/Common/MyPing?wsdl")!)
request.HTTPMethod = "POST"
request.timeoutInterval = 90
request.setValue("Basic XYZ", forHTTPHeaderField: "Authorization")
request.HTTPBody = getPingBody()
NSURLSession.sharedSession().dataTaskWithRequest(request){...}.resume()
How can I add the certificate to the app or something to make the request?
Upvotes: 0
Views: 1774
Reputation: 66
Do what mentioned before Handling App Transport Security (kCFStreamErrorDomainSSL, -9802)
But add NSTemporaryExceptionAllowsInsecureHTTPLoads
and NSTemporaryExceptionMinimumTLSVersion
keys also.
Example:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>yourserver.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
Upvotes: 1