Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keytool import certificate java.util.IllegalFormatConversionException in linux

I am tring to create a keystore to be used in tomcat but I get the error "java.util.IllegalFormatConversionException: d != java.lang.String" using keytool. This happens only in linux (centos7) but not in windows. I created the keystore with

keytool -genkey -keyalg RSA -alias client -keystore testkeystore -storepass mypassword  -validity 3650

and tried to import the certificate with

keytool -import -alias  arubaauth  -trustcacerts -keystore testkeystore -file root_autenticazione_ATe.cer

The same commands and the same certificate do not show any error in windows.

What is wrong?

Thanks in advance

like image 251
user2959635 Avatar asked Nov 06 '17 09:11

user2959635


1 Answers

I think the problem comes from the Keytool version included in Java 8.151 and Java 9. Older versions are working correctly for me. Try downgrading your JDK environement

EDIT: further investigation make me realize the problem on last java versions occurs only for some languages. Hence it is enough to force the output language of keytool in english to solve the problem by adding the parameter -J-Duser.language=en.

Probably the tomcat default language is different than english. try running this command:

keytool -J-Duser.language=en -import -alias  arubaauth  -trustcacerts -keystore testkeystore -file root_autenticazione_ATe.cer
like image 125
gbaccetta Avatar answered Nov 11 '22 22:11

gbaccetta