openssl 生成自签名证书将私钥和证书放入一个文件?
openssl generate self-signed certificate puts private key and certificate to one file?
通过openssl
命令生成自签名证书,通常我将-keyout
和-out
指定到不同的文件,但这次我看到这样的命令,来自python ssl module: Self-signed certificates
openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem
它将私钥写入与证书相同的文件?
这有什么好处?为什么把它们放在一起?
I mean if the private key is in the certificate, then during TLS handshake the certificate is sent to client right, is this a security issue?
没有。该文件不会发送到对等方。该文件用于将证书和私钥加载到应用程序中,然后仅将证书发送给对等方。无论它们是在同一个 PEM 文件中、在不同的 PEM 文件中、在 DER 格式的文件中、在 PKCS#12 文件中等等,这都没有区别——实际文件永远不会发送。
通过openssl
命令生成自签名证书,通常我将-keyout
和-out
指定到不同的文件,但这次我看到这样的命令,来自python ssl module: Self-signed certificates
openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem
它将私钥写入与证书相同的文件? 这有什么好处?为什么把它们放在一起?
I mean if the private key is in the certificate, then during TLS handshake the certificate is sent to client right, is this a security issue?
没有。该文件不会发送到对等方。该文件用于将证书和私钥加载到应用程序中,然后仅将证书发送给对等方。无论它们是在同一个 PEM 文件中、在不同的 PEM 文件中、在 DER 格式的文件中、在 PKCS#12 文件中等等,这都没有区别——实际文件永远不会发送。