|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.util.crypt.AbstractCrypt
org.apache.wicket.util.crypt.SunJceCrypt
public class SunJceCrypt
Provide some simple means to encrypt and decrypt strings such as passwords. The whole implementation is based around Sun's security providers and uses the PBEWithMD5AndDES method to encrypt and decrypt the data.
| Field Summary | |
|---|---|
static String |
DEFAULT_CRYPT_METHOD
Name of the default encryption method |
static byte[] |
SALT
Salt |
| Constructor Summary | |
|---|---|
SunJceCrypt()
Constructor |
|
SunJceCrypt(String cryptMethod)
Constructor that uses a custom encryption method (cipher). |
|
| Method Summary | |
|---|---|
protected Cipher |
createCipher(SecretKey key,
AlgorithmParameterSpec spec,
int mode)
Creates the Cipher that will do the de-/encryption. |
protected KeySpec |
createKeySpec()
|
protected AlgorithmParameterSpec |
createParameterSpec()
|
protected byte[] |
crypt(byte[] input,
int mode)
Crypts the given byte array |
protected SecretKey |
generateSecretKey()
Generate the de-/encryption key. |
| Methods inherited from class org.apache.wicket.util.crypt.AbstractCrypt |
|---|
decryptUrlSafe, encryptUrlSafe, getKey, setKey |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_CRYPT_METHOD
public static final byte[] SALT
| Constructor Detail |
|---|
public SunJceCrypt()
public SunJceCrypt(String cryptMethod)
createKeySpec() and/or
createParameterSpec() for the custom cipher.
cryptMethod - the name of encryption method (the cipher)| Method Detail |
|---|
protected byte[] crypt(byte[] input,
int mode)
throws GeneralSecurityException
crypt in class AbstractCryptinput - byte array to be encryptedmode - crypt mode
GeneralSecurityException
protected Cipher createCipher(SecretKey key,
AlgorithmParameterSpec spec,
int mode)
throws GeneralSecurityException
Cipher that will do the de-/encryption.
key - the secret key to usespec - the parameters spec to usemode - the mode (Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODE)
GeneralSecurityException
protected SecretKey generateSecretKey()
throws NoSuchAlgorithmException,
InvalidKeySpecException
Note: if you don't provide your own encryption key, the implementation will use a default. Be aware that this is potential security risk. Thus make sure you always provide your own one.
NoSuchAlgorithmException - unable to find encryption algorithm specified
InvalidKeySpecException - invalid encryption keyprotected AlgorithmParameterSpec createParameterSpec()
protected KeySpec createKeySpec()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||