Search code examples
spring-bootsslkeytool

How to configure Spring Boot 2 WebFlux to use SSL?


All I get is javax.net.ssl.SSLHandshakeException: no cipher suites in common.

This is how to reproduce the behavior:

  • go to http://start.spring.io and add "Reactive Web" as dependency for Spring 2.0.1
  • unpack the archive
  • run keytool -genkeypair -keystore demo/src/main/resources/keystore.jks
    • Choose a password
    • Hit return as long as [Unknown] is the default, enter Yes when asked if CN=Unknown, OU=Unknown, ... is correct.
    • Use the same password for the key as for the keystore
  • add the following to application.properties

    server.ssl.key-store=classpath:keystore.jks
    server.ssl.key-store-password=<my-secure-pwd>
    
  • build and run the application

  • run curl https://localhost:8080

This is my first time adding SSL to a Spring Boot application and I think that something must be wrong - but I've no idea what. Maybe anyone of you could provide some help? Thanks!


Solution

  • Ok, turns out that you need to set the key algorithm to RSA in order to make this work.

    keytool -genkeypair -keyalg RSA -keystore src/main/resources/keystore.jks