Apple APNS and Trust Trusted CA Root Certificate?

I am trying to send push notifications to iOS devices.
I created a developer certificate for APNS and associated it with the application identifier.

Then I started using Pushy ( https://github.com/relayrides/pushy ) to establish a connection to the APNS server:

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

....

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.
        }
    }
}

I get this error: javax.net.ssl.SSLException: Received fatal alert: certificate_unknown.


I use a P12 file that I created from the private key of the certificate that I linked to the application on developer.apple.com enter image description here



After a lot of searching, I managed to get some information on why I can't get this to work in the Apple Doc :

. TLS APN, CA . OS X, . , . - Entrust SSL.

, .
.

.

+4
1

. , , , .

OpenSSL, P12 ( Keychain Access), PEM PEM P12...

  • CER, APN ( developer.apple.com), PEM
    openssl x509 -in aps_development.cer -inform DER -out aps_development.pem -outform PEM

  • P12, Keychain PEM
    openssl pkcs12 -nocerts -in Certificates.p12 -out Certificates.pem

  • , GOOD, P12
    openssl pkcs12 -export -inkey Certificates.pem -in aps_development.pem -out GOOD_Certificates.p12

: http://help.adobe.com/en_US/as3/iphone/WS144092a96ffef7cc-371badff126abc17b1f-7fff.html

+8

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


All Articles