如何建立 SSL 连接 (iphone)
我正在制作一个需要金钱交易的应用程序...
为此我必须以安全的方式将 SOAP xml 发送到服务器...
我被告知我必须先创建 SSL 连接然后发送那条肥皂消息...
我非常了解 SOAP,但不知道 SSL 连接...
请提供一些帮助...
i am making an app in which there is a need of money transaction...
for this i have to send SOAP xml to server but in secure way....
i have been told that i have to create SSL connection first and then send that soap message.....
I know about SOAP very well but no idea about SSL connection...
please provide some help...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看苹果网站上的 NSURLConnection 文档: NSURLConnection
编辑:添加更多信息。
您需要设置身份验证。快速搜索 SO 产生以下结果:
NSURLConnection SSL HTTP 基本身份验证 和
HTTPS with NSURLConnection - NSURLErrorServerCertificateUntrusted
您需要设置服务器来处理身份验证,然后发出质询到设备。正如您在上面的帖子中看到的,有一个函数:didReceiveAuthenticationChallenge:
您需要使用它来处理身份验证挑战。您可以通过上述帖子了解如何进行操作。
您的服务器还需要设置为处理身份验证。我不知道你的服务器使用什么语言,但由于我使用 PHP,这里是有关身份验证的 PHP 手册链接:
PHP 身份验证
一开始是一件很棘手的事情,但是一旦你进入它还不错(并且创建更多 https 连接很容易)。然而,在这里写出您需要做的所有事情有点太多了。如果您浏览了这些帖子,您就可以大致了解如何进行操作。这需要一些工作才能完成。
Check out NSURLConnection docs on the apple site: NSURLConnection
EDIT: added more info.
You need to set up authentication. A quick search of SO produced these results:
NSURLConnection SSL HTTP Basic Auth and
HTTPS with NSURLConnection - NSURLErrorServerCertificateUntrusted
You need to set up your server to handle authentication, then issue a challenge to the device. As you can see in the above posts, there is a function: didReceiveAuthenticationChallenge:
You need to use this to handle authentication challenges. You can get a good idea of how to go about it using the above posts.
Your server needs to be set up to handle authentication, as well. I don't know what language you use with your server, but as I use PHP, here is the PHP manual link on authentication:
PHP authentication
It is a tricky thing to do at first, but once you get into it isn't bad (and creating more https connections comes easily). However, writing out everything you would need to do here is a bit much. If you scope out those posts, you can get a general idea about how to go about it. It'll take some working to get it done.
大多数情况下,这仅仅意味着您必须将数据发送到 HTTPS 端点。这也意味着客户端和服务器之间存在安全连接(自动为您完成),以便消息的有效负载(正文)被加密,而不是以明文形式传输(HTTP 就是这种情况)。
基本上,大多数时候,只需确保您使用的是 HTTPS 就足够了:)
看看 http: //en.wikipedia.org/wiki/Secure_Sockets_Layer
Most often this simply means that you have to send data to an HTTPS endpoint. What this also means is that there is a secure connection (done for you automatically) between the client and the server so that the payload (body) of the message is encrypted rather than transmitted in clear text (which is the case with HTTP).
Basically, most times, it is enough just to make sure you're using HTTPS :)
Have a look at http://en.wikipedia.org/wiki/Secure_Sockets_Layer