public final class Obfuscate extends Object
Support for obfuscated properties. This is essentially encryption. However, because the code below is open-sourced, you should not use it as a security feature, merely an obfuscation to make reading the values in place more difficult. To make it into a security feature, you can add a salt file which will in essence alter the key derivation to become private to your installation. Just put a file called "salt.txt" into the home folder or the top of the classpath with the following contents: salt=xxxx where xxxx is some random string of any non-zero length. It will be added as salt. Note: if you do this, your obfuscated file data is no longer portable, at least not without some effort.
| Modifier and Type | Field and Description |
|---|---|
(package private) byte[] |
addedSalt |
static Obfuscate |
FACTORY |
(package private) int |
ITERATIONS |
(package private) int |
KEY_LENGTH |
(package private) char[] |
password |
(package private) byte[] |
salt |
| Modifier | Constructor and Description |
|---|---|
private |
Obfuscate() |
| Modifier and Type | Method and Description |
|---|---|
String |
decrypt(String inBase64) |
byte[] |
decryptToBytes(String inBase64) |
char[] |
decryptToChar(String inBase64) |
char[] |
decryptToChar(String inBase64,
Charset charset) |
String |
encrypt(byte[] in) |
String |
encrypt(char[] in) |
String |
encrypt(char[] in,
Charset charset) |
String |
encrypt(String in) |
static void |
main(String[] args)
Simple main method for utility use case.
|
private byte[] |
salt() |
final byte[] salt
final char[] password
final int KEY_LENGTH
final int ITERATIONS
final byte[] addedSalt
public static final Obfuscate FACTORY
public static void main(String[] args)
args - private byte[] salt()
public final byte[] decryptToBytes(String inBase64)
public final char[] decryptToChar(String inBase64)
public final String encrypt(char[] in)
public final String encrypt(byte[] in)
Copyright © 2011–2016 David R. Smith. All rights reserved.