Spring Boot SSL using PKCS12 JKS and PEM format
2.5K
Git: 2.51+
Spring Boot: 3.5.7
Maven: 3.9+
Java: 25
Docker Desktop(Optional): Tested on 4.47.0
Required files are already in class path. If you want to generate your own self-signed then use below commands.
generate PKCS12 file
keytool -genkeypair -alias springbootssl -keyalg RSA -keysize 4096 -storetype PKCS12 -keystore springbootssl.p12 -validity 36500
generate JKS file from PKCS12
keytool -importkeystore -srckeystore springbootssl.p12 -srcstoretype pkcs12 -destkeystore springbootssl.jks -deststoretype jks
generate private key and certificate file
openssl req -x509 -subj "/CN=localhost" -keyout private.key -out certificate.crt -sha256 -days 36500 -nodes -newkey rsa
for windows OS
openssl req -x509 -subj "//CN=localhost" -keyout private.key -out certificate.crt -sha256 -days 36500 -nodes -newkey rsa
git clone https://github.com/deepaksorthiya/spring-boot-ssl-client-server.git
cd spring-boot-ssl-client-server
check file application.properties. this file contains PKCS12 and PEM based ssl config.
./mvnw clean package
./mvnw spring-boot:run
./mvnw clean spring-boot:build-image -DskipTests
OR
docker build -t deepaksorthiya/spring-boot-ssl-client-server:0.0.1-SNAPSHOT .
docker run --name spring-boot-ssl-client-server -p 8080:8080 deepaksorthiya/spring-boot-ssl-client-server:0.0.1-SNAPSHOT
curl -v -k https://localhost:8443/server-call
curl -v -k https://localhost:8443/client-call
For further reference, please consider the following sections:
The following guides illustrate how to use some features concretely:
Due to Maven's design, elements are inherited from the parent POM to the project POM.
While most of the inheritance is fine, it also inherits unwanted elements like <license> and <developers> from the
parent.
To prevent this, the project POM contains empty overrides for these elements.
If you manually switch to a different parent and actually want the inheritance, you need to remove those overrides.
Content type
Image
Digest
sha256:27700c511…
Size
34.6 MB
Last updated
10 months ago
docker pull deepaksorthiya/spring-boot-ssl-client-server