我在使用密钥对加载KeyStore时遇到问题,密钥对的密码与KeyStore不同。
使用以下代码,我尝试加载KeyStore:
try (InputStream inputStream = new FileInputStream(new File("src\\integrationTest\\test.p12"))) {
keyStore = KeyStore.getInstance("PKCS12","BC");
keyStore.load(inputStream, "test".toCharArray());
}
在运行时抛出以下异常:
java.io.IOException: exception unwrapping private key - java.security.InvalidKeyException: pad block corrupted