mule - jasypt property placeholder not working -


i have properties file:

secret.key = enc(foobar) region = abc 

then in config.xml:

<spring:beans>      <encryption:encryptor-config id="econf" password-sys-property-name="mule_encryption_password" algorithm="pbewithmd5anddes" password="" />     <encryption:string-encryptor id="stringenc" config-bean="econf" />     <encryption:encryptable-property-placeholder encryptor="stringenc" location="${env}.properties" />  </spring:beans> 

but property placeholders don't work, example:

<sqs:config secretkey="${secret.key}" region="${region}"></sqs-config> 

does know why?

encrypted password needs write within enc() function , should encrypted.

let's consider in properties file password value login@123... encrypted value in properties file :-

password=enc(b0u7d8wlwq/ugin31knpp78gbclp7vin)  

step1 :- can generate key using following commands in command prompt of \jasypt-1.9.2\bin directory :- encrypt input="login@123" password=sqlpassword algorithm=pbewithmd5anddes

step2 :- in runtime environment need give (right click->run as->run configuration->environment) :- variable :- mule_encryption_password , value:-sqlpassword

in mule config, need configure following :-

 <spring:beans>         <spring:bean id="environmentvariablesconfiguration" class="org.jasypt.encryption.pbe.config.environmentstringpbeconfig">             <spring:property name="algorithm" value="pbewithmd5anddes"/>             <spring:property name="passwordenvname" value="mule_encryption_password"/>         </spring:bean>          <!-- encryptor used decrypting configuration values. -->         <spring:bean id="configurationencryptor" class="org.jasypt.encryption.pbe.standardpbestringencryptor">             <spring:property name="config" ref="environmentvariablesconfiguration"/>         </spring:bean>          <!-- encryptablepropertyplaceholderconfigurer read -->         <!-- .properties files , make values accessible ${var} -->         <!-- our "configurationencryptor" bean (which implements -->         <!-- org.jasypt.encryption.stringencryptor) set constructor arg. -->          <spring:bean id="propertyconfigurer" class="org.jasypt.spring.properties.encryptablepropertyplaceholderconfigurer">             <spring:constructor-arg ref="configurationencryptor"/>             <spring:property name="locations">                 <spring:list>                     <spring:value>conf/yourpropertyfile.properties</spring:value>                 </spring:list>             </spring:property>         </spring:bean> 

then can use encrypted values :- ${password}

reference :- http://blogs.mulesoft.org/encrypting-passwords-in-mule/
, http://pragmaticintegrator.wordpress.com/2014/03/09/using-encrypted-passwords-with-mule-esb/
, https://code.google.com/p/soi-toolkit/issues/detail?id=183
, http://soi-toolkit.googlecode.com/svn-history/r2022/wiki/ug_propertyfile.wiki


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -