01: /*
02: * Copyright 2006-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.core.service.impl;
17:
18: import java.security.GeneralSecurityException;
19:
20: import org.apache.commons.lang.StringUtils;
21: import org.kuali.core.service.Demonstration;
22: import org.kuali.core.service.EncryptionService;
23:
24: /**
25: * Implementation of encryption service for demonstration.
26: *
27: *
28: */
29: public class NoEncryptionEncryptionServiceImpl implements
30: EncryptionService, Demonstration {
31:
32: /**
33: * @see edu.iu.uis.eden.security.EncryptionService#isEnabled()
34: */
35: public boolean isEnabled() {
36: return false;
37: }
38:
39: public String encrypt(Object valueToHide)
40: throws GeneralSecurityException {
41: if (valueToHide == null) {
42: return "";
43: }
44:
45: return valueToHide.toString();
46: }
47:
48: public String decrypt(String ciphertext)
49: throws GeneralSecurityException {
50: if (StringUtils.isBlank(ciphertext)) {
51: return "";
52: }
53:
54: return new String(ciphertext);
55: }
56:
57: public String hash(Object valueToHide)
58: throws GeneralSecurityException {
59: if (valueToHide == null
60: || StringUtils.isEmpty(valueToHide.toString())) {
61: return "";
62: }
63: return valueToHide.toString();
64: }
65: }
|