gpt4 book ai didi

ios - iOS 上的自签名证书

转载 作者:行者123 更新时间:2023-12-02 00:44:38 25 4
gpt4 key购买 nike

https://cordova.apache.org/docs/en/8.x/guide/appdev/security/index.html提到了

The reason is that accepting self-signed certificates bypasses the certificate chain validation, which allows any server certificate to be considered valid by the device.

  • 这是否意味着,一旦 iOS 设备信任任何自签名证书,任何 SSL 流量(来自任何应用)都会不安全?
  • 如果是,Apple 推荐的处理方式是什么(我相信我无法阻止用户信任自签名任何原因的证书)。我可以以某种方式检查是否有这样的证书是受信任的(在本示例中我使用 Cordova)。
  • 或者这是否意味着仅适用于应用自签名证书的连接,不执行 SSL 验证?

最佳答案

在 iOS 上使用 Cordova 时,如果您想使用自签名证书,则必须将此代码添加到您的应用中。

@implementation NSURLRequest(DataController)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)主机
{
返回是;
}
@结束

这可能就是这个意思

The reason is that accepting self-signed certificates bypasses the certificate chain validation, which allows any server certificate to be considered valid by the device.

与 Android 不同,一旦您添加跳过所有验证,这就是全有或全无。

添加仅影响您的应用程序,不会影响其他应用程序,但会影响您的 WebView 所做的所有连接。因此,这会使您的应用程序高度不安全,因为人们可以轻松地进行中间人攻击。

关于ios - iOS 上的自签名证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50744523/

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