Encrypted Preferences in Java
By Greg Travis, October 01, 2002
If you're using the Preferences API in Java, this encryption strategy lets you hide your preferences data in plain sight.
October 2002/Encrypted Preferences in Java
Listing 1: A simple test program. It stores a value in the preferences database
in the root node for its package ("pkg"), and another value in a subnode of
the root node.
// $Id$
package pkg;
import java.util.prefs.*;
public class Test
{
static public void main( String args[] ) throws Exception {
Preferences root = Preferences.userNodeForPackage( Test.class );
root.put( "not", "encrypted" );
Preferences subnode = root.node( "subnode" );
subnode.put( "also not", "encrypted" );
root.exportSubtree( System.out );
}
}