ulisesbocchio / jasypt-spring-boot

Jasypt integration for Spring boot
MIT License
2.91k stars 522 forks source link

Decrypted property is showing with funny characters. #123

Closed yerko76 closed 5 years ago

yerko76 commented 5 years ago

Hi, when my app resolves encrypted property those properties are showing funny characters and I'm no able to provide the right credentials

My property is = �U�|�aװ�ı����QY��F0ldo

compile'com.github.ulisesbocchio:jasypt-spring-boot-starter:2.1.1' 'org.springframework.boot' version '2.1.3.RELEASE'

hello: ENC(JKISZ6XdI94/+ztspLLRgIc+hXjiZTlQ/VuzBR3jYbqmMRE6IGeYUw==)

jasypt: encryptor: password: some test

diegofernandezaceves commented 5 years ago

Hi there,

I'm migrating from Spring Boot 1 to Spring Boot 2. When the property is decrypted in Spring Boot 1 works. But now I don't know what happens, in Spring boot 2 when the app gets the property from database and decrypt it, the value is �d�x��X�W����

Could you help me?

Thanks

bedla commented 5 years ago

It seems that Jasypt CLI default ivGeneratorClassname is null (and cannot be recofigured), result of this is that instead of null generator org.jasypt.salt.RandomIVGenerator is created (not Noop IV generator as Jasypt-boot expects), compare boot-jasypt implementation with jasypt implementation.

I have solved this by setting jasypt.encryptor.ivGeneratorClassname property to org.jasypt.salt.RandomIVGenerator to be compliant with Jasypt CLI implementation and allow Ops to generate their password using CLI.

Note: Basically it means that CLI generated bytes contains salt+iv+encrypted_value but configured decryption logic contains salt+encrypted_value (without iv)

ulisesbocchio commented 5 years ago

IV generator was rolled back to original Jasypt, this should be fixed in next release