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