【问题标题】:No such algorithm - bcrypt没有这样的算法 - bcrypt
【发布时间】:2016-06-09 05:22:11
【问题描述】:

我正在使用带有 bcrypt 的 Spring Security 来确保密码安全。

它实际上在 Grails 应用程序中。当应用程序启动时,我得到:

“没有这样的算法 [bcrypt]”

我将错误追溯到Spring security中的代码:

    try {
        return MessageDigest.getInstance(algorithm);
    }
    catch (NoSuchAlgorithmException e) {
        throw new IllegalArgumentException("No such algorithm [" + algorithm + "]");
    }

如何将 bcrypt 安装到 Java Security 中?

我在 CentOS 7 上运行 Oracle JDK 1.8.0_73-b02。

【问题讨论】:

标签: java spring grails java-security grails-3.1


【解决方案1】:

问题出在代码上:

messageDigestPasswordEncoder(MessageDigestPasswordEncoder, conf.password.algorithm) {
    encodeHashAsBase64 = conf.password.encodeHashAsBase64
    iterations = conf.password.hash.iterations
}

Grails 3 spring-core 插件默认配置 conf.password.algorithm="bcrypt"

我以为我在我的配置中覆盖了它,但那是在 Config.groovy 中。在 grails 3 中配置需要移动到 application.groovy

【讨论】:

    猜你喜欢
    • 2021-11-23
    • 2018-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多