0

I am trying to add encryption in properties file, The content is not getting decrypt

My Spring DSL looks like:

<bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser">

    <property name="password" value="test"/>

    <property name="algorithm" value="PBEWithMD5AndDES"/>

</bean>
 <!-- define the camel properties component -->

<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">

    <!-- the properties file is in the classpath -->

    <property name="location" value="classpath:my-properties.properties"/>

    <!-- and let it leverage the jasypt parser -->

    <property name="propertiesParser" ref="jasypt"/>

</bean> 
<bean class="org.apache.activemq.ActiveMQConnectionFactory" id="jmsFactory">

        <property name="brokerURL" value="tcp://localhost:61616"/>

        <property name="userName" value="${jboss.fuse.username}"/>

        <property name="password" value="${jboss.fuse.password}"/>

</bean>

my-properties.properties

jboss.fuse.username=ENC(D0hnlLDZfGPiC6DtU+NKog==)

jboss.fuse.password=ENC(D0hnlLDZfGPiC6DtU+NKog==)

Error message : java.lang.SecurityException: User name [ENC(D0hnlLDZfGPiC6DtU+NKog==)] or password is invalid.

1 Answers1

0

PropertiesComponent doesn't work.It should be BridgePropertyPlaceholderConfigurer if you are using Spring DSL

<bean
        class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer" id="bridgePropertyPlaceholder">
        <property name="location" value="classpath:my-properties.properties"/>
        <property name="parser" ref="jasypt"/>
 </bean>