com.bristle.javalib.security
Class Encrypter

java.lang.Object
  extended by com.bristle.javalib.security.Encrypter

public class Encrypter
extends Object

This class contains support encrypting and decrypting data.

Usage:
   - The typical scenario for using this class is:
     - To encrypt a string:
               String strEncrypted = Encrypter.encrypt(strDecrypted);
     - To decrypt an encrypted string:
               String strDecrypted = Encrypter.decrypt(strEncrypted);

   - See the source code of the inner Tester class for more examples.
  
Assumptions:
Effects:
       - None.
Anticipated Changes:
Notes:
Implementation Notes:
Portability Issues:
Revision History:
   $Log$


Nested Class Summary
static class Encrypter.Tester
          Each class contains a Tester inner class with a main() for easier unit testing.
 
Constructor Summary
Encrypter()
           
 
Method Summary
static String decrypt(String strIn)
          Return the decrypted string value of the specified string.
static String encrypt(String strIn)
          Return the encrypted string value of the specified string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Encrypter

public Encrypter()
Method Detail

encrypt

public static String encrypt(String strIn)
                      throws UnsupportedEncodingException
Return the encrypted string value of the specified string. The specified string is assumed to use the ISO-8859-1 (Latin-1) encoding.

Parameters:
strIn - String to be encrypted.
Returns:
Encrypted string.
Throws:
UnsupportedEncodingException - When the incoming string does not use the ISO-8859-1 (Latin-1) encoding.

decrypt

public static String decrypt(String strIn)
                      throws UnsupportedEncodingException,
                             Base64.InvalidBase64DigitException,
                             Base64.TruncatedBase64EncodingException
Return the decrypted string value of the specified string. The specified string is assumed to use the ISO-8859-1 (Latin-1) encoding.

Parameters:
strIn - String to be decrypted.
Returns:
Decrypted string.
Throws:
UnsupportedEncodingException - When the incoming string does not use the ISO-8859-1 (Latin-1) encoding.
Base64.InvalidBase64DigitException - When the string to be decrypted contains a character that is not a valid Base64 digit char.
Base64.TruncatedBase64EncodingException - When the string to be decrypted has an invalid length.