handling null-values for salts properly now - fixes gh-4147
This commit is contained in:
committed by
Rob Winch
parent
f94399cff9
commit
09436649cc
@@ -14,10 +14,11 @@
|
||||
|
||||
package org.springframework.security.crypto.bcrypt;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* JUnit unit tests for BCrypt routines
|
||||
@@ -271,6 +272,11 @@ public class BCryptTests {
|
||||
assertThat(BCrypt.gensalt(31).startsWith("$2a$31$")).isTrue();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void hashpwFailsWhenSaltIsNull() {
|
||||
BCrypt.hashpw("password", null);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void hashpwFailsWhenSaltSpecifiesTooFewRounds() {
|
||||
BCrypt.hashpw("password", "$2a$03$......................");
|
||||
|
||||
Reference in New Issue
Block a user