cer、pvk 和 pfx 文件之间有什么区别?

发布于 2024-08-22 06:37:23 字数 62 浏览 11 评论 0 原文

cer、pvk 和 pfx 文件之间有什么区别?另外,我要保留哪些文件以及我应该将哪些文件提供给我的交易对手?

What is the difference between a cer, pvk, and pfx file? Also, which files do I keep and which am I expected to give to my counter-parties?

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

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

发布评论

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

评论(4

孤独陪着我 2024-08-29 06:37:23

Windows 使用 X.509 证书的 .cer 扩展名。这些可以是“二进制”(ASN.1 DER),也可以使用 Base-64 进行编码并应用页眉和页脚 (PEM); Windows 都会识别其中之一。要验证证书的完整性,您必须使用颁发者的公钥检查其签名......而这又是另一个证书。

Windows 使用 .pfx 作为 PKCS #12 文件。该文件可以包含各种加密信息,包括证书、证书链、根权限证书和私钥。其内容可以进行加密保护(使用密码),以保持私钥的私密性并保持根证书的完整性。

Windows 使用 .pvk 作为私钥文件。 我不确定 Windows 遵循什么标准(如果有)。希望它们是 PKCS #8 编码密钥。 Emmanuel Bourg 报告说这些是专有格式。一些文档 可用。

您永远不应该泄露您的私钥。它们包含在 .pfx 和 .pvk 文件中。

通常,您仅与其他方交换您的证书 (.cer) 和任何中间颁发者的证书(即除根 CA 之外的所有 CA 的证书)。

Windows uses .cer extension for an X.509 certificate. These can be in "binary" (ASN.1 DER), or it can be encoded with Base-64 and have a header and footer applied (PEM); Windows will recognize either. To verify the integrity of a certificate, you have to check its signature using the issuer's public key... which is, in turn, another certificate.

Windows uses .pfx for a PKCS #12 file. This file can contain a variety of cryptographic information, including certificates, certificate chains, root authority certificates, and private keys. Its contents can be cryptographically protected (with passwords) to keep private keys private and preserve the integrity of root certificates.

Windows uses .pvk for a private key file. I'm not sure what standard (if any) Windows follows for these. Hopefully they are PKCS #8 encoded keys. Emmanuel Bourg reports that these are a proprietary format. Some documentation is available.

You should never disclose your private key. These are contained in .pfx and .pvk files.

Generally, you only exchange your certificate (.cer) and the certificates of any intermediate issuers (i.e., the certificates of all of your CAs, except the root CA) with other parties.

静若繁花 2024-08-29 06:37:23

以下是我个人的超浓缩笔记,就目前与我相关的主题而言,供任何感兴趣的人使用:

  • 两者 PKCS12PEM< /strong> 可以存储整个证书链:公钥、私钥根 (CA) 证书
  • .pfx == .p12 == "PKCS12
    • 完全加密
  • .pem == .cer == .cert == "PEM" (或者也许不是……可能是二进制的……请参阅评论……)
    • base-64(字符串)编码X509 证书(二进制),带有页眉和页脚
      • base-64 基本上只是一串“A-Za-z0-9+” /”用来表示0-63,一次6位二进制,按顺序,有时在有剩余时在最后加上1或2个“=”字符(“=”是“填充/垃圾/忽略/抛出”离开”字符)
      • 页眉和页脚类似于“-----BEGIN CERTIFICATE-----”和“-----END CERTIFICATE-----”或“-----BEGIN ENCRYPTED PRIVATE KEY” -----”和“-----结束加密私钥-----”
    • Windows 将 .cer 和 .cert 识别为证书文件
  • .jks == "Java 密钥存储"
    • 只是 API 使用的 Java 特定文件格式
      • .p12 和 .pfx 文件也可以与 JKS API 一起使用
  • .p12 和 .pfx 文件也可以与 JKS API “信任存储” 包含公共、可信、根 (CA) 证书,而
    身份/密钥存储”包含私人身份证书;文件方面,
    然而,它们是相同的。

Here are my personal, super-condensed notes, as far as this subject pertains to me currently, for anyone who's interested:

  • Both PKCS12 and PEM can store entire cert chains: public keys, private keys, and root (CA) certs.
  • .pfx == .p12 == "PKCS12"
    • fully encrypted
  • .pem == .cer == .cert == "PEM" (or maybe not... could be binary... see comments...)
    • base-64 (string) encoded X509 cert (binary) with a header and footer
      • base-64 is basically just a string of "A-Za-z0-9+/" used to represent 0-63, 6 bits of binary at a time, in sequence, sometimes with 1 or 2 "=" characters at the very end when there are leftovers ("=" being "filler/junk/ignore/throw away" characters)
      • the header and footer is something like "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----" or "-----BEGIN ENCRYPTED PRIVATE KEY-----" and "-----END ENCRYPTED PRIVATE KEY-----"
    • Windows recognizes .cer and .cert as cert files
  • .jks == "Java Key Store"
    • just a Java-specific file format which the API uses
      • .p12 and .pfx files can also be used with the JKS API
  • "Trust Stores" contain public, trusted, root (CA) certs, whereas
    "Identity/Key Stores" contain private, identity certs; file-wise,
    however, they are the same.
べ繥欢鉨o。 2024-08-29 06:37:23

在Windows平台中,这些文件类型用于证书信息。通常用于 SSL 证书和公钥基础设施 (X.509)。

  • CER 文件:
    CER文件用于存储X.509证书。通常用于 SSL 认证,以验证和识别 Web 服务器的安全性。该文件包含有关证书所有者和公钥的信息。 CER 文件可以是二进制 (ASN.1 DER) 或使用包含页眉和页脚的 Base-64 编码 (PEM),Windows 将识别这两种布局中的任何一种。
  • PVK 文件:
    代表私钥。 Windows 使用 PVK 文件来存储私钥,以便在各种 Microsoft 产品中进行代码签名。 PVK 是专有格式。
  • PFX 文件
    个人交换格式,是 PKCS12 文件。其中包含各种加密信息,例如证书、根权限证书、证书链和私钥。它通过密码进行加密保护,以保持私钥的私密性并保持根证书的完整性。 PFX 文件还用于各种 Microsoft 产品,例如 IIS。

有关更多信息,请访问:证书文件: .Cer x .Pvk x .Pfx

In Windows platform, these file types are used for certificate information. Normally used for SSL certificate and Public Key Infrastructure (X.509).

  • CER files:
    CER file is used to store X.509 certificate. Normally used for SSL certification to verify and identify web servers security. The file contains information about certificate owner and public key. A CER file can be in binary (ASN.1 DER) or encoded with Base-64 with header and footer included (PEM), Windows will recognize either of these layout.
  • PVK files:
    Stands for Private Key. Windows uses PVK files to store private keys for code signing in various Microsoft products. PVK is proprietary format.
  • PFX files
    Personal Exchange Format, is a PKCS12 file. This contains a variety of cryptographic information, such as certificates, root authority certificates, certificate chains and private keys. It’s cryptographically protected with passwords to keep private keys private and preserve the integrity of the root certificates. The PFX file is also used in various Microsoft products, such as IIS.

for more information visit:Certificate Files: .Cer x .Pvk x .Pfx

ま昔日黯然 2024-08-29 06:37:23

我实际上不久前遇到过这样的事情... 在 msdn 上查看(参见第一个答案)

总结:

.cer - 以 X.509 标准格式存储的证书。该证书包含有关证书所有者的信息...以及公钥和私钥。

.pvk - 文件用于存储代码签名的私钥。您还可以根据.pvk私钥文件创建证书。

.pfx - 代表个人交换格式。它用于在单个文件中交换公共和私有对象。可以从 .cer 文件创建 pfx 文件。还可用于创建软件发行商证书

我根据评论的建议总结了页面中的信息。

I actually came across something like this not too long ago... check it out over on msdn (see the first answer)

in summary:

.cer - certificate stored in the X.509 standard format. This certificate contains information about the certificate's owner... along with public and private keys.

.pvk - files are used to store private keys for code signing. You can also create a certificate based on .pvk private key file.

.pfx - stands for personal exchange format. It is used to exchange public and private objects in a single file. A pfx file can be created from .cer file. Can also be used to create a Software Publisher Certificate.

I summarized the info from the page based on the suggestion from the comments.

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