在Ubuntu系统中,使用OpenSSL进行证书和密钥的导入导出是一个常见的操作。以下是一些基本的步骤:
导出证书(PEM格式):
openssl x509 -in certificate.crt -out certificate.pem -outform PEM
导出私钥(PEM格式):
openssl rsa -in private.key -out private.pem -outform PEM
导入证书(PEM格式):
openssl x509 -in certificate.pem -out certificate.crt -outform DER
导入私钥(PEM格式):
openssl rsa -in private.pem -out private.key -outform DER
查看证书信息:
openssl x509 -in certificate.crt -text -noout
查看私钥信息:
openssl rsa -in private.key -check -noout
生成自签名证书:
openssl req -x509 -newkey rsa:4096 -keyout private.key -out certificate.crt -days 365 -nodes
生成CSR(证书签名请求):
openssl req -new -key private.key -out certificate.csr
使用CA签名CSR:
openssl x509 -req -in certificate.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out certificate.crt -days 365
-outform DER
可以将文件转换为二进制格式,这在某些情况下是必要的。通过这些步骤,你可以在Ubuntu系统中使用OpenSSL进行证书和密钥的导入导出操作。