I am trying to decrypt password with jasypt, where password is passed as a VM argument. xml file which is using this looks like -
<bean id="strongEncryptor"
class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="config">
<bean class="org.jasypt.encryption.pbe.config.SimpleStringPBEConfig"
p:algorithm="PBEWithMD5AndDES" p:password="#{systemProperties['jasypt.encryptor.password']}"
p:providerClassName="org.bouncycastle.jce.provider.BouncyCastleProvider"/>
</property>
</bean>
<bean id="propertyConfigurer" p:ignoreResourceNotFound="true" p:nullValue="{null}"
class="org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg ref="strongEncryptor" />
<property name="locations">
<list>
<value>file:#{systemProperties['appconfig.dir']}/farms/local-testing/application.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true"></property>
</bean>
Here if I don't write <property name="ignoreUnresolvablePlaceholders" value="true">
then I get errors like various properties not defined however those are defined in base\application.properties
.
VM arguments are provided as
-Dspring.config.location=appconfig/base/,appconfig/farms/local-testing/ -Dappconfig.dir=/opt/apps/globalpayments/svx/appconfig -Djasypt.encryptor.password=randompassword
Not able to understand whats happening here.
Also one important thing here is if I don't provide VM arguments then it should ignore this and provide encrypted value as string instead of decrypted value.
Any pointers would be helpful.
Thanks in advance.