Ecplise Configuring local HTTPS testing

Source: Internet
Author: User

To do the project today, you need to associate Office 365. In order to realize the real-time synchronization of Office365 user mail information and project, we need to establish Webhook subscription.

Office 365 API Connection Https://graph.microsoft.io/en-us/docs

Configure HTTPS bidirectional authentication with the Tomcat server

1. Generate a certificate for the server

Run the console, enter the%java_home%/bin directory, and enter the directory using the following command:

D:

CD "D:\Java\jdk1.7.0_67\bin"

Use Keytool to generate a certificate for Tomcat, assuming the target machine's domain name is "localhost", keystore file is stored in "D:\home\tomcat.keystore", password is "[email protected]"

Use the following command to generate:

Keytool-genkey-v-alias tomcat-keyalg rsa-keystore D:\home\tomcat.keystore-validity 36500

Brief description of the parameters:

The meaning of "D:\home\tomcat.keystore" is to save the path of the certificate file, and the certificate file name is Tomcat.keystore;

The meaning of "-validity 36500" is the certificate validity period, 36500 means 100 years, the default is 90 days "Tomcat" for the custom certificate name.

Fill in the necessary parameters at the command line:

The final tomcat master password is more important and is used in the Tomcat configuration file, and the recommended input is consistent with the KeyStore password.

2. Generate a certificate for the client

Generate a certificate for your browser so that the server can verify it. In order to successfully import the certificate into IE and Firefox, the certificate format should be PKCS12.

Use the following command to generate:

Keytool-genkey-v-alias mykey-keyalg rsa-storetype pkcs12-keystore D:\home\mykey.p12 (MyKey Custom).

The corresponding certificate inventory is placed in "D:\HOME\MYKEY.P12", and the client's CN can be any value. Double-click the Mykey.p12 file to import the certificate into the browser (client).

3. Let the server trust the client certificate

Because it is a two-way SSL authentication, the server must trust the client certificate, so the client certificate must be added as the server's trust authentication.

Because you cannot import a certificate library in the PKCS12 format directly, you must first export the client certificate as a separate CER file

Use the following command:

Keytool-export-alias mykey-keystore D:\home\mykey.p12-storetype pkcs12-storepass ${password}-rfc-file D:\home\mykey . cer

(MyKey is customized to the client-defined MyKey, ${password} is the password you set [email protected]).

With the above command, the client certificate is exported to the "D:\home\mykey.cer" file.

The next step is to import the file into the certificate Library of the server and add it as a trust certificate

Use the following command:

Keytool-import-v-file D:\home\mykey.cer-keystore D:\home\tomcat.keystore

With the list command to view the server's certificate library, you can see two certificates, one server certificate and one trusted client certificate:

Keytool-list-keystore D:\home\tomcat.keystore (Tomcat sets the server-side certificate name for you).

4. Let the client trust the server certificate

Because it is a two-way SSL authentication, the client also verifies the server certificate, so the server certificate must be added to the Browse Trusted root certification authorities.

Because you cannot import a certificate library in the KeyStore format directly, you must first export the server certificate as a separate CER file

Use the following command:

Keytool-keystore D:\home\tomcat.keystore-export-alias Tomcat-file D:\home\tomcat.cer (Tomcat sets the server-side certificate name for you).

With the above command, the server certificate is exported to the "D:\home\tomcat.cer" file. Double-click the Tomcat.cer file, follow the prompts to install the certificate, and fill in the certificate to Trusted root certification authorities.

5. Configuring the Tomcat Server

Open/conf/server.xml under the Tomcat root directory

Locate the connector port= "8443" configuration segment, which is commented by default, and the uncomment changes to the following configuration

<connector port= "8443" protocol= "Org.apache.coyote.http11.Http11NioProtocol" sslenabled= "true" maxthreads= "150" Scheme= "https"
Secure= "true" Clientauth= "true" sslprotocol= "TLS" keystorefile= "D:\\home\\tomcat.keystore" keystorepass= "[email Protected] "
Truststorefile= "D:\\home\\tomcat.keystore" truststorepass= "[email protected]"/>

Property Description:

ClientAuth: Set whether bidirectional authentication, default = False, set to True for bidirectional authentication

Keystorefile: Server certificate file path

Keystorepass: Server certificate Password

Truststorefile: The root certificate used to authenticate the client certificate, in this case the server certificate

Truststorepass: Root certificate Password

6. Configuring the Eclipse Service

  The general local test is to publish the project in Eclipse, when you need to remove the original Tomcat server and add a new service to select the Tomcat path that modified the profile. Once configured, restart Tomcat to access it.

Notice the changes in the ports section of the picture, with the SSL port more.

After publishing, enter the path in the browser to test.

Ecplise Configuring local HTTPS testing

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.