Coverage Report - org.kuali.rice.core.api.encryption.EncryptionService
 
Classes in this File Line Coverage Branch Coverage Complexity
EncryptionService
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright 2007-2008 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.core.api.encryption;
 17  
 
 18  
 import java.security.GeneralSecurityException;
 19  
 
 20  
 /**
 21  
  * This is a service interface to consolidate Kuali encryption operation 
 22  
  * 
 23  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 24  
  *
 25  
  */
 26  
 public interface EncryptionService {
 27  
     /* string appended to an encrypted value by the frameworks for determine if a 
 28  
     value coming back from the ui is encrypted */
 29  
     public static final String ENCRYPTION_POST_PREFIX = "(&^#&)";
 30  
     public static final String HASH_POST_PREFIX = "(&^HSH#&)";
 31  
 
 32  
     /**
 33  
      * Encrypts a value
 34  
      *
 35  
      * @param valueToHide - original value
 36  
      * @return encrypted value
 37  
      * @throws GeneralSecurityException
 38  
      */
 39  
     public String encrypt(Object valueToHide) throws GeneralSecurityException;
 40  
 
 41  
     /**
 42  
      * Encrypts a value
 43  
      *
 44  
      * @param valueToHide - original value
 45  
      * @return encrypted value
 46  
      * @throws GeneralSecurityException
 47  
      */
 48  
     public byte[] encryptBytes(byte[] valueToHide) throws GeneralSecurityException;
 49  
     
 50  
     /**
 51  
      * Decrypts a value
 52  
      *
 53  
      * @param ciphertext - encrypted value
 54  
      * @return decrypted value
 55  
      * @throws GeneralSecurityException
 56  
      */
 57  
     public String decrypt(String ciphertext) throws GeneralSecurityException;
 58  
 
 59  
     /**
 60  
      * Decrypts a value
 61  
      *
 62  
      * @param ciphertext - encrypted value
 63  
      * @return decrypted value
 64  
      * @throws GeneralSecurityException
 65  
      */
 66  
     public byte[] decryptBytes(byte[] ciphertext) throws GeneralSecurityException;
 67  
 
 68  
     /**
 69  
      * Returns true if encryption is enabled within KEW, false otherwise.
 70  
      */
 71  
     public boolean isEnabled();
 72  
 
 73  
     /**
 74  
      * Hashes a value (for one-way transformations)
 75  
      * 
 76  
      * @param valueToHide - original value
 77  
      * @return encrypted value
 78  
      * @throws GeneralSecurityException
 79  
      */
 80  
     public String hash(Object valueToHide) throws GeneralSecurityException;
 81  
 }