Fatal warning received: handshake_failure

I am trying to send push notifications to my device using javapns library in liferay . Here is the code:

private void pushNotification(ActionRequest actionRequest,
            ActionResponse actionResponse) {

        try {
            System.out.println("Push");

            Push.alert("Hello World!", "ck.p12", "PASSPHRASE", false, "TOKEN");

        } catch (CommunicationException e) {
            System.out.println("CommunicationException");
            e.printStackTrace();
        } catch (KeystoreException e) {
            System.out.println("KeystoreException");
            e.printStackTrace();
        }

    }

I get this error when pushNotification is called:

ERROR [PushNotificationManager:450] Delivery error: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

I searched for it but did not find a solution.

Does anyone know how to solve this problem?

+3
source share
3 answers

An exception is javax.net.ssl.SSLHandshakeExceptionusually thrown when the server you are trying to connect to does not have a valid certificate from an authorized certificate authority.

, , , , , Java-. KeyStore .. . this .

+9

javax.net.ssl.keyStore=../keystore/keystoreFile.jks
javax.net.ssl.keyStorePassword=yourPassword
javax.net.ssl.trustStore=../keystore/keystoreFile.jks
javax.net.ssl.trustStorePassword=yourPassword
javax.net.debug=true

,

keytool -genkey -alias myKeyStore -keyalg RSA -keystore /home/aniket/keystore/keystoreFile.jks
0

This algo happens when, for example, the server only accepts TLS and your client tries to create an SSL connection ... also check the server / client configuration

0
source

Source: https://habr.com/ru/post/1529230/


All Articles