1. 程式人生 > 其它 >電子公文傳輸系統——前端的建立與修改

電子公文傳輸系統——前端的建立與修改

##任務片段
gmssl安裝部署
![](https://img2023.cnblogs.com/blog/3021804/202212/3021804-20221211105639531-1865036585.png)

![](https://img2023.cnblogs.com/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
```
![](https://img2023.cnblogs.com/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
```

![](https://img2023.cnblogs.com/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
```

簽名證書和加密證書

![](https://img2023.cnblogs.com/blog/3021804/202212/3021804-20221211110023691-1909970363.png)