com.jfw.util
Class Secure

java.lang.Object
  extended by com.jfw.util.Secure

public final class Secure
extends java.lang.Object

Offer methods used in security processes. All methods ares static and thread safe.


Constructor Summary
Secure()
           
 
Method Summary
static java.lang.String decode(java.lang.String toDecode)
          Decode a string from Base64.
static byte[] decrypt(byte[] toDecrypt, java.lang.String key4Decryption)
          Decrypt an array of bytes using the Encryption class.
static java.lang.String encode(java.lang.String toEncode)
          Encode a string in Base64.
static byte[] encrypt(byte[] toEncrypt, java.lang.String key4Encryption)
          Encrypt an array of bytes using the Encryption class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Secure

public Secure()
Method Detail

encode

public static java.lang.String encode(java.lang.String toEncode)
Encode a string in Base64.

Parameters:
toEncode - the string to encode.
Returns:
the encoded string.

decode

public static java.lang.String decode(java.lang.String toDecode)
Decode a string from Base64.

Parameters:
toDecode - the string to Decode.
Returns:
the decoded string.

encrypt

public static byte[] encrypt(byte[] toEncrypt,
                             java.lang.String key4Encryption)
                      throws JFWGenericException
Encrypt an array of bytes using the Encryption class.

Parameters:
toEncrypt - bytes to encrypt.
key4Encryption - the encryption key to use.
Returns:
the encrypted bytes.
Throws:
JFWGenericException

decrypt

public static byte[] decrypt(byte[] toDecrypt,
                             java.lang.String key4Decryption)
                      throws JFWGenericException
Decrypt an array of bytes using the Encryption class.

Parameters:
toDecrypt - bytes to decrypt.
key4Decryption - the decryption key to use.
Returns:
the decrypted bytes.
Throws:
an - exception can be throwed if the key4Decryption is wrong.
JFWGenericException