完善文档信息
This commit is contained in:
parent
ff98b783df
commit
ed92f62a40
32
apple_cert.md
Normal file
32
apple_cert.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
## 苹果推送服务证书申请流程
|
||||||
|
|
||||||
|
### 1. 申请CRS文件
|
||||||
|
1. 在macos下使用 钥匙串服务
|
||||||
|
2. 
|
||||||
|
3. 填写信息
|
||||||
|
3.1 用户电子邮箱地址: 填写项目的苹果开发者账号的邮箱,很重要!!
|
||||||
|
3.2 常用名称填写和app相关的名称: dimension push apns
|
||||||
|
3.3 CA电子邮箱地址: 留空
|
||||||
|
3.4 请求是:一定要选择存储到磁盘
|
||||||
|
4. 点击“继续”会生成CSR文件,这个文件用用到在第二步里面用来在苹果后台生成 cer文件
|
||||||
|
|
||||||
|
### 2. 登陆苹果开发后台
|
||||||
|
2.1: Certificates => 选择添加 => Services => Apple Push Notification service SSL (Sandbox & Production)
|
||||||
|
2.2 选择第一步生成的 CSR 文件,下载 cer文件
|
||||||
|
2.3 选择用 "钥匙串服务" 打开
|
||||||
|
2.4 在登陆项下,选择密钥,选择对应的文件, 并导出为 .p12 文件格式
|
||||||
|

|
||||||
|
2.5 将p12文件转换成推送服务器需要pem文件
|
||||||
|
openssl pkcs12 -in apns_push_key.p12 -out apns_push_key.pem -nodes -legacy
|
||||||
|
添加-legacy参数可以让 OpenSSL 使用传统加密算法支持模式,这通常能解决兼容性问题。 之前没有使用 -legacy参数导致解析失败!!
|
||||||
|
2.6 将pem文件分离成.cert和.key文件
|
||||||
|
# 提取证书部分到cert.pem
|
||||||
|
openssl x509 -in combined.pem -out cert.pem
|
||||||
|
# 提取私钥部分到private.key
|
||||||
|
openssl rsa -in combined.pem -out private.key
|
||||||
|
|
||||||
|
### 3. 推送服务的证书有效为1年,需要及时更新; 统一了开发环境和正式环境的证书
|
||||||
|
3.1 开发环境 api.sandbox.push.apple.com
|
||||||
|
3.2 正式环境 api.push.apple.com
|
||||||
|
|
||||||
|
### 4. 研究整个流程花费了1天时间
|
||||||
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
{apns_prod, [
|
{apns_prod, [
|
||||||
{connection_opts, [
|
{connection_opts, [
|
||||||
{apple_host, "https://api.push.apple.com"},
|
{apple_host, "api.push.apple.com"},
|
||||||
{apple_port, 443},
|
{apple_port, 443},
|
||||||
{certfile, "cert.pem"},
|
{certfile, "cert.pem"},
|
||||||
{keyfile, "private.key"},
|
{keyfile, "private.key"},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user