jasypt

Jasypt not able to encrypt exponential power (^) symbol in password


I am trying to encrypt the following password my^Password using below:

.\encrypt.bat input=j!p^RVKvt3LaHw37 "password=<my_salt>" "algorithm=PBEWITHSHA256AND256BITAES-CBC-BC" providerClassName=org.bouncycastle.jce.provider.BouncyCastleProvider

When I decrypt the encrypted string, The exponent sign ^ is gone. I've also noticed this issue with some other symbols.

.\decrypt.bat 'input=<encrypted-string>' "password=<my_salt>" "algorithm=PBEWITHSHA256AND256BITAES-CBC-BC" providerClassName=org.bouncycastle.jce.provider.BouncyCastleProvider

Output: myPassword

Can anyone help fix this issue? I've scorched the internet but could not find any solution.


Solution

  • It turns out that windows powershell has a bug where it can’t properly encode a password with special characters. I performed the exact same commands on command prompt and it worked like a charm.