用于特定路径的REST Web服务的SSL证书FQDN

时间:2013-07-31 23:22:07

标签: ios authentication openssl ssl-certificate fqdn

我使用iOS使用CN(通用名称)和FQDN(完全限定域名)为server.myexample.com的证书连接到服务器。服务器证书由我自己的根CA签署(我的证书通过SecTrustSetAnchorCertificates添加到我的锚证书中,并通过here使用NSURLAuthenticationChallenge描述的方法进行验证。

使用我的iOS客户端,我试图连接位于server.myexample.com/Path1/service1的REST服务,但我一直收到以下错误:

The certificate for this server is invalid. You might be connecting to a server
that is pretending to be “server.myexample.com” which could put your confidential
information at risk.

Error occurred while fetching https://server.myexample.com/Path1/service1: Error
Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. 
You might be connecting to a server that is pretending to be “server.myexample.com” 
which could put your confidential information at risk." 

我收到包含相同信息但指定错误的其他邮件:NSErrorFailingURLStringKeyNSURLErrorFailingURLPeerTrustErrorKey

我发现我也可以使用server.myexample.com/service1调用该服务,并从我的请求URL中删除了Path1,并且服务器证书验证工作正常。为什么是这样?我的印象是服务器只需要1个证书,这意味着它所托管的任何服务也将使用相同的证书。也许你需要为每个路径单独的服务器证书?我不知道服务器IP地址/域需要拥有自己的证书之后的路径。

总结:

  • 锚定证书中包含根CA证书的iOS客户端应用
  • 由根CA签名的服务器server1的CN具有server.myexample.com的CN,其FQDN为https://server.myexample.com
  • 服务器server.myexample.com主机service1,可通过以下网址浏览器访问:
    • https://server.myexample.com/service1(通过iOS客户端的服务器身份验证)
    • https://server.myexample.com/Path1/service1(FAILS iOS客户端对服务器的身份验证)
  • CA和服务器证书是通过OpenSSL
  • 创建的

提前致谢!

0 个答案:

没有答案