I'm having problems with a generated certificate I'm using to connect to the apple push services. All works fine when the generated p12 file was in my src/main/java folder, but I moved it to src/main/resources and it decided to stop working with the following error:
DerInputStream.getLength(): lengthTag=111, too big.
To get into some more detail: I'm using the notnoop push notifications library and followed the tutorial from Ray Wenderlich to generate the certificates. after, I used to following commands to generate a p12 file for use in java:
openssl x509 -in aps_development.cer -inform DER -out aps_development.pem -outform PEM
openssl pkcs12 -nocerts -in single.p12 -out single.pem
openssl pkcs12 -export -inkey single.pem -in aps_development.pem -out dual.p12
after that I moved the dual.p12 into my java project. At first the file was in my /src/main/java folder, lets say at com.company.push.certificates
(while the code requesting the file is at com.company.push
). I request an inputstream by using
InputStream stream = this.getClass().getResourceAsStream("certificates/dual.p12");
This working fine in development, but not when building the project (using maven), thats why I moved the resource to the resources folder, using the exact same package.
The resource still gets found, but now I get the above-mentioned java.io.IOException
Anyone knows what might be causing this?
Ps: when I move the file back into the package in src/main/java, all works fine again, so the certificate seems to be valid.