Problems sending Push to IOS devices

0

I have a server on aws with a SpringBoot backend, that same backend works with push sending.

This same backend, when run on a local machine and using the Apple Push Services certificate as Developer sends Push normally, however when I try to use the Production certificate I get the following error:

  

18: 35: 17.459 [pool-3-thread-1] ERROR   c.n.apns.internal.ApnsConnectionImpl - Could not send message after 3   retries.Message (Id = 25;   Token = XXXXXXX;   Payload = {"aps": {content-available: 1}, "reason-code": "HELP_REQUEST_FOUND", "help-request-id": "1"   javax.net.ssl.SSLHandshakeException: Received fatal alert:   certificate_expired

NOTE: The certificate is not expired, as I have just generated the same certificate. And also when I use Pusher with this same certificate Push arrives correctly on the device.

The procedure I followed to generate the certificate was to create the same and download the file .cer and then export it as .p12 using the mac key access software.

Here is the code that I use to push:

    @PostConstruct
    public void setup() {
        //Pega o certificado .p12 de uma pasta
        InputStream stream = getClass().getResourceAsStream(certificate);

        service = APNS.newService()
                .withCert(stream, password)
                .withProductionDestination()
                .build();
    }

    public boolean push(Pushable toPush){
        try{
            if(toPush.destination().getPushId() != null){
                String payload = builder.buildPayload(toPush);
                service.push(toPush.destination().getPushId(), payload);
                return true;
            }
        } catch (Exception ex){
            ex.printStackTrace();
        }

        return false;
    }

Does anyone have any suggestions about the problem?

    
asked by anonymous 22.08.2018 / 20:45

0 answers