证书固定在iOS中失败

时间:2016-12-26 15:10:08

标签: ios ibm-mobilefirst certificate-pinning

我们正在使用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.

1 个答案:

答案 0 :(得分:0)

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

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