1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
25
26
27
28 public class NoEncryptionEncryptionServiceImpl implements EncryptionService {
29
30
31
32
33 public boolean isEnabled() {
34 return false;
35 }
36
37 public String encrypt(Object valueToHide) throws GeneralSecurityException {
38 if (valueToHide == null) {
39 return "";
40 }
41
42 return valueToHide.toString();
43 }
44
45 public String decrypt(String ciphertext) throws GeneralSecurityException {
46 if (StringUtils.isBlank(ciphertext)) {
47 return "";
48 }
49
50 return new String(ciphertext);
51 }
52
53 public String hash(Object valueToHide) throws GeneralSecurityException {
54 if ( valueToHide == null || StringUtils.isEmpty( valueToHide.toString() ) ) {
55 return "";
56 }
57 return valueToHide.toString();
58 }
59
60
61
62
63
64
65 public byte[] decryptBytes(byte[] ciphertext)
66 throws GeneralSecurityException {
67 return ciphertext;
68 }
69
70
71
72
73
74
75 public byte[] encryptBytes(byte[] valueToHide)
76 throws GeneralSecurityException {
77 return valueToHide;
78 }
79 }