|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.myfaces.util.StateUtils
public final class StateUtils
This Class exposes a handful of methods related to encryption, compression and serialization.
To enable encryption, a secret must be provided. StateUtils looks first for the org.apache.myfaces.secret init param, then system properties. If a secret cannot be located, encryption is not used.
All parameters are interpretted as base 64 encoded keys. In other words, if your secret is "76543210", you would put "NzY1NDMyMTA=" in the deployment descriptor. This is needed so that key values are not limited to just values composed of printable characters.
If you are using CBC mode encryption, you must specify an initialization vector. StateUtils will throw an exception otherwise.
If you are using the AES algorithm and getting a SecurityException complaining about keysize, you most likely need to get the unlimited strength jurisdiction policy files from a place like http://java.sun.com/j2se/1.4.2/download.html .
| Field Summary | |
|---|---|
static java.lang.String |
INIT_ALGORITHM
|
static java.lang.String |
INIT_ALGORITHM_IV
|
static java.lang.String |
INIT_ALGORITHM_PARAM
|
static java.lang.String |
INIT_PREFIX
|
static java.lang.String |
INIT_SECRET
|
static java.lang.String |
ZIP_CHARSET
|
| Method Summary | |
|---|---|
static byte[] |
compress(byte[] bytes)
|
static java.lang.String |
construct(java.lang.Object object)
This fires during the Render Response phase. |
static byte[] |
decode(byte[] bytes)
|
static byte[] |
decompress(byte[] bytes)
|
static byte[] |
decrypt(byte[] secure)
|
static byte[] |
encode(byte[] bytes)
|
static java.lang.String |
encode64(java.lang.Object obj)
|
static byte[] |
encrypt(byte[] insecure)
|
static java.lang.String |
getAlgorithm()
|
static java.lang.String |
getAlgorithmParams()
|
static byte[] |
getAsByteArray(java.lang.Object object)
|
static java.lang.Object |
getAsObject(byte[] bytes)
|
static byte[] |
getIv()
|
static byte[] |
getSecret()
|
static boolean |
isSecure()
|
static void |
main(java.lang.String[] args)
|
static java.lang.Object |
reconstruct(java.lang.String string)
This fires during the Restore View phase. |
static void |
setAlgorithm(java.lang.String algorithm)
|
static void |
setAlgorithmParams(java.lang.String algorithmParams)
|
static void |
setIv(byte[] iv)
|
static void |
setIv(java.lang.String _iv)
|
static void |
setSecret(byte[] secret)
|
static void |
setSecret(java.lang.String _secret)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String ZIP_CHARSET
public static final java.lang.String INIT_PREFIX
public static final java.lang.String INIT_SECRET
public static final java.lang.String INIT_ALGORITHM
public static final java.lang.String INIT_ALGORITHM_IV
public static final java.lang.String INIT_ALGORITHM_PARAM
| Method Detail |
|---|
public static boolean isSecure()
public static final java.lang.String construct(java.lang.Object object)
public static final byte[] getAsByteArray(java.lang.Object object)
public static byte[] encrypt(byte[] insecure)
public static final byte[] compress(byte[] bytes)
public static final byte[] encode(byte[] bytes)
public static final java.lang.Object reconstruct(java.lang.String string)
public static final byte[] decode(byte[] bytes)
public static final byte[] decompress(byte[] bytes)
public static byte[] decrypt(byte[] secure)
public static final java.lang.Object getAsObject(byte[] bytes)
public static java.lang.String encode64(java.lang.Object obj)
public static byte[] getSecret()
public static void setSecret(java.lang.String _secret)
public static void setSecret(byte[] secret)
public static java.lang.String getAlgorithm()
public static void setAlgorithm(java.lang.String algorithm)
public static java.lang.String getAlgorithmParams()
public static void setAlgorithmParams(java.lang.String algorithmParams)
public static byte[] getIv()
public static void setIv(java.lang.String _iv)
public static void setIv(byte[] iv)
public static void main(java.lang.String[] args)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||