Pin the trusted APNs CA cert.

This commit is contained in:
Jon Chambers authored and Jon Chambers committed 2021-03-31 17:59:32 -04:00
1 parent 2f6105f9bc
commit 6dfd13118d
2 files changed
+27

No files matched your search

@@ -35,6 +35,7 @@ import static com.codahale.metrics.MetricRegistry.name;
public class RetryingApnsClient {
private static final String APNS_CA_FILENAME = "AAACertificateServices.crt";
private static final Logger logger = LoggerFactory.getLogger(RetryingApnsClient.class);
private final ApnsClient apnsClient;
@@ -51,6 +52,7 @@ public class RetryingApnsClient {
this.apnsClient = new ApnsClientBuilder().setSigningKey(ApnsSigningKey.loadFromInputStream(new ByteArrayInputStream(apnSigningKey.getBytes()), teamId, keyId))
.setMetricsListener(metricsListener)
.setTrustedServerCertificateChain(getClass().getResourceAsStream(APNS_CA_FILENAME))
.setApnsServer(sandbox ? ApnsClientBuilder.DEVELOPMENT_APNS_HOST : ApnsClientBuilder.PRODUCTION_APNS_HOST)
.build();
}