I want to create push notification server and while installing SSL certificate and .p12 file in server we are facing the below error: I want to know what is the wrong with ssl certificate because 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)

//source code

    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();

                payLoad.addAlert("Hello World!");
            catch (JSONException e)
                // TODO Auto-generated catch block


  • I just trying to know if any one else also created push notification development server he can help me if I am missing something. – User97693321 Nov 1 '11 at 16:32
  • I have given same certificates to "urbanairship" the push notification service provider to get push notification for development environment it worked. So I want to what I am doing wrong to create our own push notification server? – User97693321 Nov 1 '11 at 16:42

It is unusual to load the private key as a client request to an SSL socket. I personally think you should be loading the public key. The private key is loaded by the SSL socket on the server side. The only reason you would need the private key is for acting like a server and accepting connections from the other end, but you don't seem to be doing that.

This might explain the "cert in wrong format" message.

In reference to:

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

I think the error is pretty self-evident, your certificate chain does not actually verify your certificate properly. Perhaps you are missing one or more of the chaining certs needed to verify your final end cert?

What ever it is, the error gives you the very clear instruction to "Verify that the keystore you provided was produced according to specs...".

There is nothing anyone on this site can possible add other than to read what your error message says and to do it - none of us have crystal balls, nor can we magically fix your problem.

I don't see the point in posting a question where you give us no more information other than a VERY clear error message that tells you exactly what to do. All we can say is "do what the error message says!"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.