Java: 17
- Create keystore by executing this command:
keytool -genkeypair -alias demoTls1.3 -keyalg RSA -keysize 4096 \
-validity 3650 -dname "CN=localhost" -keypass changeit -keystore keystore.p12 \
-storeType PKCS12 -storepass changeit- Add these line on
application.properties:
# SSL protocol to use
server.ssl.protocol=TLS
# keystore format
server.ssl.key-store-type=PKCS12
# keystore location
server.ssl.key-store=keystore.p12
# keystore password
server.ssl.key-store-password=changeit
# Enabled SSL protocols
server.ssl.enabled-protocols=TLSv1.3- Create CA Cert from keystore
openssl pkcs12 -in keystore.p12 -out demoTls1point3.crt -nokeys
### Then input "changeit" as the password- Run the SpringBoot App (
./gradlew bootRun) - You'll see this line (
Tomcat started on port(s): 8080 (https)) that confirm it runs on TLS mode
2022-11-29T11:25:29.663+07:00 INFO 63998 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (https) with context path ''- Hit the api:
curl -v --cacert demoTls1point3.crt https://localhost:8080/actuator - You'll see this output that confirm it is using TLS 1.3
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384
* ALPN: server did not agree on a protocol. Uses default.
* Server certificate:
* subject: CN=localhost
* start date: Nov 29 04:33:05 2022 GMT
* expire date: Nov 26 04:33:05 2032 GMT
* common name: localhost (matched)
* issuer: CN=localhost
* SSL certificate verify ok.