|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.maintainablexml.EncryptionService
public class EncryptionService
Implementation of encryption service for demonstration. This class has been copied from the base rice code but has added an old secret key that allows for data encrypted with the commons-codec 1.3 api to be decrypted with newer versions of the api. The Base64.decodeBase64 method did not decode the last two bytes correctly in 1.3 when the encoded key did not end with '=', it always defaulted those bytes to '1'
Field Summary | |
---|---|
static String |
ALGORITHM
|
static String |
HASH_ALGORITHM
|
Constructor Summary | |
---|---|
EncryptionService(String key)
|
Method Summary | |
---|---|
protected void |
checkEnabled()
Performs a check to see if the encryption service is enabled. |
String |
decrypt(String ciphertext)
|
byte[] |
decryptBytes(byte[] ciphertext)
|
String |
encrypt(Object valueToHide)
|
byte[] |
encryptBytes(byte[] valueToHide)
|
static String |
generateEncodedKey()
This method generates keys. |
SecretKey |
getDesKey()
|
SecretKey |
getDesKeyOld()
|
String |
hash(Object valueToHide)
Hash the value by converting to a string, running the hash algorithm, and then base64'ng the results. |
boolean |
isEnabled()
|
void |
setDesKeyOld(SecretKey desKeyOld)
|
void |
setSecretKey(String secretKey)
Sets the secretKey attribute value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ALGORITHM
public static final String HASH_ALGORITHM
Constructor Detail |
---|
public EncryptionService(String key) throws Exception
Exception
Method Detail |
---|
public boolean isEnabled()
public String encrypt(Object valueToHide) throws GeneralSecurityException
GeneralSecurityException
public String decrypt(String ciphertext) throws GeneralSecurityException
GeneralSecurityException
public byte[] encryptBytes(byte[] valueToHide) throws GeneralSecurityException
GeneralSecurityException
public byte[] decryptBytes(byte[] ciphertext) throws GeneralSecurityException
GeneralSecurityException
public static String generateEncodedKey() throws Exception
Exception
public void setSecretKey(String secretKey) throws Exception
secretKey
- The secretKey to set.
Exception
public String hash(Object valueToHide) throws GeneralSecurityException
GeneralSecurityException
protected void checkEnabled()
public SecretKey getDesKey()
public SecretKey getDesKeyOld()
public void setDesKeyOld(SecretKey desKeyOld)
desKeyOld
- the desKeyOld to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |