No such algorithm - bcrypt

568 Views Asked by At

I'm using Spring Security with bcrypt for password security.

It's actually in a Grails application. When the application starts up I get:

"No such algorithm [bcrypt]"

I traced the error to the code in Spring security:

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

How do I install bcrypt into Java Security?

I'm running Oracle JDK 1.8.0_73-b02 on CentOS 7.

1

There are 1 best solutions below

0
On BEST ANSWER

The problem was the code:

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

By default the Grails 3 spring-core plugin configures conf.password.algorithm="bcrypt"

I thought I had overridden it in my config but that was in Config.groovy. In grails 3 config needs to be moved to application.groovy