java.lang.Object
com.sun.faces.renderkit.ByteArrayGuard
This utility class is to provide both encryption and decryption Ciphers
to
ResponseStateManager
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
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
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.
-
Constructor Details
-
ByteArrayGuard
public ByteArrayGuard()
-
-
Method Details
-
encrypt
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
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.
-