下载解压 openssl-OpenSSL_1_1_1a.tar.gz
cd openssl-OpenSSL_1_1_1a
./config -fPIC no-gost no-shared no-zlib --prefix=./out
make && make install
cd out/bin
./openssl ecparam -out sm2.key -name SM2 -genkey
./openssl req -config ../ssl/openssl.cnf -key sm2.key -new -out sm2.req
./openssl x509 -req -in sm2.req -signkey sm2.key -out sm2.pem
可以使用这个证书再签发 server 证书:
./openssl ecparam -out sm2_site.key -name SM2 -genkey
./openssl req -config ../ssl/openssl.cnf -key sm2_site.key -new -out sm2_site.req
./openssl x509 -req -in sm2_site.req -CA sm2.pem -CAkey sm2.key -out sm2_site.pem -CAcreateserial