Intermittent error in decrypting property value in fabric
Issue
- We are using jasypt library to encrypt property values in fabric environment.
<reference id="fabricService" interface="io.fabric8.api.FabricService" availability="mandatory"/>
<cm:property-placeholder persistent-id="csp.test.1" depends-on="fabricService"/>
<cm:property-placeholder persistent-id="csp.test.2" placeholder-prefix="$DB{"/>
<enc:property-placeholder placeholder-prefix="{{" placeholder-suffix="}}" depends-on="fabricService">
<enc:encryptor class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="config">
<bean class="org.jasypt.encryption.pbe.config.SimplePBEConfig">
<property name="algorithm" value="$(encryption.algorithm)"/>
<property name="password" value="$(encryption.password)"/>
</bean>
</property>
</enc:encryptor>
</enc:property-placeholder>
- encryption.alogrithm is set to PBEWITHMD5ANDDES. But that is also encrypted as following in PID.
encryption.algorithm=${crypt:ieJazvB1UD+9t8KhM1BJ17Om5/8FCxm5mgHLkPzFRYI=}
- While removing or adding profiles or even while restarting container following error is observed. It is intermittent.
Caused by: org.jasypt.exceptions.EncryptionInitializationException: java.security.NoSuchAlgorithmException: crypt:ieJazvB1UD+9t8KhM1BJ17Om5/8FCxm5mgHLkPzFRYI= SecretKeyFactory not available
at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:735)[71:org.apache.servicemix.bundles.jasypt:1.9.3.redhat_3]
at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.initialize(StandardPBEStringEncryptor.java:553)[71:org.apache.servicemix.bundles.jasypt:1.9.3.redhat_3]
at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.decrypt(StandardPBEStringEncryptor.java:705)[71:org.apache.servicemix.bundles.jasypt:1.9.3.redhat_3]
at org.apache.karaf.jaas.jasypt.handler.EncryptablePropertyPlaceholder.getProperty(EncryptablePropertyPlaceholder.java:38)[4729:org.apache.karaf.jaas.jasypt:2.4.0.redhat-630416]
at org.apache.aries.blueprint.ext.AbstractPropertyPlaceholder.retrieveValue(AbstractPropertyPlaceholder.java:430)[17:org.apache.aries.blueprint.core:1.8.0]
at org.apache.aries.blueprint.ext.AbstractPropertyPlaceholder.processString(AbstractPropertyPlaceholder.java:443)[17:org.apache.aries.blueprint.core:1.8.0]
at org.apache.aries.blueprint.ext.AbstractPropertyPlaceholder$LateBindingValueMetadata.getStringValue(AbstractPropertyPlaceholder.java:477)[17:org.apache.aries.blueprint.core:1.8.0]
at org.apache.aries.blueprint.di.ValueRecipe.internalCreate(ValueRecipe.java:54)[17:org.apache.aries.blueprint.core:1.8.0]
... 31 more
Caused by: java.security.NoSuchAlgorithmException: crypt:ieJazvB1UD+9t8KhM1BJ17Om5/8FCxm5mgHLkPzFRYI= SecretKeyFactory not available
at javax.crypto.SecretKeyFactory.<init>(SecretKeyFactory.java:122)[:1.8.0_171]
at javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:160)[:1.8.0_171]
at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:722)[71:org.apache.servicemix.bundles.jasypt:1.9.3.redhat_3]
... 38 more
- If you not we have also used following but still we are receiving above error intermittently while deploying or adding/removing profiles.
<reference id="fabricService" interface="io.fabric8.api.FabricService" availability="mandatory"/>
<cm:property-placeholder id="properties" persistent-id="encrypted.properties" depends-on="fabricService"
Environment
- Red Hat Fuse
- 6.3
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.