Description
Using the same certificate and password on Windows works fine, but on Linux we get PKCS12 key store mac invalid - wrong password or corrupted file.
The Java code to reproduce this is very simply:
KeyStore keyStore = KeyStore.getInstance("PKCS12", new BouncyCastleProvider());
keyStore.load(new FileInputStream(filename), password.toCharArray());
We have tested using both bcprov-jdk18on-1.79.jar and bcprov-jdk18on-1.81.jar and both have the same issue.
The stack trace is:
Exception in thread "main" java.io.IOException: PKCS12 key store mac invalid - wrong password or corrupted file.
at org.bouncycastle.jcajce.provider.keystore.pkcs12.PKCS12KeyStoreSpi.engineLoad(Unknown Source)
at java.security.KeyStore.load(KeyStore.java:1445)
The version of Java on both Linux (having the issue) and Windows (not having the issue) is:
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
We have replaced the file multiple times and run checksums as well to make sure that it has not been corrupted.
Both the password and file are definitely correct so the error message is misleading.
We can provide both the test file and password via email if that is helpful.