/** * Decrypt any encrypted property values. Encrypted values are surrounded by ENC(...), like: * * <pre> * my.value = ENC(DGA$S24FaIO) * </pre> */ public static void decrypt(Properties properties, TextEncryptor encryptor) { decrypt(properties, encryptor, null, null); }
@Override public void process(Properties properties) { Assert.noNulls(properties); if (encryptor.isPresent()) { PropertyUtils.decrypt(properties, encryptor.get()); } }
@Override public void process(Properties properties) { boolean decrypt = PropertyUtils.getBoolean(decryptKey, properties, false); if (decrypt) { TextEncryptor encryptor = getTextEncryptor(properties); PropertyUtils.decrypt(properties, encryptor); } }
/** * Process the properties passed in so they are ready for use by a Spring context.<br> * * 1 - Override with system/environment properties<br> * 2 - Decrypt any ENC(...) values<br> * 3 - Resolve all property values throwing an exception if any are unresolvable.<br> */ public static void prepareContextProperties(Properties properties, String encoding) { // Override with additional properties (if any) properties.putAll(getAdditionalProperties(properties, encoding)); // Override with system/environment properties properties.putAll(getGlobalProperties()); // Are we decrypting property values? decrypt(properties); // Are we resolving placeholders resolve(properties); }
@Override public void process(Properties properties) { Assert.noNulls(properties); if (!context.isEnabled()) { return; } String password = context.getPassword().get(); EncStrength strength = context.getStrength(); TextEncryptor encryptor = EncUtils.getTextEncryptor(password, strength); PropertyUtils.decrypt(properties, encryptor); }
@Deprecated public static void decrypt(Properties properties) { // Are we decrypting property values? boolean decrypt = Boolean.parseBoolean(getRequiredResolvedProperty(properties, "properties.decrypt", "false")); if (decrypt) { // If they asked to decrypt, a password is required String password = getRequiredResolvedProperty(properties, "properties.enc.password"); // Strength is optional (defaults to BASIC) String defaultStrength = org.kuali.common.util.enc.EncStrength.BASIC.name(); String strength = getRequiredResolvedProperty(properties, "properties.enc.strength", defaultStrength); org.kuali.common.util.enc.EncStrength es = org.kuali.common.util.enc.EncStrength.valueOf(strength); TextEncryptor decryptor = org.kuali.common.util.enc.EncUtils.getTextEncryptor(password, es); decrypt(properties, decryptor); } }
PropertyUtils.decrypt(properties);