为什么 RESTful apis 中通常不使用 RSA 签名? [英] Why isn't RSA signing usually used in RESTful apis?

查看:48
本文介绍了为什么 RESTful apis 中通常不使用 RSA 签名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个不使用(至少一开始)任何第三方授权的简单应用.我想创建一个供 iOS/Android/任何客户端使用的 RESTful api,所以我阅读了大量有关 RESTful API 实现的信息.然而,实现它们的通常方法涉及发送某种用于签署请求的安全令牌";这使得 API 容易受到中间人攻击,推荐的应对方法是使用 HTTPS.

I develop a simple app that doesn't use (at least, at first) any third-party authorization. I want to create a RESTful api to be used by iOS/Android/whatever clients, so I've read a bunch of information about implementation of RESTful APIs. However, the usual ways of implementing them involve sending some sort of secure "token" that is used to sign the requests; this leaves the API vulnerable to man-in-the-middle attack, and recommended way to counter it is to use HTTPS.

然而,阅读所有这些让我想知道,为什么不使用私钥/公钥签名(如 RSA).这样,客户端会根据密码生成私钥和公钥,在注册时发送公钥并将私钥保存在客户端,即使有人掌握了服务器和客户端之间的所有通信,他仍然不会无法冒充客户.

However, reading all this left me wondering, why aren't private/public keys signing (like RSA) used for this. That way, the client would generate private and public keys from the password, send the public key on registration and keep the private key on the client, and even if someone got hold of all the communications between the server and client, he still wouldn't be able to impersonate the client.

但我对密码学和安全性几乎一无所知,所以我想不出为什么不使用这种方法的原因,对吧?

But I know almost nothing about cryptography and security, so there must be reasons why this method isn't used that I couldn't think of, right?

推荐答案

目前不存在允许从密码派生非对称密钥对的方案.

At the moment there is no scheme exists allowing asymmetric key pair derivation from the password.

另一个问题是公钥注册.做认证有问题,因为任何人都可以拥有非对称密钥对,所以必须提供一些额外的信息.公钥证书可以是这样的信息,但是,这要求客户端是某些公钥基础设施的用户.在实践中使用的另一个选项是预先向服务器提供客户端公钥/证书.

Another problem is with public key registration. There is a problem with doing authentication, because anyone can have asymmetric key pair, so some additional information must be provided. Public key certificate could be such information, however, this requires client to be a user of some public key infrastructure. Another option, which is used in practice, is that client public key/certificate is provisioned to the server beforehand.

最后,TLS (HTTPS) 已经在使用非对称密钥来执行身份验证和交换会话密钥.客户端验证服务器的公钥证书(服务器身份验证),服务器也可以选择验证客户端的公钥证书(客户端身份验证).

At the end TLS (HTTPS) is already using asymmetric keys to perform authentication and exchange session keys. Client verifies server's public key certificate (server authentication) and server optionally may do the same for client's public key certificate (client authentication).

这篇关于为什么 RESTful apis 中通常不使用 RSA 签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆