edu.jhu.tmaj.util.crypt
Class CryptUtil

java.lang.Object
  extended by edu.jhu.tmaj.util.crypt.CryptUtil

public final class CryptUtil
extends java.lang.Object

A utility class encryption and decryption of data (2-way).


Constructor Summary
CryptUtil()
           
 
Method Summary
 java.lang.String decrypt(java.lang.String encryptedString)
          Decrypts a string.
 java.lang.String encrypt(java.lang.String plainText)
          Encrypts a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CryptUtil

public CryptUtil()
          throws java.io.IOException,
                 java.security.GeneralSecurityException,
                 java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.security.GeneralSecurityException
java.lang.ClassNotFoundException
Method Detail

encrypt

public java.lang.String encrypt(java.lang.String plainText)
                         throws java.security.GeneralSecurityException,
                                java.io.IOException
Encrypts a string. Random data is added at the beginning of the string so that if the same string is encrypted more than once, different values are returned

Throws:
java.security.GeneralSecurityException
java.io.IOException

decrypt

public java.lang.String decrypt(java.lang.String encryptedString)
                         throws java.security.GeneralSecurityException,
                                java.io.IOException
Decrypts a string. The random data added during encrypt() is removed

Throws:
java.security.GeneralSecurityException
java.io.IOException