使桌面客户端能够与 Web 应用程序通信的安全方法
接下来,我想构建一个桌面客户端、iPhone 应用程序等,以便与我现在正在开发的 Web 应用程序进行交互。我目前正在努力将身份验证层添加到应用程序中,并努力牢记这些未来的计划。设置此功能的最佳方法是什么。我一直在阅读有关保护 API 的内容,并且我读到的很多内容都建议使用公钥和私钥。这是正确的使用方法吗?在我看来,这不是正确的方法,因为用户要做的第一件事就是登录,此时我必须将私钥发送到看起来不太私密的应用程序。
Down the road I'd like to build a Desktop client, iPhone app, etc to interact with the web app I'm working on right now. I'm currently working on adding the authenitcation layer to the app and I'm trying to keep these future plans in mind. What is the best way to set this up. I've been reading up on securing an API and a lot of what I've read recommends using a public and private key. Is this the right approach to use? It seems to me like this isn't the correct approach since the first thing the user will do is login at which point I'd have to send the private key to the app which doesn't seem very private.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
公钥和私钥是正确的方法。您的应用程序或服务器从不发送其私钥。仅公开密钥。过程如下:
服务器的公共
加密数据并发送的密钥
解密是通过使用
服务器的私钥
进行的,因此只有服务器可以读取它。应用程序的公钥
加密数据并发送。应用程序的私钥
,因此只有应用程序可以读取它。我建议您阅读有关公私密钥通信如何工作的更多信息。我会尽力提供一个好的入门书的链接。
编辑:维基百科关于此事的文章实际上相当不错。
Public and Private key is the correct approach. Your app or server never send their private keys. Only the public keys are exposed. The process is as follows:
server's public
key to encrypt the data and sends it
decrypted is by using the
server's private
key and so only the server can read it.app's public
key to encrypt data and sendsapp's private
key and so only the app can read it.I suggest you read more about how Public-Private key communication works. I will try to provide a link to a good primer.
Edit: Wikipedia's article on the matter is actually quite good.