我正在使用 Java APNS(com.notnoop.apns,v0.2.3)将推送通知发送到我的 iOS 应用程序。我正在使用以下几行创建 APNS 服务:
private ApnsService createApnsService() throws IOException {
ApnsServiceBuilder serviceBuilder = APNS.newService().withCert(certResource.getInputStream(), certPassword);
serviceBuilder.withSandboxDestination();
return serviceBuilder.build();
}
并收到以下异常:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is com.notnoop.exceptions.NetworkIOException: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)\n\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:647)\n\tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:728)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)... <<...the stacktrace is much longer, but I've cut it of here, since nobody would read it anyway...>>
我猜我的 P12 证书不正确。(我也尝试过 PEM 证书。)目前我以这种方式创建了 P12 证书,然后应用了密码:
创建与 Java APNS 兼容的证书的正确方法是什么?