title: Unable to encrypt username/password from properties file using jasypt
body: <p>I am developing project using Spring3.1 and  hibernate4.</p>
  
  <p>Now I want to encrypt the sensitive data like username, password of database from properties file.</p>
  
  <p>Here are the steps which I followed : (ref <a href="http://www.jasypt.org/spring31.html" rel="nofollow">http://www.jasypt.org/spring31.html</a>)</p>
  
  <p>1.Configuring placeholder :</p>
  
  <pre><code>&lt;bean id="propertyConfigurer" class="org.jasypt.spring31.properties.EncryptablePropertyPlaceholderConfigurer"&gt;
      &lt;constructor-arg ref="configurationEncryptor" /&gt;
      &lt;property name="locations"&gt;
        &lt;list&gt;
            &lt;value&gt;/WEB-INF/classes/connection.properties&lt;/value&gt;
        &lt;/list&gt;
     &lt;/property&gt; 
     &lt;property name="ignoreUnresolvablePlaceholders" value="true"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>2.Configuration for encryptor</p>
  
  <pre><code>&lt;bean id="encryptorConfig" class="org.jasypt.encryption.pbe.config.SimplePBEConfig"&gt;
      &lt;property name="algorithm" value="PBEWithMD5AndDES" /&gt;
      &lt;property name="password" value="MASTERPASSWORD" /&gt;
   &lt;/bean&gt;
    &lt;bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"&gt;
      &lt;property name="config" ref="encryptorConfig" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>3.Database connection</p>
  
  <pre><code>&lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"  destroy-method="close"&gt; 
      &lt;property name="driverClassName" value="${data.driver}"/&gt;
      &lt;property name="url" value="${data.url}"/&gt;
      &lt;property name="username" value="${data.user}"/&gt;
      &lt;property name="password" value="${data.password}"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>4.Generated encrypted values using jasypt by command : </p>
  
  <pre><code>encrypt input="MY_DATABASE_PASSWORD" password="MASTERPASSWORD" algorithm="PBEWithMD5ANDDES"
  </code></pre>
  
  <p>5.connection.properties file contains</p>
  
  <pre><code>data.user=ENC(VO0A3aXAu71CCgzGFa+nJO/7M/0b5MF2)
  data.password=ENC(EogzgPllaXTDm7wq5kRp6uPmkWq6pmDV)
  </code></pre>
  
  <p>When I run application, I am still getting error as :</p>
  
  <pre><code>org.postgresql.util.PSQLException: FATAL: password authentication failed for user "ENC(VO0A3aXAu71CCgzGFa+nJO/7M/0b5MF2)"
  </code></pre>
  
  <p>These are the extra jars which I have included for integrating Spring application with jasypt:</p>
  
  <pre><code>commons-dbcp-1.1.jar
  
  commons-lang-2.1.jar
  
  commons-pool-1.2.jar
  
  icu4j-3.4.4.jar
  
  jasypt-1.9.0.jar
  
  jasypt-1.9.0-lite.jar
  
  jasypt-acegisecurity-1.9.0.jar
  
  jasypt-hibernate4-1.9.0.jar
  
  jasypt-spring3-1.9.0.jar
  
  jasypt-spring31-1.9.0.jar
  </code></pre>
  
  <p>Am I missed any thing or is there any jar compatibility issue ?</p>