Keystore vs Truststore
- 概念
Keystore 用于存储特定程序应提供给双方(服务器或客户端)以进行验证的私钥和身份证书。
Truststore 用于存储来自认证机构 (CA) 的证书,这些证书验证服务器在 SSL 连接中提供的证书。
- 区别
Keystore | Truststore |
---|---|
Keystore 存储你的凭证(证书)。 (服务器或客户端) | Truststore 存储其他凭证 (CA) |
在 SSL 上设置服务器端时需要密钥库 | 在客户端成功连接需要信任库设置 |
客户端会存储它的私钥和身份证书在keystore里 | 服务器将根据存储在服务器信任库中的证书对客户端进行身份验证 |
javax.net.ssl.keyStore 用于指定 Keystore | javax.net.ssl.trustStore 用于指定 Truststore。 |
密钥库密码以纯文本形式存储,只有特定组才能读取。 | Truststore 密码以明文形式存储,每个人都可以阅读。 |
密钥库包含私人和敏感信息 | Truststore 不包含私人和敏感信息 |