34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
|
|
package com.sercurityControl.decision.config;
|
||
|
|
|
||
|
|
import org.jasypt.encryption.StringEncryptor;
|
||
|
|
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
|
||
|
|
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
|
||
|
|
import org.springframework.context.annotation.Bean;
|
||
|
|
import org.springframework.context.annotation.Configuration;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 自定义密码加密
|
||
|
|
*/
|
||
|
|
@Configuration
|
||
|
|
public class CodeSheepEncryptorCfg {
|
||
|
|
|
||
|
|
@Bean( name = "codeSheepEncryptorBean2" )
|
||
|
|
public StringEncryptor codesheepStringEncryptor() {
|
||
|
|
|
||
|
|
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
|
||
|
|
|
||
|
|
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
|
||
|
|
config.setPassword("CodeSheep");
|
||
|
|
config.setAlgorithm("PBEWITHHMACSHA512ANDAES_256");
|
||
|
|
config.setKeyObtentionIterations("1000");
|
||
|
|
config.setPoolSize("1");
|
||
|
|
config.setProviderName("SunJCE");
|
||
|
|
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
|
||
|
|
config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator");
|
||
|
|
config.setStringOutputType("base64");
|
||
|
|
encryptor.setConfig(config);
|
||
|
|
|
||
|
|
return encryptor;
|
||
|
|
}
|
||
|
|
}
|