How to use NSURLConnection to connect with SSL for an untrusted cert?

There is a supported API for accomplishing this! Add something like this to your NSURLConnection delegate: – (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace { return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]; } – (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) if ([trustedHosts containsObject:challenge.protectionSpace.host]) [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge]; [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge]; } Note that connection:didReceiveAuthenticationChallenge: can send its message to challenge.sender (much) … Read more

Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION]

Upgrade pip as follows: curl https://bootstrap.pypa.io/get-pip.py | python Note: You may need to use sudo python above if not in a virtual environment. (Note that upgrading pip using pip i.e pip install –upgrade pip will also not upgrade it correctly. It’s just a chicken-and-egg issue. pip won’t work unless using TLS >= 1.2.) As mentioned … Read more