org.primefaces.util
Class StringEncrypter

java.lang.Object
  extended by org.primefaces.util.StringEncrypter

public class StringEncrypter
extends Object

----------------------------------------------------------------------------- The following example implements a class for encrypting and decrypting strings using several Cipher algorithms. The class is created with a key and can be used repeatedly to encrypt and decrypt strings using that key. Some of the more popular algorithms are: Blowfish DES DESede PBEWithMD5AndDES PBEWithMD5AndTripleDES TripleDES

Version:
1.0
Author:
Jeffrey M. Hunter ([email protected]), http://www.idevelopment.info -----------------------------------------------------------------------------

Constructor Summary
StringEncrypter(SecretKey key, String algorithm)
          Constructor used to create this object.
StringEncrypter(String passPhrase)
          Constructor used to create this object.
 
Method Summary
 String decrypt(String str)
          Takes a encrypted String as an argument, decrypts and returns the decrypted String.
 String encrypt(String str)
          Takes a single String as an argument and returns an Encrypted version of that String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringEncrypter

public StringEncrypter(SecretKey key,
                       String algorithm)
Constructor used to create this object. Responsible for setting and initializing this object's encrypter and decrypter Chipher instances given a Secret Key and algorithm.

Parameters:
key - Secret Key used to initialize both the encrypter and decrypter instances.
algorithm - Which algorithm to use for creating the encrypter and decrypter instances.

StringEncrypter

public StringEncrypter(String passPhrase)
Constructor used to create this object. Responsible for setting and initializing this object's encrypter and decrypter Chipher instances given a Pass Phrase and algorithm.

Parameters:
passPhrase - Pass Phrase used to initialize both the encrypter and decrypter instances.
Method Detail

encrypt

public String encrypt(String str)
Takes a single String as an argument and returns an Encrypted version of that String.

Parameters:
str - String to be encrypted
Returns:
String Encrypted version of the provided String

decrypt

public String decrypt(String str)
Takes a encrypted String as an argument, decrypts and returns the decrypted String.

Parameters:
str - Encrypted String to be decrypted
Returns:
String Decrypted version of the provided String


Copyright © 2013. All rights reserved.