Encryption & decryption using Talend and MySQL db

Highlighted
Four Stars

Encryption & decryption using Talend and MySQL db

Hello.

My question is if there is any solution to encrypt/decrypt the data in talend but without putting my password in clear in the code java because all the solution that i saw you need to put either your password or the key used to encrypt in the code in clear (For example tEncryptColumn /tDecryptColumn , JavaXCrypto,Jasypt ...) so i was wondering if there's any solution to do that . 
For example: tMysqlInput -------Decrypt---------> Tmap --------Encrypt-------> tMysqlOutput

For the DB I'm using MySQL. 


Accepted Solutions
Community Manager

Re: Encryption & decryption using Talend and MySQL db

You need to either supply the full path to the Java class or import it.


All Replies
Community Manager

Re: Encryption & decryption using Talend and MySQL db

This is very easy to implement using Jasypt (http://www.jasypt.org/) and system environment variables. On the machines running your jobs you can set up system environment variables which hold your passwords (or passwords to decrypt secondary passwords stored elsewhere for extra obfuscation), then in your jobs use Jasypt to encrypt/decrypt your data. It requires a bit of Java, but it really isn't that difficult to achieve. Jasypt is actually supplied with Talend, so you shouldn't need to download anything for this.

Four Stars

Re: Encryption & decryption using Talend and MySQL db

Thank you for replying  

 

My question is how to make the connection between my system environment variables and  Jasyp in talend . do i need to create new contexte ? 

 

Community Manager

Re: Encryption & decryption using Talend and MySQL db

This code is from a routine I use in my Talend jobs......

 

public static String getEnvironmentVariable(String variableName) {
		String returnVal = System.getenv(variableName);

		if (returnVal == null) {
			System.out.println(variableName
					+ " does not exist or holds no value");
		}

		return returnVal;
	}
Four Stars

Re: Encryption & decryption using Talend and MySQL db

thank you for the example

So i wrote a java code  and i'm getting this error :  StandardPBEStringEncryptor cannot be resolved to a type : 

this is m'y code : 


String mdp = System.getenv("MDP");

if (mdp == null) {
System.out.println(
" does not exist");
} else System.out.println(mdp);

 

StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
encryptor.setPassword(mdp); // we HAVE TO set a password
encryptor.setAlgorithm("PBEWithMD5AndTripleDES");


String encryptedText = encryptor.encrypt(row2.libelle_bu);

 

Community Manager

Re: Encryption & decryption using Talend and MySQL db

You need to either supply the full path to the Java class or import it.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch