Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure SSL / HTTPS on Spring?

I'm working on a Spring Java app that requires HTTPS, and I followed Spring's guide to configure SSL.

My application.properties file contains the following:

server.port = 8443
server.ssl.key-store = classpath:keystore.p12
server.ssl.key-store-password = password
server.ssl.key-password = password
server.ssl.keyStoreType = JCEKS
server.ssl.keyAlias = alias

When the app is run, the console outputs Tomcat started on port(s): 8443 (https), but any request to the server results in a 0 NO RESPONSE status.

What am I missing?

like image 612
David Castillo Avatar asked May 21 '15 15:05

David Castillo


People also ask

How do I specify local file path to my SSL keystore file in spring application properties?

You need to use file:// . FileNotFoundException: C:\Windows\Temp\tomcat. 8707914234839952642.1111\file:\c:\path\to\file\keystore.

How set SSL certificate in Java?

The steps to install a new certificate into the Java default truststore are: extract cert from server: openssl s_client -connect server:443. import certificate into truststore using keytool: keytool -import -alias alias.server.com -keystore $JAVA_HOME/jre/lib/security/cacerts.


1 Answers

Problem seems to be the specified encryption algorithm. I was generating the key using keytool, with -keyalg AES. Changed it to use RSA with -keyalg RSA and it works now.

like image 137
David Castillo Avatar answered Sep 30 '22 21:09

David Castillo