Spring Download - Enabling and Configuring an SSL Certificate

I have these certificates / files to enable SSL for my application:

certificates

I found out that these properties are necessary for Spring Boot to enable HTTPS:

server.port=8089 server.ssl.enabled=true server.ssl.key-store=src/main/resources/keystore.p12 server.ssl.key-store-password=**** server.ssl.keyStoreType=PKCS12 server.ssl.keyAlias=tomcat 

but it does not work. Now my question will be what should I do to make it work? https://abc.lehr.co.at must be a URL.

[EDIT]

I created my own keystore - with this I get the following exception:

 java.io.IOException: Alias name tomcat does not identify a key entry at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:596) at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:534) at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:363) at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:739) at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:472) at org.apache.coyote.http11.Http11NioProtocol.start(Http11NioProtocol.java:81) at org.apache.catalina.connector.Connector.startInternal(Connector.java:986) 

My keystore looks like this:

Keystore

Actually I do not know what to import into the keystore for the built-in tomcat (Spring Boot).

+5
source share
3 answers

To enable SSL, you must provide a private key, not a trusted certificate.

The tomcat keystore should be specified as an alias for privatekeyentry , not trustedcertentry .

+2
source

You need to pack your private keys into a PFX or P12 file using aliases. Thus, it will be selected accordingly from the key repository after downloading materials.

Use this tool to find out what an alias is:

 keytool -list -storetype pkcs12 -keystore my_debug_keystore.p12 -storepass debug 
+2
source

I suggest you create your KeyStore in JKS format:

  keytool -genkey -keyalg RSA -alias my_alias -keystore keystore.jks -storepass password -validity 360 -keysize 2048 

then add the configuration:

 server.port=8089 server.ssl.enabled=true server.ssl.key-store=src/main/resources/keystore.jks server.ssl.key-store-password=**** server.ssl.keyStoreType=JKS server.ssl.keyAlias=my_alias 
0
source

Source: https://habr.com/ru/post/1276130/


All Articles