A common problem when using confidential data is how to save it. Usually you would encrypt this data and save a encrypted version.
Java provides several build-in algorithms for symmetric-key cryptography (AES, DES …). To use those algorithms, you have to generate a secret-key and initialize a cipher for decryption and one for encryption with it.Those ciphers can now be used to crypt your data.
To simplify this task, I created a small library which provides the needed methods to decrypt and encrypt a String. There are several static methods to automatically initialize a crypter for a certain algorithm such as AES.
How to encrypt and decrypt a String:
Crypter myCrypter = Crypter.getAES_Crypter();
String encrypted = myCrypter.encrypt("my secret text");
String decrypted = myCrypter.decrypt(encrypted);
Download:
A big thank you goes out to the author of the used Base64-Coder: http://www.source-code.biz/