Author : Girish Mallula
In real world all property values should be externalized. One of the way you can achieve that is by using external properties. But there is a catch this property files contains database or 3rd party application password or critical information.

Jasypt is a java library which allows the developer to add basic encryption capabilities to their projects with minimum effort, and without the need of having deep knowledge on how cryptography works.
- High-security, standards-based encryption techniques, both for unidirectional and bidirectional encryption. Encrypt passwords, texts, numbers, binaries…
- Transparent integration with Hibernate.
- Suitable for integration into Spring-based applications and also transparently integrable with Spring Security.
- Integrated capabilities for encrypting the configuration of applications (i.e. datasources).
- Specific features for high-performance encryption in multi-processor/multi-core systems.
- Open API for use with any JCE provider.
- Includes a lightweight (“lite”) version of the library for better manageability in size-restrictive environments like mobile platforms.
If you are using Maven, you need to add the following dependency to your pom.xml for this component:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jasypt</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
Let’s take simple example route,
Get encrypted value in route and print in logs.

1. Encrypt value using
java -jar camel-jasypt-2.5.0.jar -c encrypt -p <jasypt key phase> -i ‘Talend_is_Easy’
2. Add property file to PropertiesComponent.
PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
pc.setLocation("classpath:propertyholder.properties");
3. Create propertyholder.properties file in resources.
encrpt.test=ENC(UZqAvr9H+muX9Srb4nm4kpUy4cVE2Op6)
4. Add propertyholder.properties in dependencies to route.

5. Add Jasypt properties to Properties component.
JasyptPropertiesParser jasypt = new JasyptPropertiesParser();
jasypt.setPassword(<jasypt key phase>);
pc.setPropertiesParser(jasypt);
6. Add camel-jasypt-alldep-2.23.1jar in cConfig.

Set property in body.

HOORAY !! “Talend_Is_Easy”

Happy learning!!