Accessing (Jasypt) encrypted properties inside Camel Namspace'd elements

Solution Verified - Updated -

Issue

I have a blueprint camel route and I am trying to access encrypted password from a properties file inside their Camel components:

<cm:property-placeholder id="props" persistent-id="bluetest" update-strategy="reload" />

       <enc:property-placeholder>
               <enc:encryptor class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
                       <property name="config">
                               <bean class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
                                       <property name="algorithm" value="PBEWithMD5AndDES" />
                                       <property name="passwordEnvName" value="FUSE_ENCRYPTION_PASSWORD" />
                               </bean>
                       </property>
               </enc:encryptor>
       </enc:property-placeholder>

        <camel:sslContextParameters id="mySslContext">
            <camel:keyManagers keyPassword="{{keypass}\}">
                <camel:keyStore resource="serviceKeystore.jks" password="{{storepass}\}"/>
            </camel:keyManagers>
        </camel:sslContextParameters>

        <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="jetty:https://localhost:9000?sslContextParametersRef=#mySslContext"/>
            <log message="test"/>
        </route>
    </camelContext>

The value of “ keypass” and "storepass" were encrypted and with ENC(…) in the configuration file:

keypass=ENC(MKkuJDh3hwcSCd18jerTGg==)
storepass=ENC(k2oDCuqOZcDo+YDgUFtmUA==)

However, the property placeholder inside the element always returns encrypted value of "ENC(MKkuJDh3hwcSCd18jerTGg==)” rather than decrypted value. As a result, my camel-jetty consumer endpoint was always failed with error like:

19:05:42,352 | ERROR | l Console Thread | BlueprintCamelContext | 204 - org.apache.camel.camel-blueprint - 2.15.1.redhat-621084 | Error occurred during starting Camel: CamelContext(camel-1) due java.io.IOException: Keystore was tampered with, or password was incorrect

Environment

  • JBoss Fuse
    • 6.2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.