SSHA512 加密并匹配 spring 5
SSHA512 Encryption and matches with spring 5
我正在使用现有的 LDAP 实现 spring 安全性,其中密码是 SSHA512 编码的。已弃用的 LdapShaEncoder 仅支持 {SHA} 和 {SSHA}。
任何人都可以帮助我实现 java SSHA512 编码器以及 Spring 安全性。或者是否有任何图书馆可以完成这项工作?
import org.springframework.security.crypto.password.LdapShaPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
@Bean
public PasswordEncoder passwordEncoder() {
return new LdapShaPasswordEncoder();
}
异常:
java.lang.IllegalArgumentException: Unsupported password prefix '{SSHA512}'
at org.springframework.security.crypto.password.LdapShaPasswordEncoder.matches(LdapShaPasswordEncoder.java:173) ~[spring-security-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.security.crypto.password.LdapShaPasswordEncoder.matches(LdapShaPasswordEncoder.java:158) ~[spring-security-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.security.authentication.dao.DaoAuthenticationProvider.additionalAuthenticationChecks(DaoAuthenticationProvider.java:90) ~[spring-security-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:166) ~[spring-security-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
看这里:https://github.com/lathspell/java_test/tree/master/java_test_openldap
我基本上只是在 MessageDigest.getInstance() 中通过 SHA-512 交换了 SHA,并调整了前缀和长度常量。
我正在使用现有的 LDAP 实现 spring 安全性,其中密码是 SSHA512 编码的。已弃用的 LdapShaEncoder 仅支持 {SHA} 和 {SSHA}。
任何人都可以帮助我实现 java SSHA512 编码器以及 Spring 安全性。或者是否有任何图书馆可以完成这项工作?
import org.springframework.security.crypto.password.LdapShaPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
@Bean
public PasswordEncoder passwordEncoder() {
return new LdapShaPasswordEncoder();
}
异常:
java.lang.IllegalArgumentException: Unsupported password prefix '{SSHA512}'
at org.springframework.security.crypto.password.LdapShaPasswordEncoder.matches(LdapShaPasswordEncoder.java:173) ~[spring-security-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.security.crypto.password.LdapShaPasswordEncoder.matches(LdapShaPasswordEncoder.java:158) ~[spring-security-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.security.authentication.dao.DaoAuthenticationProvider.additionalAuthenticationChecks(DaoAuthenticationProvider.java:90) ~[spring-security-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:166) ~[spring-security-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
看这里:https://github.com/lathspell/java_test/tree/master/java_test_openldap 我基本上只是在 MessageDigest.getInstance() 中通过 SHA-512 交换了 SHA,并调整了前缀和长度常量。