15

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

2
  • Check my updated answer. That solved the problem in my case. Commented Nov 10, 2017 at 17:57
  • Done. That solved mine too. Thanks Commented Nov 14, 2017 at 10:20

1 Answer 1

66

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
Sign up to request clarification or add additional context in comments.

2 Comments

You saved my day! my problem was with the language, I'm using Java 8 and when I forced english the SHA1 key was printed out normally.
Indeed, I think the problem is the presence of non-ASCII character in the output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.