This plugin was inspired by "mowedgrass/jasypt-gradle-boot".
This plugin works with Gradle 4.10+ and does not have a dependency to Spring Boot but can be used with it. It only depends on Jasypt.
I wrote it especially for the usage with "ulisesbocchio/jasypt-spring-boot" as I needed to encrypt my credentials somehow.
Add a buildscript
block to the top of your build.gradle
:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.byteowls:jasypt-gradle-plugin:1.0.1"
}
}
Apply the plugin by adding that to your build.gradle
apply plugin: "com.byteowls.jasypt"
Note: This plugin can not be discovered within the plugin
block right now but apply plugin: ...
and the plugin
block can coexist beside each other.
Run `./gradlew tasks´ to ensure that the plugin is loaded.
All below tasks need the --password
option to work.
Use --strong-encryption
option so the StrongTextEncryptor
is used internally which runs a high-strength algorithm.
(you may need to download and install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files to use it).
Search recursively for all .properties
files for values wrapped with ENCRYPT()
and encrypted the values.
./gradlew encryptProperties --password=encryptor_password
Search recursively for non production property files and encrypt their wrapped values.
./gradlew encryptProperties --file-filter-pattern='application-((?!prod).*)\.properties' --password=encryptor_password
The original files are always backed up unless you add --no-backup
.
./gradlew encryptText --text=hello --password=encryptor_password
Search recursively for all .properties
files for values wrapped with ENC()
and decrypted the values.
./gradlew decryptProperties --password=encryptor_password
Search recursively for non production property files and decrypt their wrapped values.
./gradlew decryptProperties --file-filter-pattern='application-((?!prod).*)\.properties' --password=encryptor_password
The original files are always backed up unless you add --no-backup
.
./gradlew decryptText --text=UjNjJVq8ly/oU3JGMNiQXw== --password=encryptor_password
See CHANGELOG.
MIT. Please see LICENSE.