如何在 iOS 10 中安装自签名证书

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42455377/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 08:56:21  来源:igfitidea点击:

How to install self signed certificate in iOS 10

iosssl-certificateself-signed

提问by Saeed

It appears that Apple has removed the ability to trust SSL certificates that are self-signed in iOS 10.

苹果似乎已经取消了信任 iOS 10 中自签名 SSL 证书的能力。

I created my own self-signed certificate and have a local web server that signed with my certificate. I must install my certificate in iOS for testing locally as I have developed an iOS application that needs to trust my certificate.

我创建了自己的自签名证书,并有一个使用我的证书签名的本地 Web 服务器。我必须在 iOS 中安装我的证书以进行本地测试,因为我开发了一个需要信任我的证书的 iOS 应用程序。

How can I install my self-signed certificate?

如何安装我的自签名证书?

回答by daphtdazz

Good news, they haven't. If you just need this for development purposes, which it sounds like you do (and you shouldn't be using self-signed certificates in production anyway), you can install the self-signed certificate on your iOS devices manually. Following the equivalent FAQfor my iOS Web Bluetooth browser app:

好消息,他们没有。如果您只是出于开发目的需要它,这听起来像您这样做(并且无论如何您都不应该在生产中使用自签名证书),您可以在您的 iOS 设备上手动安装自签名证书。遵循适用于我的 iOS Web 蓝牙浏览器应用程序的等效常见问题解答

  1. Create your self-signed certificate and key files using openssl or however. Be sure it has the correct /CN “Common Name”for your local server, e.g. mycomputer.local.
  2. Configure your webserver to use it (obviously) and check that it is working using a different client, such as a browser on a Mac.
  3. Email your certificate to an email address you can access on your iOS device.
  4. Tap on the attachment in Mailon your iOS device, this should now prompt you to install it. Do so.
  5. You should now verify that it is installed by going to the Settingsapp then General -> Profile -> <Common Name>. The Profile menu probably won't be there at all until you've installed the first certificate. The certificate should be marked Verified (it was verified by you when you installed it).
  6. You might, like I did, have thought this would be enough. It isn't. You now, really counter-intuitively, need to go to the setting General -> About -> Certificate Trust Settings and enable full trust for your certificate there as well. It's such a weird place for that setting to be.
  1. 使用 openssl 或然而创建您的自签名证书和密钥文件。确保它具有/CN “Common Name”适用于您的本地服务器的正确信息,例如mycomputer.local.
  2. 配置您的网络服务器以使用它(显然)并检查它是否正在使用不同的客户端工作,例如 Mac 上的浏览​​器。
  3. 将您的证书通过电子邮件发送到您可以在 iOS 设备上访问的电子邮件地址。
  4. 在您的 iOS 设备上点击邮件中的附件,现在应该会提示您安装它。这样做。
  5. 您现在应该通过转到“设置”应用程序来验证它是否已安装General -> Profile -> <Common Name>。在您安装第一个证书之前,配置文件菜单可能根本不存在。该证书应标记为已验证(安装时已由您验证)。
  6. 你可能和我一样,认为这已经足够了。不是。您现在确实违反直觉,需要转到设置 General -> About -> Certificate Trust Settings 并在那里为您的证书启用完全信任。那个地方真是个奇怪的地方。

回答by Jari Turkia

The installation of own root certificates changed at some point (maybe somebody can confirm, if it was at iOS 11).

自己的根证书的安装在某个时候发生了变化(也许有人可以确认,如果是在 iOS 11 上)。

What you need to do is with your Mac, get Apple Configurator 2 and create a profile containing your certificate. The resulting mobile profile file can be installed from Safari or email.

您需要做的是使用您的 Mac,获取 Apple Configurator 2 并创建一个包含您的证书的配置文件。生成的移动配置文件可以从 Safari 或电子邮件安装。