self signed certificates in iOS

Five Tips for Using Self Signed SSL Certificates with iOS
Create a HTTPS Server to install ipa locally

1
2
3
4
5
6
# example
# openssl genrsa -out myselfsigned.key 2048
# openssl req -new -x509 -key myselfsigned.key -out myselfsigned.cer -days 365 -subj /CN=www.mysite.com
# openssl pkcs12 -export -out myselfsigned.pfx -inkey myselfsigned.key -in myselfsigned.cer
1
2
3
4
5
6
7
8
9
10
openssl genrsa -out myCA.key 2048
openssl req -x509 -new -key myCA.key -out myCA.cer -days 730 -subj /CN="My Custom CA"
openssl genrsa -out mycert1.key 2048
openssl req -new -out mycert1.req -key mycert1.key -subj /CN=www2.mysite.com
openssl x509 -req -in mycert1.req -out mycert1.cer -CAkey myCA.key -CA myCA.cer -days 365 -CAcreateserial -CAserial serial

www.mysite.com 可以是ip

  • 服务器使用mycert1.cer mycert1.key 创建https服务
  • 手机端下载安装myCA.cer