public final class ByteArrayGuardAESCTR
extends java.lang.Object
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 JSF needs.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
CIPHER_CODE |
private static int |
IV_LENGTH |
private javax.crypto.spec.IvParameterSpec |
ivspec |
private static java.lang.String |
KEY_ALGORITHM |
private static int |
KEY_LENGTH |
private static java.util.logging.Logger |
LOGGER |
private javax.crypto.SecretKey |
sk |
private java.nio.charset.Charset |
utf8 |
Constructor and Description |
---|
ByteArrayGuardAESCTR() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
decrypt(java.lang.String value) |
java.lang.String |
encrypt(java.lang.String value)
This method:
Encrypts bytes using a cipher.
|
private void |
setupKeyAndCharset() |
private static final java.util.logging.Logger LOGGER
private static final int KEY_LENGTH
private static final int IV_LENGTH
private static final java.lang.String KEY_ALGORITHM
private static final java.lang.String CIPHER_CODE
private javax.crypto.SecretKey sk
private javax.crypto.spec.IvParameterSpec ivspec
private java.nio.charset.Charset utf8
public java.lang.String encrypt(java.lang.String value)
bytes
- The byte array to be encrypted.public java.lang.String decrypt(java.lang.String value) throws java.security.InvalidKeyException
java.security.InvalidKeyException
private void setupKeyAndCharset()
Copyright © 2002-2013 Oracle America, Inc. All Rights Reserved.