Skip to content

05. Encryption Tools

Fernando Rubbo edited this page Mar 6, 2016 · 2 revisions

In this page we describe how to encrypt/decrypt properties SCD4J.

Encrypt properties are required to be done for every sensitive data, such as passwords. This ensures that only the person who has the decryption password will be able to see these actual data or to execute SCD4J.

To see the tools we have, first you need to go to the project directory and type in the line command (tools will prompt a popup for input if run from an IDE)

  • ./gradlew tasks for Linux
  • gradlew.bat tasks for Windows

This will print something like that:

...
Scd4j Tools tasks
-----------------
changepassword - Helper to change password for encrypted properties, all at once
decrypt - Helper to dencrypt a property
encrypt - Helper to encrypt a property
validate - Helper to perform a basic sanity check in the configuration (includes password check)
...

--

To encrypting a new property, type gradlew encrypt in the command line.

:encrypt

Helper tool to encrypt a property value

Property Name: my_property
Propert Value: 
New Password: 
Confirm New Password: 

Put the property bellow in your configuration file
my_property=ENCRYPTED:f7uv+1vt8d8UVHrRIJ0nWQ==

BUILD SUCCESSFUL

Total time: 21.166 secs

The tool is self service, so.. just follow the steps.

Important Note: use the same password to encrypt all properties in the same config file. Otherwise you will not be able to execute the installation.

--

To dencrypt an existing property, type gradlew decrypt in the command line.

:decrypt

Helper tool to decrypt an existing property value

Provide the encrypted Property Value: ENCRYPTED:Nbi9iIxcqWL2lnAEDAqmVQ==
Password: 

Decrypted value is : abc123

BUILD SUCCESSFUL

Total time: 11.904 secs

The tool is self service, so.. just follow the steps.

--

To validate inputs before executing, type gradlew validate in the command line. This is very important mainly to ensure that you don't have properties encrypted with different passwords.

:validate

Helper tool to validate:
	- Config file: /xxx/config/module1.conf
	- Module inputs: [/xxx/modules/module1, /xxx/modules/module2]

Password: 
1. Validating encrypted property: myprop1
	..OK
2. Validating encrypted property: myprop2
	..OK

NUMBER OF ENCRYPTED PROPERTIES FOUND: 2
=======================
=== Config is valid ===
=======================

BUILD SUCCESSFUL

Total time: 14.262 secs

The tool is self service, so.. just follow the steps.

--

To change the password of the properties of config file all at once, type gradlew changepassword in the command line. This tool is very useful whenever you decide to modify the current password.

:changepassword

Helper tool to change the password of file : /xxx/config/module1.conf

Current Password: 
New Password: 
Confirm New Password: 
1. Converting property myprop1 => from ENCRYPTED:Nbi9iIxcqWL2lnAEDAqmVQ== to ENCRYPTED:SiluCIOfF4sH6hMpBY6cXw==
2. Converting property myprop2 => from ENCRYPTED:JmRMnimkZGs8K99k+9UJKA== to ENCRYPTED:FVA3xm5xcl/PIV/0569jBw==

NUMBER OF ENCRYPTED PROPERTIES FOUND: 2

Config file /xxx/config/module1.conf successfully save!

BUILD SUCCESSFUL

Total time: 13.61 secs

The tool is self service, so.. just follow the steps.

Clone this wiki locally