Commit 62cba1b0 by Administrator

创建证书

1 parent 394892ba
#!/bin/bash
# 创建推送证书的完整脚本. 使用 OpenSSL 命令行
echo "🚀 开始创建推送证书所需文件..."
# 创建目录
mkdir -p ~/Desktop/APNSCertificate
cd ~/Desktop/APNSCertificate
# 1. 生成私钥
echo "1. 生成私钥..."
openssl genrsa -out apns_private.key 2048
echo "✅ 私钥已生成: apns_private.key"
# 2. 生成 CSR
echo "2. 生成 CSR 文件..."
# openssl req -new \
# -key apns_private.key \
# -out CertificateSigningRequest.certSigningRequest \
# -subj "/emailAddress=your.email@company.com/CN=APNS Certificate/O=$(whoami)/C=US"
openssl req -new \
-key apns_private.key \
-out CertificateSigningRequestApns.certSigningRequest \
-subj "/emailAddress=info@banxiaoer.com/CN=APNS Certificate/O=ZhongshanBanXiaoEr/C=US"
# 3. 创建 PEM 格式(备用)
openssl rsa -in apns_private.key -out apns_private.pem
echo "✅ CSR 已生成: CertificateSigningRequest.certSigningRequest"
echo ""
echo "📋 下一步操作:"
echo "1. 访问 https://developer.apple.com"
echo "2. 进入 Certificates → Add (+)"
echo "3. 选择 'Apple Push Notification service SSL (Sandbox & Production)'"
echo "4. 选择你的 App ID"
echo "5. 上传此文件夹中的 CertificateSigningRequest.certSigningRequest"
echo "6. 下载证书文件 (.cer)"
echo ""
echo "⚠️ 重要:请保管好 apns_private.key 文件!"
security find-identity -p codesigning -v
security find-certificate -c "Apple Push Services" -Z
#############
创建 .p12 文件
#!/bin/bash
# 将 .cer 文件转换为 .p12
# 假设你的文件在桌面 APNSCertificate 文件夹
cd ~/Desktop/APNSCertificate
# 1. 将 .cer 转换为 .pem
echo "将 .cer 证书转换为 PEM 格式..."
openssl x509 -in "你的证书文件名.cer" -inform DER -out certificate.pem
# 2. 创建 .p12 文件
echo "创建 .p12 文件..."
openssl pkcs12 -export \
-inkey apns_private.key \
-in certificate.pem \
-out apns_certificate.p12
echo "✅ 完成!"
echo "📁 .p12 文件: apns_certificate.p12"
echo "🔑 需要设置密码(推送服务器配置时会用到)"
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!