Setting up HTTPS for Spring Boot is very easy, all you need to do is performing the following operations:
- Generate a key-pair using the RSA algorithm;
- Generate an X.509 certificate using the keys from the previous step;
- Import the certificate inside the JRE archive for certificates;
- Set up Spring Boot to enable HTTPS.
To perform the previous operations I’ll use these technologies and tools:
- Java JDK 8 (1.8.0_72)
- Spring Boot 1.5.3.RELEASE
The last tool is provided together with the JDK, so if you have the JDK installed you have
keytoolalready available. To check it, try running the command
keytool --versionfrom your Terminal prompt. Note that if you are on Windows, you might need to launch it from the \bin folder. For more information about it, you can read the official documentation.