SSL 证书错误:certificate_unknown
在为开发公关创建推送通知提供程序时,我们面临以下错误: 我想知道证书有什么问题,因为我启用了推送通知然后创建了证书,但我收到了certificate_unknown 错误?
main, RECV TLSv1 ALERT: fatal, certificate_unknown
main, called closeSocket()
main, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
Error pushing notification(s):
Invalid certificate chain (Received fatal alert: certificate_unknown)! Verify that the keystore you provided was produced according to specs...
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:359)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:301)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:258)
at javapns.Push.payload(Push.java:122)
at javapns.Push.alert(Push.java:36)
at com.applicationname.pns.PushNotification.main(PushNotification.java:31)
//我用于推送通知的代码
/**
*
*/
package com.applicationname.pns;
import org.json.JSONException;
import javapns.Push;
import javapns.devices.Device;
import javapns.notification.Payload;
import javapns.notification.PushNotificationManager;
import javapns.notification.PushNotificationPayload;
public class PushNotification
{
private static final String HOST = "gateway.sandbox.push.apple.com";
private static final int PORT = 2195;
private static final int BADGE = 66;
private static String iPhoneId = "5696ee2fa44c61fd21a7987d2b1bcf57faa1603e63cb57ff204b158fb90d28a3";
private static String certificate = "D:/./trunk/Development/JavaPNS/src/com/applicationname/pns/privateKey.p12";
private static String passwd = "password@1234";
/**
* @param args
*/
public static void main(String[] args)
{
Push.alert("Hello World!", certificate, passwd, false,iPhoneId);
PushNotificationPayload payLoad = new PushNotificationPayload();
try
{
payLoad.addAlert("Hello World!");
payLoad.addBadge(10);
}
catch (JSONException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
while creating push notification provider for development pr we are facing the below error:
I want to what is the wrong with certificate, because I have enabled the push notification then created the certificate but I am getting certificate_unknown error?
main, RECV TLSv1 ALERT: fatal, certificate_unknown
main, called closeSocket()
main, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
Error pushing notification(s):
Invalid certificate chain (Received fatal alert: certificate_unknown)! Verify that the keystore you provided was produced according to specs...
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:359)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:301)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:258)
at javapns.Push.payload(Push.java:122)
at javapns.Push.alert(Push.java:36)
at com.applicationname.pns.PushNotification.main(PushNotification.java:31)
//my code which I am using for push notification
/**
*
*/
package com.applicationname.pns;
import org.json.JSONException;
import javapns.Push;
import javapns.devices.Device;
import javapns.notification.Payload;
import javapns.notification.PushNotificationManager;
import javapns.notification.PushNotificationPayload;
public class PushNotification
{
private static final String HOST = "gateway.sandbox.push.apple.com";
private static final int PORT = 2195;
private static final int BADGE = 66;
private static String iPhoneId = "5696ee2fa44c61fd21a7987d2b1bcf57faa1603e63cb57ff204b158fb90d28a3";
private static String certificate = "D:/./trunk/Development/JavaPNS/src/com/applicationname/pns/privateKey.p12";
private static String passwd = "password@1234";
/**
* @param args
*/
public static void main(String[] args)
{
Push.alert("Hello World!", certificate, passwd, false,iPhoneId);
PushNotificationPayload payLoad = new PushNotificationPayload();
try
{
payLoad.addAlert("Hello World!");
payLoad.addBadge(10);
}
catch (JSONException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试加载公钥代替私钥
私钥由服务器端的 SSL 套接字加载。
Try to load the public key in place of privatekey
The private key is loaded by the SSL socket on the server side.
您应该确保遵循官方 JavaPNS 网站上记录的过程来准备证书。遵循此程序的开发人员可以获得积极的结果。
You should make sure to follow the procedure for preparing certificates documented on the official JavaPNS web site. Developers that follow this procedure get positive results.
我在jdk 1.7中使用p12解决了这个问题,只是在将p12文件的passwd长度更改为大于或等于6之后。否则,会发生以下错误:
[[1] 未传输到令牌 595d8..725bf javapns.communication.exceptions.InvalidCertificateChainException:证书链无效(收到致命警报:certificate_unknown)!验证您提供的密钥库是否按照规范生成...]
I solved the issue in jdk 1.7 and using p12, just after changing the passwd length of p12 file greater than or equal 6. Otherwise, the following error happens:
[[1] not transmitted to token 595d8..725bf javapns.communication.exceptions.InvalidCertificateChainException: Invalid certificate chain (Received fatal alert: certificate_unknown)! Verify that the keystore you provided was produced according to specs...]