the*_*edp 4 java certificate apple-push-notifications
我正在尝试向iOS设备发送推送通知.
我为APNS创建了一个开发人员证书,并将其与应用程序标识符绑定在一起.
然后我继续使用Pushy(https://github.com/relayrides/pushy)建立与APNS服务器的连接:
final PushManagerFactory<SimpleApnsPushNotification> pushManagerFactory =
new PushManagerFactory<SimpleApnsPushNotification>(
ApnsEnvironment.getSandboxEnvironment(),
PushManagerFactory.createDefaultSSLContext( DEV_CERT_P12__PATH, DEV_CERT_P12__PASSWORD )
);
final PushManager<SimpleApnsPushNotification> pushManager = pushManagerFactory.buildPushManager();
pushManager.registerFailedConnectionListener(new MyFailedConnectionListener());
pushManager.start();
Run Code Online (Sandbox Code Playgroud)
....
public static class MyFailedConnectionListener implements FailedConnectionListener<SimpleApnsPushNotification> {
public void handleFailedConnection(
final PushManager<? extends SimpleApnsPushNotification> pushManager,
final Throwable cause) {
System.out.println("ERROR - "+ cause.toString());
if (cause instanceof SSLHandshakeException) {
// This is probably a permanent failure, and we should shut down
// the PushManager.
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到这个错误:javax.net.ssl.SSLException: Received fatal alert: certificate_unknown.
我正在使用我用我在developer.apple.com上与应用程序绑定的证书的私钥创建的P12文件

经过多次搜索,我已经设法获得一些信息,说明为什么我无法在Apple Doc中使用这个东西:
注意:要与APN建立TLS会话,必须在提供商的服务器上安装Entrust Secure CA根证书.如果服务器正在运行OS X,则此根证书已存在于钥匙串中.在其他系统上,证书可能不可用.您可以从Entrust SSL证书网站下载此证书.
但是,我仍然不知道我想做什么.
我真的很感激这里有一些更具体的指导.
谢谢.
我找到了解决方案.作为向我提出建议的人,我不知道为什么它解决了这个问题.
使用OpenSSL,我将P12文件(我从Keychain Access获得)转换为PEM,从PEM转换回P12 ...
openssl x509 -in aps_development.cer -inform DER -out aps_development.pem -outform PEMopenssl pkcs12 -nocerts -in Certificates.p12 -out Certificates.pemopenssl pkcs12 -export -inkey Certificates.pem -in aps_development.pem -out GOOD_Certificates.p12有关更多信息,请访问:http://help.adobe.com/zh_CN/as3/iphone/WS144092a96ffef7cc-371badff126abc17b1f-7fff.html
| 归档时间: |
|
| 查看次数: |
3368 次 |
| 最近记录: |