Compare commits

...

4 Commits

View File

@@ -14,6 +14,9 @@ package org.talend.repository.ui.login.connections;
import java.util.Properties;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.daikon.crypto.EncodingUtils;
import org.talend.daikon.crypto.KeySources;
import org.talend.daikon.security.CryptoHelper;
/**
@@ -24,7 +27,16 @@ public class EncryptedProperties extends Properties {
private CryptoHelper crypto;
public EncryptedProperties() {
crypto = new CryptoHelper("Il faudrait trouver une passphrase plus originale que celle-ci!");
String key = System.getProperty("properties.encryption.key");
if (key == null) {
try {
byte[] byteKey = KeySources.file("properties.encryption.key").getKey();
key = new String(byteKey, EncodingUtils.ENCODING);
} catch (Exception ex) {
ExceptionHandler.process(ex);
}
}
crypto = new CryptoHelper(key);
}
public String getProperty(String key) {