Generate an SSL certificate with the Keytool from the JDK and import it into the Springboot

Source: Internet
Author: User
Tags ssl certificate

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.