SSL证书错误:certificate_unknown


11

我想创建推送通知服务器,并且在服务器中安装SSL证书和.p12文件时,我们面临以下错误:我想知道ssl证书出了什么问题,因为我收到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();
            }

        }


}

我只是想知道是否还有其他人也创建了推送通知开发服务器,如果我丢失了某些东西,他可以帮助我。
User97693321

我已将相同的证书授予推送通知服务提供商“ urbanairship”,以获取有关其工作环境的推送通知。所以我想做错什么来创建我们自己的推送通知服务器?
User97693321

Answers:


9

将私钥作为客户端请求加载到SSL套接字是不寻常的。我个人认为您应该加载公用密钥。私钥由服务器端的SSL套接字加载。您需要私钥的唯一原因是充当服务器并接受另一端的连接,但是您似乎并没有这样做。

这可能解释了“格式错误的证书”消息。

在参照:

private static String certificate = "D:/./trunk/Development/JavaPNS/src/com/applicationname/pns/privateKey.p12"

6

我认为该错误是不言而喻的,您的证书链实际上并未正确验证您的证书。也许您缺少验证最终证书所需的一个或多个链接证书?

不管是什么,该错误为您提供了非常明确的指示:“验证您提供的密钥库是否已按照规范生产...”。

该网站上的任何人都无法添加,只能阅读并阅读错误消息中的内容并执行此操作-我们没人拥有水晶球,也无法神奇地解决您的问题。

在发布问题时,我看不到什么意思,除了一个非常清晰的错误消息可以告诉您确切的操作之外,您没有给我们更多的信息。我们所能说的就是“执行错误消息中所说的!”

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.