[SOLVED] Keytool Errors

Support for webhosts that use CentOS
Post Reply
JoeLemaire
Posts: 20
Joined: 2011/08/18 12:51:57

[SOLVED] Keytool Errors

Post by JoeLemaire » 2012/03/29 19:22:12

Hey All,

I have been racking my brain, trying to figure this out. I have generated a CSR using openssl. I sent the CSR out to my cert provider (Network Solutions), and received my cert. I am now trying to install my cert into the keystore I created, and I can't figure out where I'm going wrong. Here's the command I'm running:

[code]
[root@WSRProxy ssl]# keytool -import -trustcacerts -alias root -file AddTrustExternalCARoot.crt -keystore star_vtinfo_com.key
Enter key store password: keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic
[root@WSRProxy ssl]#
[/code]

I've also tried looking for other versions of Java on my server, and using the keytool app from those:

[code]
[root@WSRProxy ssl]# locate keytool
/etc/alternatives/keytool
/usr/bin/gkeytool
/usr/bin/keytool
/usr/include/net-snmp/library/keytools.h
/usr/include/ucd-snmp/keytools.h
/usr/java/jre1.6.0_20/bin/keytool
/usr/java/jre1.6.0_20/man/ja_JP.eucJP/man1/keytool.1
/usr/java/jre1.6.0_20/man/man1/keytool.1
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/bin/keytool
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/keytool
[root@WSRProxy ssl]#
[root@WSRProxy ssl]# /etc/alternatives/keytool -import -trustcacerts -alias root -file AddTrustExternalCARoot.crt -keystore star_vtinfo_com.key
Enter key store password:
keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic
[root@WSRProxy ssl]# /usr/bin/keytool -import -trustcacerts -alias root -file AddTrustExternalCARoot.crt -keystore star_vtinfo_com.key
Enter key store password:
keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic
[root@WSRProxy ssl]#
[root@WSRProxy ssl]# /usr/java/jre1.6.0_20/bin/keytool -import -trustcacerts -alias root -file AddTrustExternalCARoot.crt -keystore star_vtinfo_com.key
keytool error: java.io.IOException: Invalid keystore format
[root@WSRProxy ssl]# /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/bin/keytool -import -trustcacerts -alias root -file AddTrustExternalCARoot.crt -keystore star_vtinfo_com.key
Enter key store password:
keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic
[root@WSRProxy ssl]# /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/keytool -import -trustcacerts -alias root -file AddTrustExternalCARoot.crt -keystore star_vtinfo_com.key
Enter key store password:
keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic
[root@WSRProxy ssl]# /usr/java/jre1.6.0_20/man/ja_JP.eucJP/man1/keytool.1 -import -trustcacerts -alias root -file AddTrustExternalCARoot.crt -keystore star_vtinfo_com.key
-bash: /usr/java/jre1.6.0_20/man/ja_JP.eucJP/man1/keytool.1: Permission denied
[root@WSRProxy ssl]# /usr/java/jre1.6.0_20/man/man1/keytool.1 -import -trustcacerts -alias root -file AddTrustExternalCARoot.crt -keystore star_vtinfo_com.key
-bash: /usr/java/jre1.6.0_20/man/man1/keytool.1: Permission denied
[root@WSRProxy ssl]#
[/code]

Any thoughts?

User avatar
TrevorH
Forum Moderator
Posts: 26884
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Keytool Errors

Post by TrevorH » 2012/03/29 20:14:02

I don't know what the problem is but I don't think -keystore should point to the key you want to import - it should be a .jks file

JoeLemaire
Posts: 20
Joined: 2011/08/18 12:51:57

Re: Keytool Errors

Post by JoeLemaire » 2012/04/02 18:41:56

Hey TrevorH,

Thanks for the response. I think I know what I was doing wrong. I was trying to use keytool, which is used when using Tomcat. I'm just setting up Apache, so there is no need to 'import' the key. :-D I have some other issues with the cert, but I think this one is all set.

Thanks again!

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

[SOLVED] Keytool Errors

Post by pschaff » 2012/04/03 00:39:54

Thanks for reporting back. Marking this thread [SOLVED] for posterity.

Post Reply

Return to “CentOS 5 - Webhosting Support”