自签证书

#CA
openssl genrsa -out cacert.key 2048
openssl req -x509 -new -nodes -key cacert.key -sha256 -days 3650 -subj "/CN=MyCA" -out cacert.pem

#Server
openssl genrsa -out key.pem 2048
openssl req -new -key ./key.pem -out cert.csr -subj "/CN=x.xx.com"
openssl x509 -req -in ./cert.csr -CA cacert.pem -CAkey cacert.key -CAcreateserial -out cert.pem -days 3650 -sha256

#client
openssl genrsa -out client-key.pem 2048
openssl req -new -key ./client-key.pem -out client.csr -subj "/CN=client"
openssl x509 -req -in ./client.csr -CA cacert.pem -CAkey cacert.key -CAcreateserial -out client.pem -days 3650 -sha256

posted @ 2024-01-18 16:24  ahuo  阅读(13)  评论(1编辑  收藏  举报