Java - generating a self-signed public key

less than 1 minute read

1
2
3
4
5
6
7
8
9
10
1. Generate self-signed public key
$JAVA_HOME/bin/keytool -genkey -alias test_alias --keyalg RSA -keystore test_key.jks
-keysize 2048 -dname "CN=Test, OU=PAV, O=PROS, L=HOU, ST=TX, C=US" -keypass test_password
-storepass test_password
2. Generate a certificate signature request with a self-signed public key
$JAVA_HOME/bin/keytool -certreq -alias certalias -file test_cert_req.csr -keystore test_key.jks
-storepass test_password
3. Importing a root certificate files
$JAVA_HOME/bin/keytool -import -v -trustcacerts -alias ExternalCARoot -file Test_CARoot.crt
-keystore test_key.jks -storepass test_password