Using Java Keystore (JKS)

Using this type of certificate is not recommended because the format is proprietary - PKCS12 format is preferred. Regardless, Micronaut also supports it.

Convert the p12 certificate to a JKS one:

  1. $ keytool -importkeystore \
  2. -deststorepass newPassword -destkeypass newPassword \ (1)
  3. -destkeystore server.keystore \ (2)
  4. -srckeystore server.p12 -srcstoretype PKCS12 -srcstorepass mypassword \ (3)
  5. -alias someAlias (4)
1It is necessary to define the password for the keystore
2The file to create
3The PKCS12 file created previously, and the password defined during the creation
4The alias used before
If either srcstorepass or alias are not the same as defined in the p12 file, the conversion will fail.

Now modify your configuration:

HTTPS Configuration Example

  1. micronaut:
  2. ssl:
  3. enabled: true
  4. keyStore:
  5. path: classpath:server.keystore
  6. password: newPassword
  7. type: JKS

Start Micronaut, and the application will run on [https://localhost:8443](https://localhost:8443) using the certificate in the keystore.