com.almende.util
Class EncryptionUtil

java.lang.Object
  extended by com.almende.util.EncryptionUtil

public class EncryptionUtil
extends Object

Utility to encrypt text/passwords WARNING: NOT SAFE TO USE IN A PRODUCTION ENVIRONMENT! Why? Well, currently the master password is put in the code... Sources: http://docs.oracle.com/javase/1.4.2/docs/guide/security/jce/JCERefGuide.html#PBEEx http://stackoverflow.com/questions/1132567/encrypt-password-in-configuration-files-java


Constructor Summary
EncryptionUtil()
           
 
Method Summary
static String decrypt(String encryptedText)
          Decrypt an encrypted string
static String encrypt(String text)
          Encrypt a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncryptionUtil

public EncryptionUtil()
Method Detail

encrypt

public static String encrypt(String text)
                      throws InvalidKeyException,
                             InvalidAlgorithmParameterException,
                             NoSuchAlgorithmException,
                             InvalidKeySpecException,
                             NoSuchPaddingException,
                             IllegalBlockSizeException,
                             BadPaddingException,
                             UnsupportedEncodingException
Encrypt a string

Parameters:
text -
Returns:
encryptedText
Throws:
InvalidKeyException
InvalidAlgorithmParameterException
NoSuchAlgorithmException
InvalidKeySpecException
NoSuchPaddingException
IllegalBlockSizeException
BadPaddingException
UnsupportedEncodingException

decrypt

public static String decrypt(String encryptedText)
                      throws InvalidKeyException,
                             InvalidAlgorithmParameterException,
                             NoSuchAlgorithmException,
                             InvalidKeySpecException,
                             NoSuchPaddingException,
                             IllegalBlockSizeException,
                             BadPaddingException,
                             UnsupportedEncodingException
Decrypt an encrypted string

Parameters:
encryptedText -
Returns:
text
Throws:
InvalidKeyException
InvalidAlgorithmParameterException
NoSuchAlgorithmException
InvalidKeySpecException
NoSuchPaddingException
IllegalBlockSizeException
BadPaddingException
UnsupportedEncodingException


Copyright © 2013 Almende BV. All Rights Reserved.