Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an empty java trust store?

Tags:

I want to make a https client in java which initially does not have any CA certs to trust. Since I don't want the JVM to use the default cacerts file I should make an empty trust store and point it to the JVM.
How can I make an empty trust store?

like image 406
George Avatar asked Jun 23 '16 14:06

George


1 Answers

Using keytool, create a random key pair:

keytool -genkeypair -alias boguscert -storepass storePassword -keypass secretPassword -keystore emptyStore.keystore -dname "CN=Developer, OU=Department, O=Company, L=City, ST=State, C=CA" 

then delete it

keytool -delete -alias boguscert -storepass storePassword -keystore emptyStore.keystore 

review its contents:

$ keytool -list -keystore emptyStore.keystore -storepass storePassword Keystore type: JKS Keystore provider: SUN Your keystore contains 0 entries 
like image 98
Miguel Bautista Avatar answered Oct 02 '22 05:10

Miguel Bautista