One: The build command is as follows (this step generates a temporary don't know what to do with)
12345678 -204836512345678
Press ENTER after Keytool will ask you to fill in a lot of information, such as company name, region, country, etc., fill in the PWD directory will generate tomcat.keystore files;
Second: Explain the above command parameters
-genkey means using Keytool to generate key;
-alias Tomcat (alias)
-keypass 12345678 (alias password, this seems to be the password for the query)
-keyalg RSA (algorithm)
-keysize 2048 (key length)
-validity 365 (validity, days units)
-keystore./tomcat.keystore (Specify the location and certificate name of the generated certificate)
-storepass 87654321 (Get the KeyStore info password, this is the real password)
Three: For the client (browser, etc.) to generate certificates (alias is very important, that is, client, this to and springboot configuration corresponding otherwise error, if not know what aliases can be through Keytool-list-keystore CLIENT.P12 Enter the-storepass password and then you can see what the alias is.
12345678 2048 365 12345678
-genkey means using Keytool to generate key;
-alias Client (alias)
-keypass 12345678 (alias password, temporarily not found what use)
-keyalg RSA (algorithm)
-keysize 2048 (key length)
-validity 365 (validity, days units)
-keystore./client.keystore (Specify the location and certificate name of the generated certificate)
-storepass 87654321 (Get the KeyStore info password, this is the real password)
The following things to fill out the same as the first step;
IV: Import the certificate generated by the third step into the resources directory of Springboot (and application.properties-lateral)
Import the CLIENT.P12 into the resources directory of the Springboot project and configure it in Application.properties:
server.ssl.key-store=classpath:client.p12server.ssl.key-store-password=87654321 Server.ssl.key-store-type=PKCS12server.ssl.key-alias=client
At this point, the access via http://xxx will prompt
Bad requestthis combination of host and port requires TLS.
The Springboot is configured for simple testing, and the real system configures the certificate on Nginx.
Generate an SSL certificate with the Keytool from the JDK and import it into the Springboot