简体   繁体   English

具有自签名SSL证书的Access Development服务器

[英]Access Development server with self-signed SSL Certificate

My app needs to connect to an internal web server through https. 我的应用程序需要通过https连接到内部Web服务器。

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模拟器和设备(Certificate.cer)上安装了此证书:

IOS证书

I am watching the traffic with Charles and the request does not even "leave" my computer. 我正在查看与Charles的访问量,该请求甚至没有“离开”我的计算机。

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. 问题似乎是由于SSL证书所致,因为当我可以通过内部url和端口8080访问服务器时,一切正常。

I did try the hack with the category allowsAnyHTTPSCertificateForHost: . 我确实尝试了类别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? 似乎有官方的API可以做到这一点: 如何使用NSURLConnection与SSL连接以获得不受信任的证书?

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. 另外,我正在使用一个框架来解析我的数据,并且可能必须深深地干扰该框架才能使用上述API。

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. 所以我的问题是,是否应该无法安装证书,然后像使用正式的SSL证书一样使用服务器。

Email the self-signed certificate to yourself then open it on your iPhone. 通过电子邮件将自签名证书发送给自己,然后在iPhone上打开它。 You will be taken through the steps to install the certificate on your phone. 将引导您完成在手机上安装证书的步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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