If you are using a Java client and using OSGi configuration parameters, then follow these steps.
To use jasypt with spring components:
<dependency> <groupId>org.apache.servicemix.bundles</groupId> <artifactId>org.apache.servicemix.bundles.jasypt</artifactId> <version>1.9.2_1</version> </dependency> <dependency> <groupId>org.apache.servicemix.bundles</groupId> <artifactId>org.apache.servicemix.bundles.jasypt-spring31</artifactId> <version>1.9.2_1</version> </dependency>
<osgix:cm-properties id="properties" persistent-id="my"> <prop key="mydb.password">ENC(fAdXf/ed2k+2uD1LhoOpvw==)</prop> </osgix:cm-properties>
<bean id="environmentVariablesConfiguration" class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig"> <property name="algorithm" value="PBEWITHSHA256AND128BITAES-CBC-BC"/> <property name="password" value="TESB_ENV_PASSWORD"/> </bean>
<bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"> <property name="config" ref="environmentVariablesConfiguration"/> </bean>
<bean id="propertyConfigurer" class="org.jasypt.spring31.properties.EncryptablePropertyPlaceholderCon figurer"> <constructor-arg ref="configurationEncryptor"/> <property name="properties" ref="properties"/> </bean>
<bean id="serviceBean" class="org.company.example.MyServiceImpl"> <property name="prop" value="${mydb.password}"/> </bean>
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!