Coverage Report - org.kuali.rice.core.impl.encryption.NoEncryptionEncryptionServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
NoEncryptionEncryptionServiceImpl
0%
0/13
0%
0/8
2.167
 
 1  
 /**
 2  
  * Copyright 2005-2011 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.impl.encryption;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.core.api.encryption.EncryptionService;
 20  
 
 21  
 import java.security.GeneralSecurityException;
 22  
 
 23  
 /**
 24  
  * Implementation of encryption service for demonstration. 
 25  
  * 
 26  
  * 
 27  
  */
 28  0
 public class NoEncryptionEncryptionServiceImpl implements EncryptionService {
 29  
 
 30  
     /**
 31  
      * @see org.kuali.rice.ksb.security.EncryptionService#isEnabled()
 32  
      */
 33  
     public boolean isEnabled() {
 34  0
         return false;
 35  
     }
 36  
     
 37  
     public String encrypt(Object valueToHide) throws GeneralSecurityException {
 38  0
         if (valueToHide == null) {
 39  0
             return "";
 40  
         }
 41  
 
 42  0
         return valueToHide.toString();
 43  
     }
 44  
 
 45  
     public String decrypt(String ciphertext) throws GeneralSecurityException {
 46  0
         if (StringUtils.isBlank(ciphertext)) {
 47  0
             return "";
 48  
         }
 49  
 
 50  0
         return new String(ciphertext);
 51  
     }
 52  
 
 53  
     public String hash(Object valueToHide) throws GeneralSecurityException {
 54  0
         if ( valueToHide == null || StringUtils.isEmpty( valueToHide.toString() ) ) {
 55  0
             return "";
 56  
         }
 57  0
         return valueToHide.toString();
 58  
     }
 59  
     
 60  
     /**
 61  
      * This overridden method ...
 62  
      * 
 63  
      * @see org.kuali.rice.core.api.encryption.EncryptionService#decryptBytes(byte[])
 64  
      */
 65  
     public byte[] decryptBytes(byte[] ciphertext)
 66  
                     throws GeneralSecurityException {
 67  0
             return ciphertext;
 68  
     }
 69  
     
 70  
     /**
 71  
      * This overridden method ...
 72  
      * 
 73  
      * @see org.kuali.rice.core.api.encryption.EncryptionService#encryptBytes(byte[])
 74  
      */
 75  
     public byte[] encryptBytes(byte[] valueToHide)
 76  
                     throws GeneralSecurityException {
 77  0
             return valueToHide;
 78  
     }
 79  
 }