iOS 自签名证书建立(self-signed)

新建一root、一server文件夹

1.创建私钥:

openssl genrsa -out root/root-key.pem 1024

2.创建证书请求:

openssl req -new -out root/root-req.csr -key root/root-key.pem

3.自签署证书:

openssl x509 -req -in root/root-req.csr -out root/root-cert.pem -signkey root/root-key.pem -days 3650

4.将证书导出成浏览器支持的.p12格式:

openssl pkcs12 -export -clcerts -in root/root-cert.pem -inkey root/root-key.pem -out root/root.p12

5.将证书导出cer格式:

openssl x509 -req -in root-req.csr -out ca.cer -outform der -signkey root-key.pem -days 3650

生成server证书

1.创建私钥:

openssl genrsa -out server/server-key.pem 1024

2.创建证书请求:

openssl req -new -out server/server-req.csr -key server/server-key.pem

3.自签署证书:

openssl x509 -req -in server/server-req.csr -out server/server-cert.pem -signkey server/server-key.pem -CA root/root-cert.pem -CAkey root/root-key.pem -CAcreateserial -days 3650

4.将证书导出成浏览器支持的.p12格式:

openssl pkcs12 -export -clcerts -in server/server-cert.pem -inkey server/server-key.pem -out server/server.p12

5.将证书导出cer格式:

openssl x509 -req -in server-req.csr -out server.cer -outform der -signkey server-key.pem -days 3650

你可能感兴趣的:(iOS 自签名证书建立(self-signed))