Encryption & decryption using Talend and MySQL db

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

View solution in original post


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

 

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

View solution in original post

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog