A Gradle plugin for encrypting and decrypting values using Jasypt.
The plugin is available from the
Gradle Plugin Portal and can be
applied to a Gradle project using the plugins block:
plugins {
id("org.cthing.jasypt") version "1.1.0"
}Applying the plugin creates the encryptString task. To encrypt a string run the
following command:
./gradlew encryptString --string=hello [--password=abcd] [--format=plain|spring]The encrypted string is written to the standard output:
Encrypted string: 5cWMaUf/siW1z1IQPU5sbm++lUbnV0ddQbCdjkLtRDFyiw7dSsik3mqRycfOkbVv
Applying the plugin creates the decryptString task. To decrypt a string run the
following command:
./gradlew decryptString --string=5cWMaUf/siW1z1IQPU5sbm++lUbnV0ddQbCdjkLtRDFyiw7dSsik3mqRycfOkbVv [--password=abcd]The decrypted string is written to the standard output:
Decrypted string: hello
The encryption/decryption password may be specified in a number of different ways. In order of highest to lowest precedence:
- Using the
--passwordcommand-line option - From the file specified by the
--password-filecommand-line option - Using the
CTHING_JASYPT_PASSWORDenvironment variables - Using the
org.cthing.jasypt.passwordsystem property
If none of these mechanisms are used, a prompt is displayed to securely enter the password.
The following Gradle and Java versions are supported:
| Plugin Version | Gradle Version | Minimum Java Version |
|---|---|---|
| 1.0.0+ | 8.0+ | 17 |
The plugin is compiled for Java 17. If a Java 17 toolchain is not available, one will be downloaded.
Gradle is used to build the plugin:
./gradlew buildThe Javadoc for the plugin can be generated by running:
./gradlew javadocThis project is released on the Gradle Plugin Portal. Perform the following steps to create a release.
- Commit all changes for the release
- In the
build.gradle.ktsfile, edit theProjectVersionobject- Set the version for the release. The project follows semantic versioning.
- Set the build type to
BuildType.release
- Commit the changes
- Wait until CI successfully builds the release candidate
- Verify GitHub Actions build is successful
- In a browser go to the C Thing Software Jenkins CI page
- Run the
gradle-jasypt-validatejob - Wait until that job successfully completes
- Run the
gradle-jasypt-releasejob to release the plugin to the Gradle Plugin Portal - Wait for the plugin to be reviewed and made available by the Gradle team
- In a browser, go to the project on GitHub
- Generate a release with the tag
<version> - In the build.gradle.kts file, edit the
ProjectVersionobject- Increment the version patch number
- Set the build type to
BuildType.snapshot
- Update the
CHANGELOG.mdwith the changes in the release and prepare for next release changes - Update the
UsageandCompatibilitysections in theREADME.mdwith the latest artifact release version - Commit these changes
