I know there are already a few posts about this error, but I couldn't find an answer fitting my problem :
I created an AES key with the following command :
keytool -genseckey -alias TEST -keyalg AES -keysize 128 -storepass "a#b$c<d>"
-storetype JCEKS -keystore /usr/my/path/test.jck
I then try to access the keystore from java code :
String password = "a#b$c<d>";
char[] passwordChars= password.toCharArray();
// loading the file containing the key
InputStream inputStreamFichierCle;
try {
inputStreamFichierCle = new FileInputStream(filePath);
keyStore.load(inputStreamFichierCle, passwordChars);
}
And there I get an IOException : keystore was tampered with or password was incorrect
.
Note that I tried with normal password (ex : pass) and this works perfectly, so I guess the problem here has to do with the special characters I use in my password.
What is happening, and how can I fix this?