1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util.property.processor;
17
18 import java.util.Properties;
19
20 import org.jasypt.util.text.TextEncryptor;
21 import org.kuali.common.util.Assert;
22 import org.kuali.common.util.PropertyUtils;
23 import org.kuali.common.util.enc.EncStrength;
24 import org.kuali.common.util.enc.EncUtils;
25
26
27
28
29 @Deprecated
30 public final class ContextDecryptingProcessor implements PropertyProcessor {
31
32 public ContextDecryptingProcessor() {
33 this(org.kuali.common.util.enc.EncryptionContext.DEFAULT);
34 }
35
36 public ContextDecryptingProcessor(org.kuali.common.util.enc.EncryptionContext context) {
37 Assert.noNulls(context);
38 this.context = context;
39 }
40
41 private final org.kuali.common.util.enc.EncryptionContext context;
42
43 @Override
44 public void process(Properties properties) {
45 Assert.noNulls(properties);
46 if (!context.isEnabled()) {
47 return;
48 }
49 String password = context.getPassword().get();
50 EncStrength strength = context.getStrength();
51 TextEncryptor encryptor = EncUtils.getTextEncryptor(password, strength);
52 PropertyUtils.decrypt(properties, encryptor);
53 }
54
55 public org.kuali.common.util.enc.EncryptionContext getContext() {
56 return context;
57 }
58
59 }