Hi there
how many times we have fuckin stupid commentaries of , hey the code has a password...
bullshit you can always get the password...
Ok lets encrypt, obfuscate , anything
In last days i just get an example of very well writen lib "refcodes-configuration-ext-obfuscation" that can read / save a java properties file, and can read / write encripted data.
An example:
Let's save a property to an file:
package org.ofusc.prop;
import org.refcodes.configuration.PropertiesSugar;
import org.refcodes.configuration.ResourceProperties.ResourcePropertiesBuilder;
import org.refcodes.configuration.ext.obfuscation.ObfuscationResourceProperties.ObfuscationResourcePropertiesBuilder;
import org.refcodes.configuration.ext.obfuscation.ObfuscationResourcePropertiesBuilderDecorator;
public class testPropOfusc {
public static void main(String[] args) {
try {
new testPropOfusc().run();
} catch (Exception e) {
e.printStackTrace();
}
}
private void run() throws Exception {
ResourcePropertiesBuilder properties = PropertiesSugar.seekFromJavaProperties(
"test.properties");
String theSecret = "1234567890";
properties.put("secret", "encrypt:" + theSecret);
}
}
Let 's see the props file:
secret=decrypt\:jNckuOrrv/IYLQ\=\=
cool it saved some shit that is encripted somehow.
Letś read it now:
ResourcePropertiesBuilder properties = PropertiesSugar.seekFromJavaProperties(
"test.properties");
ObfuscationResourcePropertiesBuilder theObfuscated = new ObfuscationResourcePropertiesBuilderDecorator(
properties);
String theValue = theObfuscated.get("secret");
System.out.println(theValue);
Cool, it worked...
Dont forget the mvn repo on pom.xml
org.refcodes
refcodes-configuration-ext-obfuscation
2.0.0
bye,