今天在制作推送證書時發(fā)現(xiàn)網(wǎng)上很多文章貼的命令制作出來的證書驗證都不能通過澈侠,現(xiàn)在記錄一下可用的命令:
-
導(dǎo)出證書的.p12文件
$ openssl pkcs12 -in apns-dev-cert.p12 -out apns-dev-cert.pem -nodes -clcerts
-
導(dǎo)出秘鑰的.p12文件
$ openssl pkcs12 -in apns-dev-key.p12 -out apns-dev-key.pem -nodes -clcerts
- 驗證證書有效性
$ openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert apns-dev-cert.pem -key apns-dev-key.pem
驗證通過時會有如下提示:
.................................
erver public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : DES-CBC3-SHA
Session-ID:
Session-ID-ctx:
Master-Key: BA25xxxxxxxxxxxx...
Start Time: 1610615416
Timeout : 7200 (sec)
Verify return code: 0 (ok)
---
- 合并兩個 .pem 文件成推送證書
$ cat apns-dev-cert.pem apns-dev-key.pem > apns-dev.pem