Package com.sun.faces.renderkit
Class ByteArrayGuard
- java.lang.Object
-
- com.sun.faces.renderkit.ByteArrayGuard
-
public final class ByteArrayGuard extends Object
This utility class is to provide both encryption and decryption
Ciphers
toResponseStateManager
implementations wishing to provide encryption support.The algorithm used to encrypt byte array is AES with CBC.
Original author Inderjeet Singh, J2EE Blue Prints Team. Modified to suit Faces needs.
-
-
Constructor Summary
Constructors Constructor Description ByteArrayGuard()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
decrypt(FacesContext facesContext, byte[] bytes)
This method decrypts the provided byte array.byte[]
encrypt(FacesContext facesContext, byte[] bytes)
This method: Encrypts bytes using a cipher.
-
-
-
Method Detail
-
encrypt
public byte[] encrypt(FacesContext facesContext, byte[] bytes)
This method: Encrypts bytes using a cipher. Generates MAC for intialization vector of the cipher Generates MAC for encrypted data Returns a byte array consisting of the following concatenated together: |MAC for cnrypted Data | MAC for Init Vector | Encrypted Data |- Parameters:
bytes
- The byte array to be encrypted.- Returns:
- the encrypted byte array.
-
decrypt
public byte[] decrypt(FacesContext facesContext, byte[] bytes)
This method decrypts the provided byte array. The decryption is only performed if the regenerated MAC is the same as the MAC for the received value.- Parameters:
bytes
- Encrypted byte array to be decrypted.- Returns:
- Decrypted byte array.
-
-