org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig Java Examples
The following examples show how to use
org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EncryptorConfigBeanDefinitionParser.java From jasypt with Apache License 2.0 | 5 votes |
private static Class<?> computeConfigClass(final Element element) { boolean isSimpleConfig = false; boolean isStringConfig = false; boolean isEnvironmentConfig = false; boolean isStringEnvironmentConfig = false; final NamedNodeMap attributesMap = element.getAttributes(); final int attributesLen = attributesMap.getLength(); for (int i = 0; i < attributesLen; i++) { final Node attribute = attributesMap.item(i); final String attributeName = attribute.getNodeName(); if (!isSimpleConfig && PARAMS_SIMPLE.contains(attributeName)) { isSimpleConfig = true; } if (!isStringConfig && PARAMS_STRING.contains(attributeName)) { isStringConfig = true; } if (!isEnvironmentConfig && PARAMS_ENVIRONMENT.contains(attributeName)) { isEnvironmentConfig = true; } if (!isStringEnvironmentConfig && PARAMS_STRING_ENVIRONMENT.contains(attributeName)) { isStringEnvironmentConfig = true; } } if (isStringEnvironmentConfig || (isEnvironmentConfig && isStringConfig)) { return EnvironmentStringPBEConfig.class; } if (isEnvironmentConfig) { return EnvironmentPBEConfig.class; } if (isStringConfig) { return SimpleStringPBEConfig.class; } return SimplePBEConfig.class; }
Example #2
Source File: EncryptorConfigBeanDefinitionParser.java From jasypt with Apache License 2.0 | 5 votes |
private static Class<?> computeConfigClass(final Element element) { boolean isSimpleConfig = false; boolean isStringConfig = false; boolean isEnvironmentConfig = false; boolean isStringEnvironmentConfig = false; final NamedNodeMap attributesMap = element.getAttributes(); final int attributesLen = attributesMap.getLength(); for (int i = 0; i < attributesLen; i++) { final Node attribute = attributesMap.item(i); final String attributeName = attribute.getNodeName(); if (!isSimpleConfig && PARAMS_SIMPLE.contains(attributeName)) { isSimpleConfig = true; } if (!isStringConfig && PARAMS_STRING.contains(attributeName)) { isStringConfig = true; } if (!isEnvironmentConfig && PARAMS_ENVIRONMENT.contains(attributeName)) { isEnvironmentConfig = true; } if (!isStringEnvironmentConfig && PARAMS_STRING_ENVIRONMENT.contains(attributeName)) { isStringEnvironmentConfig = true; } } if (isStringEnvironmentConfig || (isEnvironmentConfig && isStringConfig)) { return EnvironmentStringPBEConfig.class; } if (isEnvironmentConfig) { return EnvironmentPBEConfig.class; } if (isStringConfig) { return SimpleStringPBEConfig.class; } return SimplePBEConfig.class; }
Example #3
Source File: EncryptorConfigBeanDefinitionParser.java From jasypt with Apache License 2.0 | 5 votes |
private static Class<?> computeConfigClass(final Element element) { boolean isSimpleConfig = false; boolean isStringConfig = false; boolean isEnvironmentConfig = false; boolean isStringEnvironmentConfig = false; final NamedNodeMap attributesMap = element.getAttributes(); final int attributesLen = attributesMap.getLength(); for (int i = 0; i < attributesLen; i++) { final Node attribute = attributesMap.item(i); final String attributeName = attribute.getNodeName(); if (!isSimpleConfig && PARAMS_SIMPLE.contains(attributeName)) { isSimpleConfig = true; } if (!isStringConfig && PARAMS_STRING.contains(attributeName)) { isStringConfig = true; } if (!isEnvironmentConfig && PARAMS_ENVIRONMENT.contains(attributeName)) { isEnvironmentConfig = true; } if (!isStringEnvironmentConfig && PARAMS_STRING_ENVIRONMENT.contains(attributeName)) { isStringEnvironmentConfig = true; } } if (isStringEnvironmentConfig || (isEnvironmentConfig && isStringConfig)) { return EnvironmentStringPBEConfig.class; } if (isEnvironmentConfig) { return EnvironmentPBEConfig.class; } if (isStringConfig) { return SimpleStringPBEConfig.class; } return SimplePBEConfig.class; }
Example #4
Source File: DataUtil.java From framework with Apache License 2.0 | 5 votes |
/** * Description: 可以解密的加密<br> * * @author 王伟<br> * @taskId <br> * @param password * @return <br> */ public static String encrypt(final String password) { // 加密工具 StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); // 加密配置 EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig(); config.setAlgorithm(ALGORITHM); // 自己在用的时候更改此密码 config.setPassword(SITE_WIDE_SECRET); // 应用配置 encryptor.setConfig(config); // 加密 return encryptor.encrypt(password); }
Example #5
Source File: DataUtil.java From framework with Apache License 2.0 | 5 votes |
/** * Description: 解密 <br> * * @author 王伟<br> * @taskId <br> * @param password * @return <br> */ public static String decrypt(final String password) { StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); // 加密配置 EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig(); config.setAlgorithm(ALGORITHM); // 自己在用的时候更改此密码 config.setPassword(SITE_WIDE_SECRET); // 应用配置 encryptor.setConfig(config); // 解密 return encryptor.decrypt(password); }
Example #6
Source File: EncryptionConfig.java From bearchoke with Apache License 2.0 | 5 votes |
@Bean public EnvironmentStringPBEConfig environmentStringPBEConfig() { EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig(); config.setAlgorithm("PBEWithMD5AndDES"); config.setPasswordEnvName("PLATFORM_ENCRYPTION_PASSWORD"); return config; }