Skip to content

Commit

Permalink
JENKINS-72466: Upgrades jbcrypt dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
andham committed Dec 29, 2023
1 parent 69e20db commit b2c49cb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ THE SOFTWARE.
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>org.connectbot.jbcrypt</groupId>
<groupId>org.connectbot</groupId>
<artifactId>jbcrypt</artifactId>
<version>1.0.0</version>
<version>1.0.2</version>
</dependency>
<dependency>
<!-- Groovy shell uses this, but it doesn't declare the dependency -->
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ THE SOFTWARE.
<artifactId>groovy-all</artifactId>
</dependency>
<dependency>
<groupId>org.connectbot.jbcrypt</groupId>
<groupId>org.connectbot</groupId>
<artifactId>jbcrypt</artifactId>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void timingPBKDF2() {
* or slow hardware, so this is commented out but left for ease of running locally when desired.
*/
//@Test
public void timingBcrypt() {
public void timingJBCrypt() {
// ignore the salt generation - check just matching....
JBCryptEncoder encoder = new JBCryptEncoder();
String encoded = encoder.encode("thisIsMyPassword1");
Expand Down Expand Up @@ -143,4 +143,12 @@ public void passwordPBKDF2HashWithInvalidKeySpec() throws Exception {
assertThrows(RuntimeException.class, () -> pbkdf2PasswordEncoder.matches("MySecurePassword", PBKDF2_HMAC_SHA512_ENCODED_PASSWORD));
}
}

@Test
public void testJBCryptPasswordMatching() {
JBCryptEncoder encoder = new JBCryptEncoder();
String encoded = encoder.encode("thisIsMyPassword");
assertTrue(encoder.matches("thisIsMyPassword", encoded));
assertFalse(encoder.matches("thisIsNotMyPassword", encoded));
}
}

0 comments on commit b2c49cb

Please sign in to comment.