简体   繁体   English

纯文本证书如何编码为 PEM/CRT 格式?

[英]How is a cert in plaintext encoded to PEM / CRT format?

I just bought an SSL cert from my domain registrar.我刚刚从我的域名注册商处购买了 SSL 证书。

They only provided me:他们只给了我:

  • Plaintext of the CSR CSR 明文
  • Plaintext of the intermediate and root CA(?) certs中间和根 CA(?) 证书的明文
  • Plaintext of my SSL cert我的 SSL 证书的明文

(no .key file) (没有 .key 文件)

I had to copy the plaintext from their webpage after they magically created the cert.在他们神奇地创建证书后,我不得不从他们的网页中复制明文。

My SSL cert looks like:我的 SSL 证书如下所示:

-----BEGIN CERTIFICATE-----
MIIGJTCCBQ2gAwIBAgIQD5EJV21qWTH5W6AhivSAEzANBgkqhkiG9w0BAQsFADBZ
<more string>
-----END CERTIFICATE-----

Questions:问题:

  1. If I create a new "cert. pem " file and just paste the plaintext of my SSL cert in, is it fully pem encoded or do I have to further process it?如果我创建一个新的“ cert.pem ”文件并将我的 SSL 证书的明文粘贴进去,它是完全 pem 编码的还是我必须进一步处理它?

  2. What if I create a new "cert. crt " file?如果我创建一个新的“ cert.crt ”文件怎么办? Could I just paste the plaintext of my SSL cert in there as well without further encoding?我是否可以将我的 SSL 证书的明文也粘贴到那里而无需进一步编码?

  3. Could either file now be passed as a client cert in HTTPS requests?现在可以在 HTTPS 请求中将任一文件作为客户端证书传递吗?

Edit: As @Marc mentioned, I should have said "text" above rather than "plaintext".编辑:正如@Marc 提到的,我应该在上面说“文本”而不​​是“纯文本”。 Aside from the headers, the cert is not in plaintext.除了标题之外,证书不是明文。

What you call "plaintext" is PEM encoding , which is base-64 encoding of a DER (or BER or CER) file with extra headers.您所说的“纯文本”是 PEM 编码,它是带有额外标头的 DER(或 BER 或 CER)文件的 base-64 编码。

.crt is commonly used for PEM encoding. .crt通常用于 PEM 编码。 But the actual extension does not matter.但实际的扩展并不重要。

You can definitely use the shown certificate in your client (how to do so depends on the language used).您绝对可以在客户端中使用显示的证书(如何使用取决于所使用的语言)。

However, you will need the key .但是,您将需要密钥 If you sent a CSR to them, the key should already be in your possession (you sent them the public key as part of the CSR, but the private key stayed with you).如果您向他们发送了 CSR,则密钥应该已经在您的手中(您将公钥作为 CSR 的一部分发送给他们,但私钥留在您身边)。 If you did not send them a CSR, they generated the key pair for you and should have a way to download the private key.如果您没有向他们发送 CSR,他们会为您生成密钥对,并且应该可以下载私钥。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM