ASethi
ASethi

Reputation: 21

keytool error: java.lang.IllegalArgumentException: publicKey's is not X.509, but X509 in OpenJDK 1.8.162

I am trying to generate a key using the command

keytool -genkey -dname CN=<>, OU=AB, O=AB, L=AB, ST=AB, C=US -alias myalias -keypass pwd -keystore C:/tmp_1.54/serverKeystore -storepass pwd -storetype PKCS12 -providername JsafeJCE -keyalg RSA -keysize 2048 -validity 360

But I am getting the below error while running the keytool. I am using OpenJDK 1.8.162.

Error : keytool error: java.lang.IllegalArgumentException: publicKey's is not X.
509, but X509
java.lang.IllegalArgumentException: publicKey's is not X.509, but X509
        at sun.security.tools.keytool.CertAndKeyGen.generate(CertAndKeyGen.java:
162)
        at sun.security.tools.keytool.Main.doGenKeyPair(Main.java:1739)
        at sun.security.tools.keytool.Main.doCommands(Main.java:1007)
        at sun.security.tools.keytool.Main.run(Main.java:366)
        at sun.security.tools.keytool.Main.main(Main.java:359)

Need help in resolving this issue.

Upvotes: 1

Views: 294

Answers (1)

ASethi
ASethi

Reputation: 21

This issue is resolved. I was trying to first enable FIPS (using RSA Bsafe) in OpenJDK 1.8 and then was trying to enable SSL in the product which was throwing this error. Later on I changed the order doing first SSL and then enable FIPS which worked seamlessly. Here the issue what I found was OpenJDK 1.8 does not support RSA Bsafe libraries before SSL is enabled.

Upvotes: 1

Related Questions