Mule 4 – Password Encryption/Decryption (Secure Property Placeholder)

encryption picture

To protect sensitive information, you’ll need to configure the Security Configuration Module (Secure Properties Config). This module allows you to encrypt and decrypt confidential data such as passwords, Social Security Numbers (SSNs), credit card numbers, and more.

For this tutorial, we’ll use password tokenization as an example, leveraging Blowfish.js as the encryption algorithm and Anypoint Studio 7 as the development tool. At the end of the blog, we’ll also outline how to use other encryption algorithms.

Step 1: Encrypt & Decrypt a Password

🔒 Password Encryption

Use the Blowfish.js tool:
👉 http://sladex.org/blowfish.js/
Follow the steps shown in the screenshot to generate an encrypted password.

🔓 Password Decryption

Use the same tool to decrypt the password when needed.

Password EncryptionPassword DecryptionAvailable Algorithms

        Step 2: Secure Module Configuration in Mule 4 Domain Project

        1. Create a new Mule 4 domain project
        2. In src/main/resources, create a file named configuration.yaml with the following structure:
        http:
          host: "localhost"
          port: "9091"
        
        db:
          host: "localhost"
          port: "3306"
          user: "root"
          database: "industries_dy"
        
        secret:
          key: "secure@1234"
          password: "![viZBbApnipRKE6CJWGY7hA==]"  # ← Encrypted password from Blowfish.js
        1. Go to Global ElementsCreateGlobal ConfigurationsConfiguration Properties
          • Browse and select configuration.yaml
        2. Add the Secure Properties Config module:
          • Go to Manage ModulesAdd Modules
          • Search for “Secure Properties Config” and add it
        3. Create a Connector Configuration for Secure Properties:
          • Go to CreateConnector ConfigurationSecure Properties Config

        Step 3: Verify Password Decryption

        1. Add the Database Module:
          • Go to Manage ModulesAdd Modules
          • Search for “Database” and add it
        2. Create a Database Connector Configuration:
          • Go to CreateConnector ConfigurationDatabase Config
        3. In the password field, use the following expression:
        ${secure::domain.secret.password}

          Supported Encryption Algorithms

          Mule 4 supports various encryption algorithms, including:

          • Blowfish
          • RSA
          • DES
          • AES and Othere

          The steps to implement these algorithms are consistent across Mule 3 and Mule 4. The only difference is the repository location for the security module:

          Conclusion
          In this blog, we explored how to enable HTTPS and secure sensitive properties in Mule 4 using encrypted placeholders. By implementing secure property configurations, you can ensure a safer and more compliant Mule application environment.