Java Code Examples for org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig#setAlgorithm()
The following examples show how to use
org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig#setAlgorithm() .
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: 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 2
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 3
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; }