dev-resources.site
for different kinds of informations.
Jasypt CLI tools for encryption and decryption
Published at
8/9/2024
Categories
encryption
secrets
cipher
Author
mhjaafar
Author
8 person written this
mhjaafar
open
Recently I have started to use the Jasypt CLI tools. Before that, I have always had to use the tedious way with the Maven plugin just to do a simple encryption and decryption for any deployment update. This article is meant to complement the guides from the page Jasypt: Java simplified encryption.
Table of contents
Requirements
- Java JRE
- Terminal, in this example is the Git Bash on Windows.
- Downloading the distribution zip file of Jasypt - from the link in the file README in the Jasypt's GitHub repo.
Steps
- Check the path to the default $JAVA_HOME
$ echo $JAVA_HOME
C:\Users\your.username\.jdks\corretto-17.0.12
- Edit your aliases.sh for Git Bash. See this article on how to add permanent aliases in Git Bash.
jasypt_algorithm=PBEWithMD5AndDES
jasypt_path={path-to-your-unzipped-jasypt}/jasypt-1.9.3/bin
jasypt_password={your choice of master password}
alias encrypt-jasypt='$jasypt_path/encrypt.sh password=$jasypt_password algorithm=$jasypt_algorithm'
alias encrypt-jasypt='$jasypt_path/decrypt.sh password=$jasypt_password algorithm=$jasypt_algorithm'
- Start a new session of Git Bash
- Test the encryption
$ encrypt-jasypt input="foo.b4r"
----ENVIRONMENT-----------------
Runtime: Amazon.com Inc. OpenJDK 64-Bit Server VM 17.0.12+7-LTS
----ARGUMENTS-------------------
input: foo.b4r
password: *****
algorithm: PBEWithMD5AndDES
----OUTPUT----------------------
pJ3SUb+U4Xh98+uF0f2uYA==
- Test the decryption
$ decrypt-jasypt input="pJ3SUb+U4Xh98+uF0f2uYA=="
----ENVIRONMENT-----------------
Runtime: Amazon.com Inc. OpenJDK 64-Bit Server VM 17.0.12+7-LTS
----ARGUMENTS-------------------
input: pJ3SUb+U4Xh98+uF0f2uYA==
password: ****
algorithm: PBEWithMD5AndDES
----OUTPUT----------------------
foo.b4r
cipher Article's
11 articles in total
Encryption Symmetric
read article
Jasypt CLI tools for encryption and decryption
currently reading
Confusion vs Diffusion in cryptography
read article
Monoalphabetic and Polyalphabetic Ciphers in Cryptography
read article
Crack the Code Like Caesar: Build Your Own Secret Message Encrypter! [Python code included]
read article
Caesar Cipher In Ruby
read article
Why anti-encryption laws are crazy
read article
Why is Exclusive Or (XOR) Important in Cryptography?
read article
plain_sight
read article
Can you translate it back?
read article
Dual Encryption
read article
Featured ones: