Tuesday, January 31, 2012

Create your own keystore trust

password="welcome1"

keytool -genkey -validity 10000 -alias acme -keyalg RSA -keysize 1024 -dname "CN=acme, OU=Engineering, O=YourCompany, L=YourCity, ST=YourRegion, C=YourCountryCode" -keypass acmepw -keystore identity-acme.jks -storepass $password


# Self Sign the certificate

echo $passWord | keytool -selfcert -validity 10000 -v -alias acme -keypass $passWord -keystore identity-acme.jks -storetype jks

# Export the root certificate

echo $passWord | keytool -export -v -alias acme -file identity-acme.der -keystore identity-acme.jks

# Import the root certificate back with the same name as in step 1 and step 2

keytool -import -v -alias acme -trustcacerts -file identity-acme.der -keystore acme-trust.jks

No comments: