Giter Club home page Giter Club logo

jasypt-gradle-plugin's Introduction

Jasypt gradle plugin

Download Travis Twitter Follow Donate

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.

Usage

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.

Tasks

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).

encryptProperties

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.

encryptText

./gradlew encryptText --text=hello --password=encryptor_password

decryptProperties

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.

decryptText

./gradlew decryptText --text=UjNjJVq8ly/oU3JGMNiQXw== --password=encryptor_password

Changelog

See CHANGELOG.

License

MIT. Please see LICENSE.

jasypt-gradle-plugin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jasypt-gradle-plugin's Issues

Encryption not working with gradle 7.5.1

$ gradle encryptText --text=hello --password=ttt                                                                                                           
> Task :encryptText FAILED                                                                                                                                 
                                                                                                                                                           
FAILURE: Build failed with an exception.                                                                                                                   
                                                                                                                                                           
* What went wrong:                                                                                                                                         
A problem was found with the configuration of task ':encryptText' (type 'EncryptTextTask').                                                                
  - In plugin 'com.byteowls.jasypt' type 'com.byteowls.gradle.tasks.text.EncryptTextTask' property 'encryptor' is missing an input or output annotation.   
                                                                                                                                                           
    Reason: A property without annotation isn't considered during up-to-date checking.                                                                     
                                                                                                                                                           
    Possible solutions:                                                                                                                                    
      1. Add an input or output annotation.                                                                                                                
      2. Mark it as @Internal.                                                                                                                             
                                                                                                                                                           
    Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#missing_annotation for more details about this problem.               
                                                                                                                                                           
* Try:                                                                                                                                                     
> Run with --stacktrace option to get the stack trace.                                                                                                     
> Run with --info or --debug option to get more log output.                                                                                                
> Run with --scan to get full insights.                                                                                                                    
                                                                                                                                                           
* Get more help at https://help.gradle.org                                                                                                                 
                                                                                                                                                           
BUILD FAILED in 1s     

Encoutner error when using encryptText

Hi,,

Hi, i execute gradlew.bat encryptText --text=hello --password=encryptor_password , but got the below error. I search overstack flow, and encounter someone also met the same issue.
Note; I am currently using gradle 7.4, and manage to install the plugin using the buildscript and apply plugin in the build.gradle.

> Task :encryptText FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':encryptText' (type 'EncryptTextTask').
  - In plugin 'com.byteowls.jasypt' type 'com.byteowls.gradle.tasks.text.EncryptTextTask' property 'encryptor' is
 missing an input or output annotation.

    Reason: A property without annotation isn't considered during up-to-date checking.

    Possible solutions:
      1. Add an input or output annotation.
      2. Mark it as @Internal.

    Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#missing_annotation for more de
tails about this problem.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your
 own scripts or plugins.

See https://docs.gradle.org/7.4/use

Plugin not found (Gradle 6.0.1)

Hello!! How are you?. I need to incorporate Jasypt in my Spring Boot project to secure certain keys and credentials from external services, the problem that it does not have support to encrypt values ​​with Gradles tasks, that's why I have been interested in your repository.

My Spring Boot project uses Gradle 6.0.1, I have incorporated its plugin as follows:

image

Also I have enabled JCenter as a repository for searching plugins as follows

image
But I have not managed to solve your plugin, I have the following message

image

Could you tell me how I can incorporate your plugin into my project or some way to encrypt data with gradle using Jasypt.? Thank you very much for your time. Greetings

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.