Jasypt中这三者有什么区别?
What are the differences between these three in Jasypt?
我在 Spring Boot 中使用 Jasypt。
我已经如下定义了 Jasypt Configuratoin,但我对配置 bean 有一些疑问。
目前,我使用的是PBEStringEncryptor,但是Maven jar中有三种类型的Encryptor。
我想知道 PBEStringEncryptor、PooledPBEStringEncryptor 和 StandardPBEStringEncryptor 之间的区别以及何时使用它们。
我想知道 PBE 代表什么。
@Configuration
public class JasyptConfig {
@Bean
public PBEStringEncryptor stringEncryptor() {
String encryptPwd = "test"
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
config.setPassword(encryptPwd);
config.setAlgorithm("PBEWithMD5AndDES");
config.setKeyObtentionIterations("1000");
config.setPoolSize("1");
config.setProviderName("SunJCE");
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
config.setStringOutputType("base64");
encryptor.setConfig(config);
return encryptor;
}
}
PBE 代表基于密码的加密。
PBEStringEncryptor
是一个接口。这是用于启用后期绑定的方法的 return 类型。
PooledPBEStringEncryptor
和 StandardPBEStringEncryptor
是该接口的实现(它们之间还有另一层,但我认为我们可以跳过那部分)。我现在将主要引用 jasypt 的文档。
StandardPBEStringEncryptor
使用户能够指定用于加密的算法(和提供程序)、要使用的密码、哈希迭代次数以及将用于获取加密密钥的盐生成器.
PooledPBEStringEncryptor
是StandardPBEStringEncryptor
的加强版。 PBEStringEncryptor
的池化实现实际上包含一个 StandardPBEStringEncryptor
对象数组,用于以循环方式参与加密和解密请求。这应该会提高多处理器系统的性能。
对于我们的最终用户,使用 PooledPBEStringEncryptor
总是更好,除非我们以某种方式限制我们的应用程序仅使用一个处理器。即便如此,您也不会发现这两者之间有任何性能差异。
我在 Spring Boot 中使用 Jasypt。
我已经如下定义了 Jasypt Configuratoin,但我对配置 bean 有一些疑问。
目前,我使用的是PBEStringEncryptor,但是Maven jar中有三种类型的Encryptor。
我想知道 PBEStringEncryptor、PooledPBEStringEncryptor 和 StandardPBEStringEncryptor 之间的区别以及何时使用它们。
我想知道 PBE 代表什么。
@Configuration
public class JasyptConfig {
@Bean
public PBEStringEncryptor stringEncryptor() {
String encryptPwd = "test"
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
config.setPassword(encryptPwd);
config.setAlgorithm("PBEWithMD5AndDES");
config.setKeyObtentionIterations("1000");
config.setPoolSize("1");
config.setProviderName("SunJCE");
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
config.setStringOutputType("base64");
encryptor.setConfig(config);
return encryptor;
}
}
PBE 代表基于密码的加密。
PBEStringEncryptor
是一个接口。这是用于启用后期绑定的方法的 return 类型。
PooledPBEStringEncryptor
和 StandardPBEStringEncryptor
是该接口的实现(它们之间还有另一层,但我认为我们可以跳过那部分)。我现在将主要引用 jasypt 的文档。
StandardPBEStringEncryptor
使用户能够指定用于加密的算法(和提供程序)、要使用的密码、哈希迭代次数以及将用于获取加密密钥的盐生成器.
PooledPBEStringEncryptor
是StandardPBEStringEncryptor
的加强版。 PBEStringEncryptor
的池化实现实际上包含一个 StandardPBEStringEncryptor
对象数组,用于以循环方式参与加密和解密请求。这应该会提高多处理器系统的性能。
对于我们的最终用户,使用 PooledPBEStringEncryptor
总是更好,除非我们以某种方式限制我们的应用程序仅使用一个处理器。即便如此,您也不会发现这两者之间有任何性能差异。