简体   繁体   English

将相同的密钥库用于信任库和服务器库时的安全性问题?

[英]Security issue when using the same keystore for trust store and server store?

Is there a security issue when using the same keystore for the trust store (certificates used for authenticating clients) and server store (private keys used by the server)? 将相同的密钥库用于信任存储区(用于验证客户端的证书)和服务器存储区(服务器使用的私钥)时是否存在安全问题? I ask this because I know that there is a recommendation to have two separate files (and I wonder why this is). 我之所以这样问,是因为我知道建议您有两个单独的文件(我想知道为什么会这样)。

I know that there is a recommendation to have two separate files (for the trust store and the server store) 我知道建议您有两个单独的文件(用于信任存储和服务器存储)

The reason for such a recommendation is that you typically store only public keys and the related certificates of trusted CAs in the truststore, while the keystore is meant to store private-keys and the associated public keys (along with the related certificates). 提出此建议的原因是,通常您仅将公共密钥和受信任CA的相关证书存储在信任库中,而密钥库用于存储私钥和相关的公共密钥(以及相关证书)。

When you start managing both as a single file, it is quite possible for any agent (a user or even application code) that has knowledge of the truststore password to read and modify the private keys of the keystore as well. 当您开始将这两个文件作为一个文件进行管理时,知道信任库密码的任何代理(用户甚至应用程序代码)都很有可能也可以读取和修改密钥库的私钥。 This is not what you want, for private keys ought to be private by nature, and known only to a single entity (the one that owns the key). 这不是您想要的,因为私钥本质上应该是私有的,并且仅对单个实体(拥有密钥的实体)知道。

Likewise, it is also possible for an agent to modify the truststore through the knowledge of the keystore password, to add certificates to the truststore. 同样,代理也可以通过了解密钥库密码来修改信任库,以将证书添加到信任库。 On it's own, this may appear benign, but usually multiple clients can use the same truststore (like the cacerts file of the JRE), resulting in the scenario where one agent can poison the trust relationship (by adding the certificate of a malicious CA into the truststore) between a client and a server. 单独看似良性,但通常多个客户端可以使用相同的信任库(例如JRE的cacerts文件),从而导致一种情况可能会毒化信任关系(通过将恶意CA的证书添加到其中)客户端和服务器之间的信任库)。

In reality, the recommendation is more of a defense-in-depth practice, unless your agents aren't trustworthy (in which case you ought to be adopting several other practices). 实际上,除非您的代理人不值得信任(否则您应该采用其他几种做法),否则建议通常是纵深防御做法。

There is one security concern, but I think most of the reason for the recommendation is a logical separation of responsibilities. 有一个安全问题,但我认为建议的大多数原因是逻辑上的责任分离。 From Keystores and Truststores : 密钥库和信任库

Using two different files instead of a single keystore file provides for a cleaner separation of the logical distinction between your own certificates (and corresponding private keys) and others' certificates. 使用两个不同的文件而不是单个密钥库文件可以使您自己的证书(和相应的私钥)与其他人的证书之间的逻辑区别更加清晰地分开。 You could provide more protection for your private keys if you store them in a keystore with restricted access, while providing the trusted certificates in a more publicly accessible keystore if needed. 如果将私钥存储在访问受限的密钥库中,则可以为私钥提供更多保护,而如果需要,则可以在可公开访问的密钥库中提供可信证书。

The key security point here is that by separating the trusted (public) certificates from your own certificates that contain your private keys, you can use whatever level of restriction you deem necessary to protect your own private keys, while keeping trusted certificates public. 此处的关键安全点是,通过将受信任的(公共)证书与包含私钥的自己的证书分开,您可以使用您认为必要的任何级别的限制来保护自己的私钥,同时使受信任的证书保持公开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将.crt文件添加到密钥库和信任库 - how to add .crt file to keystore and trust store 如何使用java.security.KeyStore类存储和加载密钥 - How to store and load keys using java.security.KeyStore class java.security.KeyStore使用什么算法来加密KeyStore.setKeyEntry()和KeyStore.store()中的privateKey? - What algorithm does java.security.KeyStore use to encrypt the privateKey in KeyStore.setKeyEntry() and KeyStore.store()? 使用KeyStore -Java存储自己制作的密钥 - Store own made key using KeyStore -Java 为 SpringBoot 应用程序指定密钥库时 javax.net.ssl.keyStore 和 server.ssl.key-store 属性有什么区别 - What is the difference between javax.net.ssl.keyStore and server.ssl.key-store properties when specifying keystore for a SpringBoot app 应用程序服务器如何不使用密码读取自定义信任存储 - How application server is reading custom trust store without password Java7拒绝信任信任库中的证书 - Java7 Refusing to trust certificate in trust store 我可以使用keytool创建没有密码的Java信任库吗? - Can I create a Java trust store without a password using keytool? Trust Store 与 Key Store - 使用 keytool 创建 - Trust Store vs Key Store - creating with keytool 如何在jTDS连接URL中指定信任库和信任库密码? - how to specify trust store and trust store password in jTDS connection url?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM