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.
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final int | |
| private static final String | |
| private static final int | |
| private static final Logger | |
| private static final String | |
| private static final int | |
| private SecretKey | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | |
| private static byte[] | Returns: a byte array of array1||array2first byte array to be concatenated array1, byte[] second byte array to be concatenated array2)This method concatenates two byte arrays |
| public byte[] | Returns: Decrypted byte array.Encrypted byte array to be decrypted. bytes)This method decrypts the provided byte array. |
| public byte[] | Returns: the encrypted byte array.The byte array to be encrypted. bytes)This method: Encrypts bytes using a cipher. |
| private SecretKey | |
| private void |
| CIPHER_CODE | back to summary |
|---|---|
| private static final String CIPHER_CODE | |
| IV_LENGTH | back to summary |
|---|---|
| private static final int IV_LENGTH | |
| KEY_ALGORITHM | back to summary |
|---|---|
| private static final String KEY_ALGORITHM | |
| KEY_LENGTH | back to summary |
|---|---|
| private static final int KEY_LENGTH | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| MAC_CODE | back to summary |
|---|---|
| private static final String MAC_CODE | |
| MAC_LENGTH | back to summary |
|---|---|
| private static final int MAC_LENGTH | |
| sk | back to summary |
|---|---|
| private SecretKey sk | |
| SK_SESSION_KEY | back to summary |
|---|---|
| private static final String SK_SESSION_KEY | |
| ByteArrayGuard | back to summary |
|---|---|
| public ByteArrayGuard() | |
| areArrayEqualsConstantTime | back to summary |
|---|---|
| private boolean areArrayEqualsConstantTime(byte[] array1, byte[] array2) | |
| concatBytes | back to summary |
|---|---|
| private static byte[] concatBytes(byte[] array1, byte[] array2) This method concatenates two byte arrays
| |
| decrypt | back to summary |
|---|---|
| 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.
| |
| encrypt | back to summary |
|---|---|
| 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 |
| |
| getSecretKey | back to summary |
|---|---|
| private SecretKey getSecretKey(FacesContext facesContext) | |
| setupKeyAndMac | back to summary |
|---|---|
| private void setupKeyAndMac() Generates secret key. Initializes MAC(s). | |