org.springframework.security.util
Class EncryptionUtils

java.lang.Object
  extended by org.springframework.security.util.EncryptionUtils

Deprecated. Use a dedicated encryption library instead.

@Deprecated
public final class EncryptionUtils
extends Object

A static utility class that can encrypt and decrypt text.

This class is useful if you have simple needs and wish to use the DESede encryption cipher. More sophisticated requirements will need to use the Java crypto libraries directly.


Nested Class Summary
static class EncryptionUtils.EncryptionException
          Deprecated.  
 
Method Summary
static String byteArrayToString(byte[] byteArray)
          Deprecated. Converts a byte array into a String using UTF-8, falling back to the platform's default character set if UTF-8 fails.
static byte[] decrypt(String key, byte[] inputBytes)
          Deprecated. Decrypts the inputBytes using the key.
static String decrypt(String key, String inputString)
          Deprecated. Decrypts the inputString using the key.
static byte[] encrypt(String key, byte[] inputBytes)
          Deprecated. Encrypts the inputBytes using the key.
static String encrypt(String key, String inputString)
          Deprecated. Encrypts the inputString using the key.
static byte[] stringToByteArray(String input)
          Deprecated. Converts a String into a byte array using UTF-8, falling back to the platform's default character set if UTF-8 fails.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

stringToByteArray

public static byte[] stringToByteArray(String input)
Deprecated. 
Converts a String into a byte array using UTF-8, falling back to the platform's default character set if UTF-8 fails.

Parameters:
input - the input (required)
Returns:
a byte array representation of the input string

byteArrayToString

public static String byteArrayToString(byte[] byteArray)
Deprecated. 
Converts a byte array into a String using UTF-8, falling back to the platform's default character set if UTF-8 fails.

Parameters:
byteArray - the byte array to convert (required)
Returns:
a string representation of the byte array

encrypt

public static String encrypt(String key,
                             String inputString)
                      throws EncryptionUtils.EncryptionException
Deprecated. 
Encrypts the inputString using the key.

Parameters:
key - at least 24 character long key (required)
inputString - the string to encrypt (required)
Returns:
the encrypted version of the inputString
Throws:
EncryptionUtils.EncryptionException - in the event of an encryption failure

encrypt

public static byte[] encrypt(String key,
                             byte[] inputBytes)
                      throws EncryptionUtils.EncryptionException
Deprecated. 
Encrypts the inputBytes using the key.

Parameters:
key - at least 24 character long key (required)
inputBytes - the bytes to encrypt (required)
Returns:
the encrypted version of the inputBytes
Throws:
EncryptionUtils.EncryptionException - in the event of an encryption failure

decrypt

public static String decrypt(String key,
                             String inputString)
                      throws EncryptionUtils.EncryptionException
Deprecated. 
Decrypts the inputString using the key.

Parameters:
key - the key used to originally encrypt the string (required)
inputString - the encrypted string (required)
Returns:
the decrypted version of inputString
Throws:
EncryptionUtils.EncryptionException - in the event of an encryption failure

decrypt

public static byte[] decrypt(String key,
                             byte[] inputBytes)
                      throws EncryptionUtils.EncryptionException
Deprecated. 
Decrypts the inputBytes using the key.

Parameters:
key - the key used to originally encrypt the string (required)
inputBytes - the encrypted bytes (required)
Returns:
the decrypted version of inputBytes
Throws:
EncryptionUtils.EncryptionException - in the event of an encryption failure