Weird problem and I verified it is reading the same file.
This does not work:
keystore = KeyStore.getInstance("PKCS12");
InputStream inputStream = ClassLoader.getSystemResourceAsStream("keystores/active.pfx");
keystore.load(inputStream, "the_password".toCharArray());
This, however, does work:
keystore = KeyStore.getInstance("PKCS12");
InputStream inputStream = new FileInputStream(new File("src/main/resources/keystores/active.pfx"));
keystore.load(inputStream, "the_password".toCharArray());
I get the following error:
DER length more than 4 bytes: 111
It's that change of the input stream and I can't figure out what the difference is. I triple-checked the file to make sure it was using the same file. Why is Java treating these streams differently? If I figure out that, I can probably figure out how to fix the problem.