Securing critical properties like passwords, tokens, and keys is an important aspect of developing a MuleSoft API. Fortunately, MuleSoft supports encryption/decryption of such properties, which can be handled pretty easily by performing the steps mentioned below.
Let’s say you have a mule project named Hello-Mule with critical properties like clientSecret and passwords, and these properties are saved in a property file named dev.properties:
Now in order to encrypt this easily, follow the steps below:
- In Anypoint Studio, go to Help > Install New Software:
- Enter the URL http://security-update-site-1.4.s3.amazonaws.com/ in Work With input box.
- Expand option Premium and check Mule studio properties file editor.
- Click on Next.
- Again, click on Next.
- Check I accept the terms of the license agreement and click Finish.
- A security warning pop-up will appear; click on Install Anyway.
- A pop-up to trust the Security Certificate might appear. Click on Ok and the installation will start.
- Once installation is complete, you need the restart the Anypoint Studio for the changes to appear.
That’s it! We are finished with the installation of Mule Studio Property Editor to encrypt and decrypt properties.
Once the Anypoint Studio is restarted, go to Project Explorer and Right Click on file dev.properties, then click on the Open With option.
The file will be opened through Mule Properties Editor. Now you can select each property to encrypt.
Click on Encrypt button. You will be asked to select an Algorithm and provide an Encryption Key. Once the details are provided, click on OK.
You can see the property has been encrypted. Now click on OK and Save the file to record the changes.
Great! We are now done with the encryption of a property through Mule Property Editor. In order to decrypt the encrypted property, you can perform the same steps again.
Important points to consider:
- Make sure you have noted down the Encryption Key somewhere.
- All the properties in a file must be encrypted with the same Algorithm and Key combination to avoid issues while configuring the Mule Secure Configuration for secured property files. You can read more about this here.
That’s it for this time. I hope this will be helpful. See you all with another interesting topic next time!