ulisesbocchio / jasypt-spring-boot

Jasypt integration for Spring boot
MIT License
2.87k stars 514 forks source link

NoSuchAlgorithmException: SHA1PRNG SecureRandom not available #384

Open ping-hsiu-chiang opened 6 months ago

ping-hsiu-chiang commented 6 months ago

An exception occurred in the runtime environment. Caused by: java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available I'm not sure if it's caused by FIPS being enabled.

tsunejui commented 6 months ago

An exception occurred in the runtime environment. Caused by: java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available I'm not sure if it's caused by FIPS being enabled.

The same issue occurs in my application after enabling FIPS mode. It seems that the RandomSaltGenerator class defaults to using SHA1PRNG, and might not be supported in FIPS mode anymore.

https://github.com/tfredrich/jasypt/blob/master/jasypt/src/main/java/org/jasypt/salt/RandomSaltGenerator.java#L52

    /**
     * The default algorithm to be used for secure random number 
     * generation: set to SHA1PRNG.
     */
    public static final String DEFAULT_SECURE_RANDOM_ALGORITHM = "SHA1PRNG";

    private final SecureRandom random;

    /**
     * Creates a new instance of <tt>RandomSaltGenerator</tt> using the 
     * default secure random number generation algorithm.
     */
    public RandomSaltGenerator() {
        this(DEFAULT_SECURE_RANDOM_ALGORITHM);
    }