.keystore文件和.jks文件之间的区别 [英] Difference between .keystore file and .jks file
问题描述
我试图找到.keystore
文件和.jks
文件之间的区别,但找不到.我知道jks
用于"Java密钥库",两者都是存储键/值对的一种方式.
I have tried to find the difference between .keystore
files and .jks
files, yet I could not find it. I know jks
is for "Java keystore" and both are a way to store key/value pairs.
使用一个相对于另一个有任何区别或偏好吗?
Is there any difference or a preference to use one over another?
推荐答案
最终,.keystore
和.jks
只是文件扩展名:明智地命名文件由您决定.某些应用程序使用存储在$HOME/.keystore
中的密钥库文件:通常暗示它是JKS文件,因为
Ultimately, .keystore
and .jks
are just file extensions: it's up to you to name your files sensibly. Some application use a keystore file stored in $HOME/.keystore
: it's usually implied that it's a JKS file, since JKS is the default keystore type in the Sun/Oracle Java security provider. Not everyone uses the .jks
extension for JKS files, because it's implied as the default. I'd recommend using the extension, just to remember which type to specify (if you need).
在Java中,根据上下文的不同,密钥库"一词可以具有以下任一含义:
In Java, the word keystore can have either of the following meanings, depending on the context:
- API: http://docs.oracle .com/javase/6/docs/api/java/security/KeyStore.html
- 可用于支持此API的文件(或其他机制)
- 与信任库相对的密钥库,如下所述: https://stackoverflow.com/a/6341566/372643
- the API: http://docs.oracle.com/javase/6/docs/api/java/security/KeyStore.html
- a file (or other mechanism) that can be used to back this API
- a keystore as opposed to a truststore, as described here: https://stackoverflow.com/a/6341566/372643
在谈论文件和存储时,这实际上不是键/值对的存储工具(有很多其他格式).而是一个存储密码密钥和证书的容器(我相信其中一些还可以存储密码).通常,这些文件是经过加密和密码保护的,以免未经授权的用户使用此数据.
When talking about the file and storage, this is not really a storage facility for key/value pairs (there are plenty or other formats for this). Rather, it's a container to store cryptographic keys and certificates (I believe some of them can also store passwords). Generally, these files are encrypted and password-protected so as not to let this data available to unauthorized parties.
Java使用其 KeyStore
类和相关的API来使用密钥库(是否基于文件). JKS
是Java特定的文件格式,但是该API也可以与其他文件类型(通常为PKCS#12)一起使用.要加载密钥库时,必须指定其密钥库类型.常规扩展名是:
Java uses its KeyStore
class and related API to make use of a keystore (whether it's file based or not). JKS
is a Java-specific file format, but the API can also be used with other file types, typically PKCS#12. When you want to load a keystore, you must specify its keystore type. The conventional extensions would be:
-
.jks
用于类型"JKS"
, -
.p12
或.pfx
用于类型"PKCS12"
(规范名称为PKCS#12,但Java密钥库类型名称中未使用#
).
.jks
for type"JKS"
,.p12
or.pfx
for type"PKCS12"
(the specification name is PKCS#12, but the#
is not used in the Java keystore type name).
此外,BouncyCastle还提供了其实现,尤其是 BKS (通常使用
In addition, BouncyCastle also provides its implementations, in particular BKS (typically using the .bks
extension), which is frequently used for Android applications.
这篇关于.keystore文件和.jks文件之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!