Jasypt CLI tools for encryption and decryption

Jasypt CLI tools for encryption and decryption


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



Steps

  • Check the path to the default $JAVA_HOME
 $ echo $JAVA_HOME
 C:Usersyour.username.jdkscorretto-17.0.12
Enter fullscreen mode

Exit fullscreen mode

 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'
Enter fullscreen mode

Exit fullscreen mode

  • 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==
Enter fullscreen mode

Exit fullscreen mode

$ 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
Enter fullscreen mode

Exit fullscreen mode



Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.