简体   繁体   English

Golang ListenAndServeTLS的Letsencrypt证书输出

[英]Letsencrypt certificate output for golang ListenAndServeTLS

Lets'Encrypt provided me with a "Signed Certificate" and an "Intermediate Certificate". Lets'Encrypt为我提供了“签名证书”和“中级证书”。 I had to create a private key domain.key for the domain before. 我之前必须为域创建私钥domain.key。

Now ListenAndServeTLS expects a certificate and a key file. 现在, ListenAndServeTLS需要证书和密钥文件。

I guess the "keyfile" is the locally generated domain.key file but what do I do with a "Signed Certificate" and an "Intermediate Certificate" if ListenAndServeTLS expects two files? 我猜“密钥文件”是本地生成的domain.key文件,但如果ListenAndServeTLS需要两个文件,我该如何处理“签名证书”和“中间证书”?

As with most http servers, the Go tls server implementation only accepts a single file for the certificate. 与大多数http服务器一样,Go tls服务器实现仅接受证书的单个文件。 From the net/http documentation: net/http文档:

If the certificate is signed by a certificate authority, the certFile should be the concatenation of the server's certificate, any intermediates, and the CA's certificate. 如果证书由证书颁发机构签名,则certFile应该是服务器证书,任何中间人和CA证书的串联。

All you need to do is concatenate the files together. 您需要做的就是将文件连接在一起。

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

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