我试图在Jasypt中使用3DES,但出现异常。
但是当我使用默认算法时,效果很好
这是代码-
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<div id="root"></div>
这是个例外
public MyEncryptablePropertyResolver(Environment environment) {
char[] password = "password".toCharArray();
this.encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
config.setPasswordCharArray(password);
config.setAlgorithm("PBEWithMD5AndTripleDES");
config.setKeyObtentionIterations("1000");
config.setPoolSize(1);
config.setProviderName("SunJCE");
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
config.setStringOutputType("base64");
encryptor.setConfig(config);
}
答案 0 :(得分:0)
如果使用TripleDES,请确保已为JDK安装了Java密码学扩展。 http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html