登录密码解码

This commit is contained in:
zhaoyz 2024-04-12 18:39:28 +08:00
parent 23e1470ea6
commit a4adf0e6da
2 changed files with 15 additions and 5 deletions

View File

@ -54,10 +54,18 @@
</dependency>
<!-- 使用Hutool工具库中的加密模块 -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-crypto</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-crypto -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-crypto</artifactId>
<version>5.8.27</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15to18</artifactId>
<version>1.68</version>
</dependency>
</dependencies>
</project>

View File

@ -206,7 +206,9 @@ public class RaxDaoAuthenticationProvider extends AbstractUserDetailsAuthenticat
// 构建前端对应解密AES 因子
String key = SpringContextHolder.getBean(Environment.class)
.getProperty("gateway.encodeKey", "raxsraxsraxsraxs");
AES aes = new AES(Mode.CFB, Padding.NoPadding, new SecretKeySpec(key.getBytes(), "AES"),
/*AES aes = new AES(Mode.CFB, Padding.PKCS5Padding, new SecretKeySpec(key.getBytes(), "AES"),
new IvParameterSpec(key.getBytes()));*/
AES aes = new AES("CBC", "PKCS7Padding", new SecretKeySpec(key.getBytes(), "AES"),
new IvParameterSpec(key.getBytes()));
return aes.decryptStr(presentedPassword);
}