public class EncryptionServiceImpl extends Object implements EncryptionService, org.springframework.beans.factory.InitializingBean
Leverages a configured EncryptionStrategy for determining what algorithm to use for encryption. The
strategy can either be injected into this class or configured in the ConfigContext. The algorithm is
configured using the "encryption.algorithm" parameter. The only two options are "DES" and "DESede".
If no encryption strategy is injected or configured, then this class will default to using "DES" as the algorithm.
This class defaults to using the UTF-8 charset, but that can be modified via setCharset(String)
| Modifier and Type | Class and Description |
|---|---|
static class |
EncryptionServiceImpl.DESedeEncryptionStrategy
An EncryptionStrategy for the DESede encryption algorithm.
|
static class |
EncryptionServiceImpl.DESEncryptionStrategy
An EncryptionStrategy for the DES encryption algorithm.
|
ENCRYPTION_POST_PREFIX, HASH_POST_PREFIX| Constructor and Description |
|---|
EncryptionServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected void |
checkEnabled()
Performs a check to see if the encryption service is enabled.
|
String |
decrypt(String ciphertext)
Decrypts a value
|
byte[] |
decryptBytes(byte[] ciphertext)
Decrypts a value
|
String |
encrypt(Object valueToHide)
Encrypts a value
|
byte[] |
encryptBytes(byte[] valueToHide)
Encrypts a value
|
EncryptionStrategy |
getEncryptionStrategy() |
String |
hash(Object valueToHide)
Hash the value by converting to a string, running the hash algorithm, and then base64'ng the results.
|
boolean |
isEnabled()
Returns true if encryption is enabled within KEW, false otherwise.
|
void |
setCharset(String charset) |
void |
setEncryptionStrategy(EncryptionStrategy encryptionStrategy) |
void |
setSecretKey(String secretKeyValue)
Sets the secretKey attribute value.
|
public EncryptionServiceImpl()
public void afterPropertiesSet() throws GeneralSecurityException
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanGeneralSecurityExceptionpublic boolean isEnabled()
EncryptionServiceisEnabled in interface EncryptionServicepublic String encrypt(Object valueToHide) throws GeneralSecurityException
EncryptionServiceencrypt in interface EncryptionServicevalueToHide - - original valueGeneralSecurityExceptionpublic String decrypt(String ciphertext) throws GeneralSecurityException
EncryptionServicedecrypt in interface EncryptionServiceciphertext - - encrypted valueGeneralSecurityExceptionpublic byte[] encryptBytes(byte[] valueToHide) throws GeneralSecurityException
EncryptionServiceencryptBytes in interface EncryptionServicevalueToHide - - original valueGeneralSecurityExceptionpublic byte[] decryptBytes(byte[] ciphertext) throws GeneralSecurityException
EncryptionServicedecryptBytes in interface EncryptionServiceciphertext - - encrypted valueGeneralSecurityExceptionpublic void setSecretKey(String secretKeyValue) throws GeneralSecurityException
secretKeyValue - The secretKey to set.ExceptionGeneralSecurityExceptionpublic EncryptionStrategy getEncryptionStrategy()
public void setEncryptionStrategy(EncryptionStrategy encryptionStrategy)
public String hash(Object valueToHide) throws GeneralSecurityException
hash in interface EncryptionServicevalueToHide - - original valueGeneralSecurityExceptionprotected void checkEnabled()
public void setCharset(String charset)
Copyright © 2005–2016 The Kuali Foundation. All rights reserved.