【问题标题】:Certificate pinning failing in iOSiOS 中的证书固定失败
【发布时间】:2016-12-26 15:10:07
【问题描述】:

我们正在使用 IBM MobileFirst Platform Foundation v7.1 开发一个应用程序。目前我们处于 UAT 阶段。该应用同时支持 Android 和 iOS。

我们为我们的应用程序实施了证书固定。 MobileFirst Server 由网络团队维护,它为我提供了一个带有“cer”扩展名的公共证书 (com.uat.myapp.cer)。我将这个公共证书包含在我的项目中的证书文件夹下,并在 main.js 文件中编写了证书锁定代码。

Android 应用程序运行良好,并且正在与 MobileFirst Server 进行 SSL 握手。应用程序运行正常。

iOS 应用程序虽然无法连接到 MobileFirst Server,但出现以下错误:

发生 SSL 错误,无法与服务器建立安全连接”。

我使用以下门户将 .cer 证书转换为 .der 证书 (com.uat.myapp.der):https://www.sslshopper.com/ssl-converter.html 并将其放入应用程序中,但我仍然遇到同样的错误。

请查看以下错误日志以获取更多信息:

-[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in  WLAFHTTPRequestOperationManagerWrapper.m:390 :: Response Error : An SSL error has occurred and a secure connection to the server cannot be made. 2016-12-26 19:38:49.301 MyApp[1419:26347] [DEBUG] [WORKLIGHT]
+[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/05/28 17:08:17

-[WLRequest requestFailed:error:] in WLRequest.m:509 :: Status code='0' error='An SSL error has occurred and a secure connection to the server cannot be made.' response='(null)'

2016-12-26 19:38:49.302 MyApp[1419:26347] [DEBUG] [WL_REQUEST]
-[WLRequest requestFailed:error:] in WLRequest.m:512 :: Response Header: (null) Response Data: (null)

2016-12-26 19:38:49.302 MyApp[1419:26347] [DEBUG] [WL_AUTH]
-[WLAuthorizationManager failRegistratioWithResponse:] in WLAuthorizationManager.m:866 :: Response does not contain a valid certificate and client Id. device registration failed

2016-12-26 19:38:49.306 MyApp[1419:26347] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager removeKey:] in WLCertManager.m:262 :: Key was successfully removed.

【问题讨论】:

  • 请确保您遵循服务器和客户端文档中的说明:mobilefirstplatform.ibmcloud.com/blog/2015/08/14/… - 还要验证证书的有效性,尤其是指定的主机和服务器是否真正匹配。跨度>
  • 首先,尝试不使用证书固定。意思是在不使用 pinning API 的情况下将您的 iOS 应用程序连接到您的 SSL 服务器。更新您的问题,让我们知道此常规流程是否有效。
  • @karthik_Chinna,请查看以上 cmets 并回复。

标签: ios ibm-mobilefirst certificate-pinning


【解决方案1】:

我的预感是证书中指定的域与应用程序使用的实际服务器主机或 IP 不匹配。

  1. 使用 keytool 验证证书确实包含所需的主机/IP 值。
  2. 在您的应用程序中,确保该应用程序确实尝试连接到相同的服务器主机/IP。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-03
    • 2015-10-25
    • 2020-06-01
    • 1970-01-01
    • 2021-02-06
    • 1970-01-01
    • 2013-03-21
    • 1970-01-01
    相关资源
    最近更新 更多