Java APNS Certificate Error with “DerInputStream.getLength(): lengthTag=109, too big.”

When I try to using java APNS to send the push notification to iOS, I got this error message:

com.notnoop.exceptions.InvalidSSLConfig: DerInputStream.getLength(): lengthTag=109, too big.

I already try converting the certificate to Personal Information Exchange (.p12) also getting the same error. Anyone know to problem and how to resolve it?

Here are my java code:

ApnsService service =
   .withCert("src/net/notification/ck.jks", "******")

String payload = APNS.newPayload().alertBody(record.getSendMsg()).build();
String token = record.getToken();
service.push(token, payload);



I had the same problem but my solution will help you only if you are using maven.

Maven resource filtering (that let’s you include variables in your resource files) can mess up your binaries – and certificates are especially sensitive to modification.

In general, binary content shouldn’t be filtered. But I couldn’t just simply disable resource filtering because I have some .properties files that include variables. So the solution was to exclude .p12 files from filtering.


More about maven resource filtering:

Source: stackoverflow