This is the error I get when running pushy-0.4.1.jar with WAS 8.0 JRE jre:
java.io.IOException: Unable to verify MAC.
at com.ibm.crypto.provider.PKCS12KeyStore.engineLoad(Unknown Source)
at java.security.KeyStore.load(KeyStore.java:409)
at mx.com.relayrides.pushy.apns.util.SSLContextUtil.createDefaultSSLContext(SSLContextUtil.java:68)
at mx.com.relayrides.pushy.apns.util.SSLContextUtil.createDefaultSSLContext(SSLContextUtil.java:46)
at sendAPN.SendAPNs.sendAPN(SendAPNs.java:110)
at sendAPN.SendAPNs.main(SendAPNs.java:55)
however, the same code of my method works perfectly with Sun JRE 7. This is my code in my method:
public void sendAPN(Map<String, String> data, String registrationId,
String pathFile, String pw, String message)
throws UnrecoverableKeyException, KeyManagementException, KeyStoreException, NoSuchAlgorithmException,
CertificateException, IOException, MalformedTokenStringException, InterruptedException{
LOG.info("rutaCertificado:"+pathFile+"\nregistrationId:"+registrationId);
final PushManager<SimpleApnsPushNotification> pushManager = new PushManager<SimpleApnsPushNotification>(
ApnsEnvironment.getSandboxEnvironment(),
SSLContextUtil.createDefaultSSLContext(pathFile, pw),
null,
null,
null,
new PushManagerConfiguration(),
"ExamplePushManager"
);
pushManager.start();
final byte[] token = TokenUtil.tokenStringToByteArray(registrationId);
final ApnsPayloadBuilder payloadBuilder = new ApnsPayloadBuilder();
payloadBuilder.setAlertBody(message);
payloadBuilder.setSoundFileName("ring-ring.aiff");
if (data != null){
for (Map.Entry<String, String> entry: data.entrySet()){
payloadBuilder.addCustomProperty(entry.getKey(), entry.getValue());
}
}
final String payload = payloadBuilder.buildWithDefaultMaximumLength();
pushManager.getQueue().put(new SimpleApnsPushNotification(token, payload));
LOG.info("Mensaje enviado");
}
what I was seeing is that when I use the WAS JRE 8.0, the WAS uses this class, which is where it fails:
com.ibm.crypto.provider.PKCS12KeyStore
but when I use the JRE 7 sun, the JRE use this other class and working properly:
sun.security.pkcs12.PKCS12KeyStore
Please Help me and
thank you very much for your help