gpt4 book ai didi

ios - 为什么我的服务器证书被拒绝?

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:43:08 24 4
gpt4 key购买 nike

我正在尝试使用 TLS 1.2 将我的应用程序连接到服务器。服务器使用的证书已由设备上已安装的自签名 CA 证书签名(我将 CA 证书通过电子邮件发送给自己,点击它。现在它显示在“设置”->“常规”->“配置文件”下)。这以前在我的应用程序中有效,但我们已经更改了我们正在使用的 CA 证书,所以我也更新了服务器的证书。现在我遇到了 SSL 故障。

我看到的错误是 errSSLXCertChainInvalid 来 self 对客户端 SSLHandshake 的调用。据我所知,服务器证书应该是有效的。 openssl verify -CAfile ca-cert.pem server-cert.pem 返回 OK,并且 ca-cert.pem 与我在设备上安装的 CA 证书相同.

有什么想法吗?谢谢!

最佳答案

苹果的documentation里面有一些信息关于这个错误:

errSSLXCertChainInvalid — The peer has an invalid certificate chain; for example, signature verification within the chain failed, or no certificates were found.

如果您使用 SSLSetPeerDomainName:

You can use this function to verify the common name field in the peer’s certificate. If you call this function and the common name in the certificate does not match the value you specify in the peerName parameter, then handshake fails and returns errSSLXCertChainInvalid.

我建议卸载您的设备配置文件,然后创建一个新的。

此外,检查您是否可以从网络浏览器访问服务器而不会出现错误可能是个好主意。这将显示证书是否有问题,或者只是您的 iOS 设备上的配置文件有问题。

关于ios - 为什么我的服务器证书被拒绝?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23689098/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com