Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up SSL (TLS) / HTTPS on Spring Boot using AES-256?

I set up SSL on my Spring Boot server using RSA (How to configure SSL / HTTPS on Spring?) by following their guide:

  • Created a new keystore and key using keytool -genkey -alias <alias> -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650
  • Placed these lines in my application.properties file:

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

Works like a charm. But when I generate an AES 256 key by running keytool -genseckey -keystore keystore.jck -storetype JCEKS -storepass <store pass> -keyalg AES -keysize 256 -alias <alias> -keypass <key pass>, and change the .properties file to the new keystore / key values, every request to the server results in 0 EMPTY RESPONSE. What steps should I follow to configure it successfully?

like image 971
David Castillo Avatar asked May 22 '15 19:05

David Castillo


People also ask

How do I change http to https in spring boot?

Redirect HTTP requests to HTTPS To do that in spring boot, we need to add HTTP connector at 8080 port and then we need to set redirect port 8443 . So that any request in 8080 through http, it would be automatically redirected to 8443 and https.


2 Answers

Got it. Solved it. Key algorithms have little to do with the cipher you want to use (AES 256, in my case). Got it to work with a regular RSA, PKCS12 key.

Then, set the next properties in application.properties:

server.ssl.ciphers=ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA
server.ssl.protocol=TLS
like image 161
David Castillo Avatar answered Oct 07 '22 05:10

David Castillo


I had the same issue. Changing JDK 1.6 to 1.8 worked.

like image 1
lekant Avatar answered Oct 07 '22 05:10

lekant