简体   繁体   中英

Access Development server with self-signed SSL Certificate

My app needs to connect to an internal web server through https.

The server has a self-signed certificate that is valid until next year:

证书

I have installed this certificate in the iOS Simulator and on the device (Certificate.cer):

IOS证书

I am watching the traffic with Charles and the request does not even "leave" my computer.

The problem seems to be due to the SSL Certificate because when I can access the server through the internal url and the port 8080 everything works fine.

I did try the hack with the category allowsAnyHTTPSCertificateForHost: . This did not work in the simulator as well as on the device.

There seems to be official API to do this: How to use NSURLConnection to connect with SSL for an untrusted cert?

However, since this is only my development environment I would prefer not to change my code base for now. Plus I am using a framework to parse my data and I might have to deeply interfere with that framework to get to the API described above.

So my question is, should it not be possible to install the certificate and then use the server as if there was an official SSL certificate.

Email the self-signed certificate to yourself then open it on your iPhone. You will be taken through the steps to install the certificate on your phone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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