.keystore 文件和 .jks 文件之间的区别
我试图找到 .keystore
文件和 .jks
文件之间的区别,但我找不到它。我知道 jks 代表“Java keystore”,两者都是存储键/值对的一种方式。
使用其中一种与另一种相比有什么区别或偏好吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最终,
.keystore
和.jks
只是文件扩展名:您可以合理地命名文件。某些应用程序使用存储在
$HOME/.keystore
中的密钥库文件:通常暗示它是 JKS 文件,因为 JKS 是 Sun/Oracle Java 安全提供程序中的默认密钥库类型,直至 Java 8。并非每个人都使用JKS 文件的.jks
扩展名,因为它被默认为默认扩展名。 自 Java 9 起,默认格式为 PKCS#12(通常带有.p12
或pfx
扩展),但尚不清楚是否所有应用程序都跟上了这一变化。我建议使用扩展名,只是为了记住要指定的类型(如果需要)。在 Java 中,“keystore”一词可以具有以下任一含义,具体取决于上下文:
当谈论文件和存储时,这并不是真正的键/值对存储设施(有很多或其他格式)。相反,它是一个存储加密密钥和证书的容器(我相信其中一些还可以存储密码)。通常,这些文件经过加密并受密码保护,以免未经授权的各方获取这些数据。
Java 使用其
KeyStore
类和相关 API 来使用密钥库(无论是否基于文件)。JKS
是 Java 特定的文件格式,但该 API 也可用于其他文件类型,通常是 PKCS#12。当您要加载密钥库时,必须指定其密钥库类型。常规扩展名是:"JKS"
类型的.jks
、.p12
或.pfx
类型 < code>"PKCS12"(规范名称为 PKCS#12,但 Java 密钥库类型名称中不使用#
)。此外,BouncyCastle还提供了它的实现,特别是BKS(通常使用
.bks
扩展名),常用于 Android 应用程序。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 was usually implied that it was JKS file, since JKS was the default keystore type in the Sun/Oracle Java security provider, up to Java 8. Not everyone uses the.jks
extension for JKS files, because it was implied as the default. Since Java 9, the default format is PKCS#12 (often with.p12
orpfx
extensions), but it's not clear whether all applications have caught up with that change. I'd recommend using the extension, just to remember which type to specify (if you need).In Java, the word "keystore" can have either of the following meanings, depending on the context:
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 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
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).In addition, BouncyCastle also provides its implementations, in particular BKS (typically using the
.bks
extension), which is frequently used for Android applications.你对此感到困惑。
keystore
是证书、私钥等的容器。此密钥库的格式有规范,主要是 #PKCS12
JKS 是 Java 的密钥库实现。还有BKS等。
这些都是密钥库类型。
所以回答你的问题:
没有区别。 JKS 是密钥库文件。
但密钥库类型之间存在差异。例如
JKS
与#PKCS12
You are confused on this.
A
keystore
is a container of certificates, private keys etc.There are specifications of what should be the format of this keystore and the predominant is the #PKCS12
JKS is Java's keystore implementation. There is also BKS etc.
These are all keystore types.
So to answer your question:
There is none. JKS are keystore files.
There is difference though between keystore types. E.g.
JKS
vs#PKCS12
选择 .keystore 而不是 .jks 的原因之一是,当您导航选择密钥库文件时,Unity 可以识别前者,但不能识别后者(Unity 2017.3,macOS)。
One reason to choose .keystore over .jks is that Unity recognizes the former but not the latter when you're navigating to select your keystore file (Unity 2017.3, macOS).