我们已经创建了示例 Web API 并托管在 Azure 中。因为我们有很多 get 和 Post 方法。我们必须通过 API 传递一些敏感数据(如 SSN 等)来获得响应。我们觉得第三方可以查看查询参数值。那么SSL是否可以解决问题?或者有什么方法可以简单地修复它?
最佳答案
当您已经拥有 HTTPS (HTTP+SSL) 时,为什么要实现新的解决方案。请求正文默认是加密的。您可以禁用较弱的密码套件,只允许较高的 TLS 版本。在执行此操作时,您可能还需要考虑客户端兼容性,因为并非所有客户端都支持所有密码套件 和TLS 协议(protocol)版本。
您可以通过禁用其他 SSL/TLS 协议(protocol)版本为客户端强制执行 TLS 1.2。与其前身相比,它的实现更加严格。您可以在这里阅读:Major Differences from TLS 1.1
您没有提到您的网络 API 是否托管在 Azure VM/Cloud Service/Azure App Service 上。您无法在 Azure 应用服务中控制服务器上的 TLS/SSL 配置。
NOTE: Enabling HTTPS or implementing encryption doesn't warranty a fool-proof solution. You should ensure that the secrets are stored securely and also as pointed out by @Panagiotis, you will also have to ensure that you are not storing any sensitive information in the server/application logs. Security is a broader concept, HTTPS addresses one of the requirements.
关于c# - 如何加密 rest api url 中的查询参数值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45235464/