org.kuali.rice.core.impl.encryption
Class DemonstrationGradeEncryptionServiceImpl

java.lang.Object
  extended by org.kuali.rice.core.impl.encryption.DemonstrationGradeEncryptionServiceImpl
All Implemented Interfaces:
EncryptionService

public class DemonstrationGradeEncryptionServiceImpl
extends Object
implements EncryptionService

Implementation of encryption service for demonstration.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
static String ALGORITHM
           
static String HASH_ALGORITHM
           
 
Fields inherited from interface org.kuali.rice.core.api.encryption.EncryptionService
ENCRYPTION_POST_PREFIX, HASH_POST_PREFIX
 
Constructor Summary
DemonstrationGradeEncryptionServiceImpl()
           
 
Method Summary
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
static String generateEncodedKey()
          This method generates keys.
 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 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

ALGORITHM

public static final String ALGORITHM
See Also:
Constant Field Values

HASH_ALGORITHM

public static final String HASH_ALGORITHM
See Also:
Constant Field Values
Constructor Detail

DemonstrationGradeEncryptionServiceImpl

public DemonstrationGradeEncryptionServiceImpl()
                                        throws Exception
Throws:
Exception
Method Detail

isEnabled

public boolean isEnabled()
Description copied from interface: EncryptionService
Returns true if encryption is enabled within KEW, false otherwise.

Specified by:
isEnabled in interface EncryptionService

encrypt

public String encrypt(Object valueToHide)
               throws GeneralSecurityException
Description copied from interface: EncryptionService
Encrypts a value

Specified by:
encrypt in interface EncryptionService
Parameters:
valueToHide - - original value
Returns:
encrypted value
Throws:
GeneralSecurityException

decrypt

public String decrypt(String ciphertext)
               throws GeneralSecurityException
Description copied from interface: EncryptionService
Decrypts a value

Specified by:
decrypt in interface EncryptionService
Parameters:
ciphertext - - encrypted value
Returns:
decrypted value
Throws:
GeneralSecurityException

encryptBytes

public byte[] encryptBytes(byte[] valueToHide)
                    throws GeneralSecurityException
Description copied from interface: EncryptionService
Encrypts a value

Specified by:
encryptBytes in interface EncryptionService
Parameters:
valueToHide - - original value
Returns:
encrypted value
Throws:
GeneralSecurityException

decryptBytes

public byte[] decryptBytes(byte[] ciphertext)
                    throws GeneralSecurityException
Description copied from interface: EncryptionService
Decrypts a value

Specified by:
decryptBytes in interface EncryptionService
Parameters:
ciphertext - - encrypted value
Returns:
decrypted value
Throws:
GeneralSecurityException

generateEncodedKey

public static String generateEncodedKey()
                                 throws Exception
This method generates keys. This method is implementation specific and should not be present in any general purpose interface extracted from this class.

Returns:
Throws:
Exception

setSecretKey

public void setSecretKey(String secretKey)
                  throws Exception
Sets the secretKey attribute value.

Parameters:
secretKey - The secretKey to set.
Throws:
Exception

hash

public String hash(Object valueToHide)
            throws GeneralSecurityException
Hash the value by converting to a string, running the hash algorithm, and then base64'ng the results. Returns a blank string if any problems occur or the input value is null or empty.

Specified by:
hash in interface EncryptionService
Parameters:
valueToHide - - original value
Returns:
encrypted value
Throws:
GeneralSecurityException
See Also:
org.kuali.rice.krad.service.EncryptionService#hash(java.lang.Object)

checkEnabled

protected void checkEnabled()
Performs a check to see if the encryption service is enabled. If it is not then an IllegalStateException will be thrown.



Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.