Apisero is now part of NTT DATA - Learn more.

Close this search box.

Enabling HTTPS for Mule Applications

Author: Nikhil Kunkulol

Enabling HTTPS for Mule applications is quite a complex process which requires understanding of below concepts whenever you want to work with https configuration in Mule applications.

  1. TLS with Keystores and Truststores.
  2. What are Keystores and Truststores?
  3. How to generate a Keystore and self signed certificate?
  4. How to configure TLS in Mule 4?

Lets elaborate more on above key concepts.

  1. TLS with Keystores and Truststores – TLS is a cryptographic protocol that provides communications security for your Mule app. TLS offers many different ways of exchanging keys for authentication, encrypting data, and guaranteeing message integrity.
  2. What are Keystores and Truststores – 

Keystore – A Java keystore stores private key entries, certificates with public keys or just secret keys that we may use for various cryptographic purposes.Generally speaking, keystores hold keys that our application owns that we can use to prove the integrity of a message and the authenticity of the sender.Usually, we’ll use a keystore when we are a server and want to use HTTPS. 

Truststore – A truststore is the opposite – while a keystore typically holds onto certificates that identify us, a truststore holds onto certificates that identify others. If you do not specify a truststore then the default values of the JVM are used, which usually include a truststore with certificates for all the major certifying authorities.

3) How to generate a Keystore and a self signed certificate?

The standard JDK distribution does not include a keystore by default, use keytool to generate your keystores and certificates. The keystore you generate contains a private key and a public certificate. This certificate is self-signed so it is not to be trusted by clients unless you share the public certificate with them.

Here is the keytool command to create a self-signed cert:

keytool -genkeypair -keystore keystore.jks   -dname “CN=localhost, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown”  -keypass password  -storepass password  -keyalg RSA  -sigalg SHA1withRSA -keysize 1024  -alias mule  -ext SAN=DNS:localhost,IP: -validity 9999

The result keystore.jks file is your certificate.

4) How to configure TLS in Mule 4?

  1. Put keystore.jks file under src/main/resources directory of mule project
  2. Configuring HTTPS Listener

where ${https.port} is 443 used for HTTPS communication.

  1. Configuring TLS for HTTPS Listener
  1. Testing HTTPS enabled Mule applications using Postman
  2. Go to Postman -> Settings -> Certificates and turn ON CA certificates tab which default is set to OFF


We saw in this blog that we can enable HTTPS which confirms a more secure version for your Mule applications. I hope you were able to learn something new from this blog!

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.