存储客户端 SSL 证书而不影响安全性

发布于 2024-09-10 02:34:29 字数 235 浏览 1 评论 0原文

我已将客户端 SSL 证书作为文件存储在数据库中,并将其私钥密码存储在每个需要证书的 Web 服务的列中(不使用证书存储)。我更喜欢这个的原因是我不必担心用户权限如果代码移动到另一台服务器(Dev/QA/Prod),则访问证书。由于证书存储在集中位置,因此我不必将其安装在每台计算机上。此外,业务人员可以随时上传证书,无需开发人员干预,并且证书对于 QA 和生产环境会有所不同。现在我担心的是,将证书存储在数据库中会损害安全性,而不是将其存储在证书存储中?

I have stored Client SSL certificate in database as a file and its private key's password in a column (not using certificate store) for each web service that requires certificate.The reason I preferred this that I don't have to worry about user privilege to access the certificate if the code is moved to another server (Dev/QA/Prod). As certificate stored in centralized location, I don't have to install it in each machine. Moreover business people can upload certificate any time they want without intervening Developer and certificate will be different for QA and Production environment. Now my concern is that storing certificate in database compromise the security rather than storing it in certificate store?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

若水般的淡然安静女子 2024-09-17 02:34:29

从安全角度来看,将私钥和密码放入数据库的策略会将所有密钥的权限授予数据库管理员、软件作者和系统管理员。

将私钥的密码放在系统上而不是放在数据库中只会将完全控制权交给系统管理员和软件作者。

另一种解决方案是将私钥存储在硬件设备 (HSM) 中,并仅将引用存储在数据库中。然后,您的软件将使用 PKCS#11 等硬件加密 API 来执行 SSL 客户端握手加密,并且您的私钥将永远不会位于系统内存或磁盘上。

From a security point of view, your strategy of placing the private keys AND the password in the database gives away rights to all the keys to the database admin, the software author AND the system admin.

Placing the private key's password on the system but not in the database only hands total control to the system admin and software author.

One other solution would be to store the private key in a hardware device (HSM) and only store references in your database. Your software would then use a hardware crypto API like PKCS#11 to perform the SSL client handshake crypto and your private keys would never be in system memory or on disk at all.

人疚 2024-09-17 02:34:29

我猜您的意思是“我已将客户端 SSL 证书作为文件、其私钥和其私钥密码存储在数据库中”。也许 X.509 证书及其私钥位于单个容器中,大概采用 PKCS#12 格式。
(或者您真的只想只存储证书吗?只存储证书很好,但为什么还要存储私钥的密码。)

这不一定是错误的,但您必须确保可以访问此数据 -基础得到很好的保护。

一般来说,私钥实际上就是:private。一些认证机构甚至在其政策中强制要求最终用户不得知道任何其他人的私钥(至少在合理的保护下,例如在浏览器中或在只有他们知道密码的 PKCS#12 文件中)。
当使用公钥和私钥时,这是有意义的。

我认为你需要仔细审视设计的各个角度。目前尚不清楚为什么要将私钥存储在数据库中以供用户检索。将私钥存储在中心位置可能是有意义的,但这也可能会破坏使用客户端证书进行身份验证的意义(这实际上取决于整体情况和您真正想要的安全程度)。

将所有用户的私钥存储在一个中心位置可能不如让每个用户使用自己的存储那么安全,但它可能是可以接受的。最终,这取决于您可能遇到的威胁。

I guess you mean "I have stored Client SSL certificate in database as a file, its private key and its private key password". Maybe the X.509 certificate and its private key are in a single container, presumably in PKCS#12 format.
(Or do you just really want to store only the certificate? Storing just the certificate is fine, but why would you store the private key's password too.)

This isn't necessarily wrong, but you have to make sure access to this data-based is well protected.

In general, the private key is really that: private. Some certification authorities even mandate in their policies that no one other that the end-user may know the private key (at least with reasonable protection, e.g. within the browser or in a PKCS#12 file for which only they know the password).
This makes sense when using public and private keys.

I think you need to look carefully at all the angles of your design. It's not clear why you want to store the private keys in a database for the users to retrieve. It may make sense to store private keys in a central place, but this may also defeat the point of using client-certificate to authenticate (it really depends on the full picture and the degree of security you really want).

Storing all your users' private keys in a central place is probably not as secure as having each user use their own store, but it may be acceptable. Ultimately, it depends on the threats you may encounter.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文