Open Udaykumar519 opened 7 months ago
do you now have any soluations?
In my case,i can decryptie xml config in some linux machine, while use the same jar, in other linux machine can not decryptie xml config. the xml config is a datasource config.The log prints invalid username/password; logon denied
@huangyfGG
I have written custom jasypt encryptor in my application, i have used this for decrypting
@Configuration public class JasyptEncryptorConfig { @Bean(name = "jasyptStringEncryptor") public static StringEncryptor customStringEncryptor(){ PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); SimpleStringPBEConfig config = new SimpleStringPBEConfig(); config.setPassword("your_encryption_key"); // encryptor's private key config.setAlgorithm("PBEWITHHMACSHA512ANDAES_256"); config.setKeyObtentionIterations("1000"); config.setPoolSize("1"); config.setProviderName(null); config.setProviderClassName(null); config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator"); config.setStringOutputType("base64"); encryptor.setConfig(config); return encryptor; } }
@ulisesbocchio I have two spring boot projects, one uses java based configuration and other uses XML based configuration.
We have a new requirement of encrypting properties present in application.properties file.
So, we have tried using jasypt-spring-boot-starter (v3.0.5) and jasypt-maven-plugin (v3.0.5) in both the projects for encryption/decryption.
Encryption is done using mvn plugin command mvn jasypt:encrypt "-Djasypt.encryptor.password=pvt-key" "-Djasypt.plugin.path=file:src/main/resources/application.properties"
Property file after encryption spring.db.password=ENC(encrypted-password)
Decryption For decrypting above property, we used @Value annotation provided by spring @Value("${spring.db.password}")
DECRYPTION is working as expected in project where java based configurations are used.
*But in XML based Configuration project, I am getting ENCRYPTED VALUES only, without any Decryption. [FYI, Even after adding and in respective XML file]
Spring boot versions used: For Java based Configuration Project: v2.4.0
For XML based Configuration Project: v2.1.4
Please help