$>openssl pkcs12 -export -clcerts -in xxx/xxx-cert.pem -inkey xxx/xxx-key.pem -out xxx/xxx.pfx
时间: 2024-06-09 07:08:53 浏览: 22
根据提供的引用内容,命令"openssl pkcs12 -export -clcerts -in xxx/xxx-cert.pem -inkey xxx/xxx-key.pem -out xxx/xxx.pfx"用于将证书和私钥导出为.pfx格式文件。这个命令将使用证书文件(xxx/xxx-cert.pem)和相应的私钥文件(xxx/xxx-key.pem)来创建一个包含证书和私钥的.pfx文件(xxx/xxx.pfx)。
相关问题
将client-cert-key.pem拆分成client.pem和client.key
可以使用以下命令将`client-cert-key.pem`拆分成`client.pem`和`client.key`:
```
openssl pkcs12 -in client-cert-key.pem -nocerts -out client.key
openssl pkcs12 -in client-cert-key.pem -clcerts -nokeys -out client.pem
```
第一条命令将从`client-cert-key.pem`中提取私钥并将其输出到`client.key`文件中。第二条命令将从`client-cert-key.pem`中提取证书并将其输出到`client.pem`文件中。
采用OpenSSL将pem和key.pem转换为怕2
可以使用openssl命令将PEM格式的文件转换为PKCS#12格式的文件(.pfx或.p12文件),然后再从PKCS#12文件中提取出PEM格式的私钥和证书。
1. 将pem和key.pem合并为一个文件:
```
cat pemfile.pem keyfile.pem > combined.pem
```
2. 将合并后的文件转换为PKCS#12格式的文件:
```
openssl pkcs12 -export -out cert.pfx -in combined.pem
```
在此过程中,您将被要求输入PEM文件中包含的私钥的密码。
3. 从PKCS#12文件中提取出PEM格式的私钥和证书:
```
openssl pkcs12 -in cert.pfx -nocerts -out key.pem
openssl pkcs12 -in cert.pfx -clcerts -nokeys -out cert.pem
```
在此过程中,您将被要求输入PKCS#12文件的密码。
现在,您可以使用PEM格式的key.pem和cert.pem文件,以及不同的密码,来配置Web服务器或其他应用程序。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)