Jasypt: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| (4 intermediate revisions by the same user not shown) | |||
| Line 11: | Line 11: | ||
{| | {| | ||
| valign="top" | | | valign="top" | | ||
< | <syntaxhighlight lang="xml"> | ||
<dependency> | <dependency> | ||
<groupId>org.jasypt</groupId> | <groupId>org.jasypt</groupId> | ||
| Line 17: | Line 17: | ||
<version>1.9.3</version> | <version>1.9.3</version> | ||
</dependency> | </dependency> | ||
</ | </syntaxhighlight> | ||
| valign="top" | | | valign="top" | | ||
< | <syntaxhighlight lang="xml"> | ||
<dependency> | <dependency> | ||
<groupId>com.github.ulisesbocchio</groupId> | <groupId>com.github.ulisesbocchio</groupId> | ||
| Line 26: | Line 26: | ||
<version>3.0.3</version> | <version>3.0.3</version> | ||
</dependency> | </dependency> | ||
</ | </syntaxhighlight> | ||
|} | |} | ||
==Encryption== | ==Encryption== | ||
===Jasypt=== | ===Jasypt=== | ||
< | <syntaxhighlight lang="bash" highlight="4-6"> | ||
wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar | wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar | ||
java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \ | java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \ | ||
| Line 38: | Line 38: | ||
password=secret_password \ | password=secret_password \ | ||
input=sadaqah! | input=sadaqah! | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="bash" highlight="4-6"> | ||
wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar | wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar | ||
java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI \ | java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI \ | ||
| Line 47: | Line 47: | ||
password=secret_password \ | password=secret_password \ | ||
input=D5pJ1JQ+v+I+AYS7BARBnOcKQudi2r1g4qgobdOjT8dogcldMvRPPLAVQx3zddS/ | input=D5pJ1JQ+v+I+AYS7BARBnOcKQudi2r1g4qgobdOjT8dogcldMvRPPLAVQx3zddS/ | ||
</ | </syntaxhighlight> | ||
---- | ---- | ||
< | <syntaxhighlight lang="bash" highlight="4-6"> | ||
wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar | wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar | ||
java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \ | java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \ | ||
| Line 56: | Line 56: | ||
password=secret_password \ | password=secret_password \ | ||
input=sadaqah! | input=sadaqah! | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="bash" highlight="4-6"> | ||
wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar | wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar | ||
java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI \ | java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI \ | ||
| Line 65: | Line 65: | ||
password=secret_password \ | password=secret_password \ | ||
input=lC6Z9mpaX8iIS9/SEKIQzuEMbxd58pBWBksuARklDHXyspf3Hg1AqyyMWEd9StMa | input=lC6Z9mpaX8iIS9/SEKIQzuEMbxd58pBWBksuARklDHXyspf3Hg1AqyyMWEd9StMa | ||
</ | </syntaxhighlight> | ||
===Apache Camel Jasypt=== | ===Apache Camel Jasypt=== | ||
< | <syntaxhighlight lang="bash" highlight="4,5"> | ||
wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\ | wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\ | ||
tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\ | tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\ | ||
| Line 74: | Line 74: | ||
-c encrypt -p secret_password \ | -c encrypt -p secret_password \ | ||
-i sadaqah! | -i sadaqah! | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="bash" highlight="4,5"> | ||
wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\ | wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\ | ||
tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\ | tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\ | ||
| Line 82: | Line 82: | ||
-c decrypt -p secret_password \ | -c decrypt -p secret_password \ | ||
-i BVT6gDNautctO6xPvKrHgU3EAlsbDbnU | -i BVT6gDNautctO6xPvKrHgU3EAlsbDbnU | ||
</ | </syntaxhighlight> | ||
---- | ---- | ||
< | <syntaxhighlight lang="bash" highlight="4-6"> | ||
wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\ | wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\ | ||
tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\ | tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\ | ||
| Line 91: | Line 91: | ||
-p secret_password \ | -p secret_password \ | ||
-i sadaqah! | -i sadaqah! | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="bash" highlight="4-6"> | ||
wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\ | wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\ | ||
tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\ | tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\ | ||
| Line 100: | Line 100: | ||
-p secret_password \ | -p secret_password \ | ||
-i YCYR4yln0xh8E5a1XA+GR+ZtLiLsAx41 | -i YCYR4yln0xh8E5a1XA+GR+ZtLiLsAx41 | ||
</ | </syntaxhighlight> | ||
==Playground== | ==Playground== | ||
| Line 117: | Line 117: | ||
|- | |- | ||
| valign="top" colspan="2" | | | valign="top" colspan="2" | | ||
< | <syntaxhighlight lang="bash"> | ||
wget -cq https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar\ | wget -cq https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar\ | ||
-P ~/Documents/jasypt-playground/ | -P ~/Documents/jasypt-playground/ | ||
</ | </syntaxhighlight> | ||
|- | |- | ||
| Line 127: | Line 127: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
< | <syntaxhighlight lang="bash"> | ||
alias jasypt_encrypt="$(cat <<EOF | alias jasypt_encrypt="$(cat <<EOF | ||
java -cp ${HOME}/Documents/jasypt-playground/jasypt-1.9.3.jar \ | java -cp ${HOME}/Documents/jasypt-playground/jasypt-1.9.3.jar \ | ||
org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \ | org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \ | ||
ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator \ | ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator \ | ||
algorithm=PBEWITHHMACSHA512ANDAES_256 | algorithm=PBEWITHHMACSHA512ANDAES_256 \ | ||
verbose=false | |||
EOF | EOF | ||
)" | )" | ||
</ | </syntaxhighlight> | ||
| valign="top" | | | valign="top" | | ||
< | <syntaxhighlight lang="bash"> | ||
alias jasypt_decrypt="$(cat <<EOF | alias jasypt_decrypt="$(cat <<EOF | ||
java -cp ${HOME}/Documents/jasypt-playground/jasypt-1.9.3.jar \ | java -cp ${HOME}/Documents/jasypt-playground/jasypt-1.9.3.jar \ | ||
org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI \ | org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI \ | ||
ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator \ | ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator \ | ||
algorithm=PBEWITHHMACSHA512ANDAES_256 | algorithm=PBEWITHHMACSHA512ANDAES_256 \ | ||
verbose=false | |||
EOF | EOF | ||
)" | )" | ||
</ | </syntaxhighlight> | ||
|- | |- | ||
| Line 153: | Line 155: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
< | <syntaxhighlight lang="bash"> | ||
jasypt_encrypt password=secret_password\ | jasypt_encrypt password=secret_password\ | ||
input=sadaqah! | input=sadaqah! | ||
</ | </syntaxhighlight> | ||
| valign="top" | | | valign="top" | | ||
< | <syntaxhighlight lang="bash"> | ||
jasypt_decrypt password=secret_password\ | jasypt_decrypt password=secret_password\ | ||
input=3afnDdXwer1GW5EjO/SH9/oYIKgBOHO6NapsiuD+l8Wm/zOey20Dis5evl86A5AM | input=3afnDdXwer1GW5EjO/SH9/oYIKgBOHO6NapsiuD+l8Wm/zOey20Dis5evl86A5AM | ||
</ | </syntaxhighlight> | ||
|- | |- | ||
| Line 168: | Line 170: | ||
---- | ---- | ||
|- | |- | ||
| valign="top" | | valign="top" | | ||
< | <syntaxhighlight lang="bash"> | ||
echo "ENC($(jasypt_encrypt password='secret_password' input='sadaqah!'))" | |||
</syntaxhighlight> | |||
| valign="top" | | |||
<syntaxhighlight lang="bash"> | |||
rm -rf ~/Documents/jasypt-playground/jasypt-* | rm -rf ~/Documents/jasypt-playground/jasypt-* | ||
</ | </syntaxhighlight> | ||
|} | |} | ||
| Line 191: | Line 198: | ||
| valign="top" | | | valign="top" | | ||
* [https://medium.com/@javatechie/spring-boot-password-encryption-using-jasypt-e92eed7343ab Spring Boot Password Encryption using Jasypt] | * [https://medium.com/@javatechie/spring-boot-password-encryption-using-jasypt-e92eed7343ab Spring Boot Password Encryption using Jasypt] | ||
* [https://github.com/jasypt/jasypt/blob/jasypt-1.9.3/jasypt/src/main/java/org/jasypt/intf/cli/JasyptPBEStringDecryptionCLI.java Jasypt » <code>JasyptPBEStringDecryptionCLI</code>] | |||
* [https://github.com/jasypt/jasypt/blob/jasypt-1.9.3/jasypt/src/main/java/org/jasypt/intf/cli/JasyptPBEStringEncryptionCLI.java Jasypt » <code>JasyptPBEStringEncryptionCLI</code>] | |||
* [https://github.com/ulisesbocchio/jasypt-spring-boot Jasypt » <code>jasypt-spring-boot</code>] | * [https://github.com/ulisesbocchio/jasypt-spring-boot Jasypt » <code>jasypt-spring-boot</code>] | ||
* [https://danielblancocuadrado.medium.com/how-to-encrypt-properties-with-jasypt-7c9896f74260 Encrypt properties with Jasypt] | * [https://danielblancocuadrado.medium.com/how-to-encrypt-properties-with-jasypt-7c9896f74260 Encrypt properties with Jasypt] | ||
* [https://github.com/jasypt/jasypt/blob/jasypt-1.9.3/jasypt/src/main/java/org/jasypt/intf/cli/ArgumentNaming.java Jasypt » <code>ArgumentNaming</code>] | |||
* [https://downloads.apache.org/camel/apache-camel/ Apache Camel Source Code] | * [https://downloads.apache.org/camel/apache-camel/ Apache Camel Source Code] | ||
* [https://github.com/jasypt/jasypt Jasypt » SCM » GitHub] | |||
* [http://www.jasypt.org/general-usage.html Jasypt » Algorithm] | * [http://www.jasypt.org/general-usage.html Jasypt » Algorithm] | ||
* [[Apache Camel]] | * [[Apache Camel]] | ||
| valign="top" | | | valign="top" | | ||
* [https://github.com/jasypt/jasypt/blob/jasypt-1.9.3/jasypt/src/main/java/org/jasypt/intf/cli/JasyptStringDigestCLI.java Jasypt » <code>JasyptStringDigestCLI</code>] | |||
* [https://github.com/jasypt/jasypt/blob/jasypt-1.9.3/jasypt/src/main/java/org/jasypt/intf/cli/CLIUtils.java Jasypt » <code>CLIUtils</code>] | |||
|- | |- | ||
Latest revision as of 23:15, 7 July 2025
Jasypt is a java library which allows the developer to add basic encryption capabilities to his/her projects with minimum effort, and without the need of having deep knowledge on how cryptography works.
- High-security, standards-based encryption techniques, both for unidirectional and bidirectional encryption. Encrypt passwords, texts, numbers, binaries...
- Transparent integration with Hibernate.
- Suitable for integration into Spring-based applications and also transparently integrable with Spring Security.
- Integrated capabilities for encrypting the configuration of applications (i.e. datasources).
- Specific features for high-performance encryption in multi-processor/multi-core systems.
- Open API for use with any JCE provider.
Dependencies
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>1.9.3</version>
</dependency>
|
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot</artifactId>
<version>3.0.3</version>
</dependency>
|
Encryption
Jasypt
wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar
java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \
ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator \
algorithm=PBEWITHHMACSHA512ANDAES_256 \
password=secret_password \
input=sadaqah!
wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar
java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI \
ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator \
algorithm=PBEWITHHMACSHA512ANDAES_256 \
password=secret_password \
input=D5pJ1JQ+v+I+AYS7BARBnOcKQudi2r1g4qgobdOjT8dogcldMvRPPLAVQx3zddS/
wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar
java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \
ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator \
algorithm=PBEWITHHMACSHA1ANDAES_128 \
password=secret_password \
input=sadaqah!
wget https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar
java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI \
ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator \
algorithm=PBEWITHHMACSHA1ANDAES_128 \
password=secret_password \
input=lC6Z9mpaX8iIS9/SEKIQzuEMbxd58pBWBksuARklDHXyspf3Hg1AqyyMWEd9StMa
Apache Camel Jasypt
wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\
tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\
java -jar camel-jasypt-2.15.6.jar \
-c encrypt -p secret_password \
-i sadaqah!
wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\
tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\
java -jar camel-jasypt-2.15.6.jar \
-c decrypt -p secret_password \
-i BVT6gDNautctO6xPvKrHgU3EAlsbDbnU
wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\
tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\
java -jar camel-jasypt-2.15.6.jar \
-c encrypt -a PBEWithMD5AndDES \
-p secret_password \
-i sadaqah!
wget https://cdn.chorke.org/soft/comn/apache/camel/apache-camel-2.15.6.tar.gz;\
tar -xzvf apache-camel-2.15.6.tar.gz; cd apache-camel-2.15.6/lib/;\
java -jar camel-jasypt-2.15.6.jar \
-c decrypt -a PBEWithMD5AndDES \
-p secret_password \
-i YCYR4yln0xh8E5a1XA+GR+ZtLiLsAx41
Playground
mkdir -p ~/Documents/jasypt-playground cd ~/Documents/jasypt-playground |
sudo apt install openjdk-8-jdk sudo update-alternatives --config java |
|
| |
wget -cq https://repo1.maven.org/maven2/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar\
-P ~/Documents/jasypt-playground/
| |
|
| |
alias jasypt_encrypt="$(cat <<EOF
java -cp ${HOME}/Documents/jasypt-playground/jasypt-1.9.3.jar \
org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \
ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator \
algorithm=PBEWITHHMACSHA512ANDAES_256 \
verbose=false
EOF
)"
|
alias jasypt_decrypt="$(cat <<EOF
java -cp ${HOME}/Documents/jasypt-playground/jasypt-1.9.3.jar \
org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI \
ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator \
algorithm=PBEWITHHMACSHA512ANDAES_256 \
verbose=false
EOF
)"
|
|
| |
jasypt_encrypt password=secret_password\
input=sadaqah!
|
jasypt_decrypt password=secret_password\
input=3afnDdXwer1GW5EjO/SH9/oYIKgBOHO6NapsiuD+l8Wm/zOey20Dis5evl86A5AM
|
|
| |
echo "ENC($(jasypt_encrypt password='secret_password' input='sadaqah!'))"
|
rm -rf ~/Documents/jasypt-playground/jasypt-*
|