##任务片段
gmssl安装部署
![](/i/l/?n=23&i=blog/3021804/202212/3021804-20221211105639531-1865036585.png)
![](/i/l/?n=23&i=blog/3021804/202212/3021804-20221211105653775-1452604003.png)
gmssl搭建微型CA(单根CA层次模型)
对CA基本参数进行配置
```
mkdir certs clr newcerts private
touch index.txt
touch index.txt.attr
echo "01" > serial
```
![](/i/l/?n=23&i=blog/3021804/202212/3021804-20221211105736254-1471711707.png)
构造根CA证书
```
gmssl ecparam -genkey -name sm2p256v1 -out Root.key
gmssl req -x509 -sm3 -days 3650 -key Root.key -out RootCA.crt
gmssl ecparam -genkey -name sm2p256v1 -out ca.key
gmssl req -new -sm3 -extensions v3_req -key ca.key -out ca.csr
gmssl ca -md sm3 -extensions v3_ca -in ca.csr -out ca.crt -days 1850 -cert RootCA.crt -keyfile Root.key
```
![](/i/l/?n=23&i=blog/3021804/202212/3021804-20221211105908746-130523905.png)
生成双证书
```
gmssl ca -md sm3 -in user.req -out user.crt -days 365 -cert ca.crt -keyfile ca.key
sudo vim /usr/local/gmssl/openssl.cnf
gmssl ecparam -genkey -name sm2p256v1 -text -out user.key
gmssl req -new -key user.key -out user.req
gmssl ca -md sm3 -in user.req -out user.crt -days 365 -cert ca.crt -keyfile ca.key
```
签名证书和加密证书
![](/i/l/?n=23&i=blog/3021804/202212/3021804-20221211110023691-1909970363.png)
标签:user,公文,crt,前端,传输,3021804,key,ca,out From: https://www.cnblogs.com/2012nxbjd/p/16973929.html