Using Java Keystore (JKS)

It is not recommended using this type of certificate because it is a proprietary format and it’s better to use a PKCS12 format. In any case 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 a the password for the keystore
2The file that will be created
3The PKCS12 file created before 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 is running on [https://localhost:8443](https://localhost:8443) using the certificate in the keystore.