Revert unnecessary merges on 6.0.x

This commit removes unnecessary main-branch merges starting from
8750608b5b and adds the following
needed commit(s) that were made afterward:

- 5dce82c48b
This commit is contained in:
Steve Riesenberg
2023-10-31 15:11:45 -05:00
parent e9d4223402
commit 9db33f33c7
676 changed files with 6306 additions and 43249 deletions

View File

@@ -390,7 +390,7 @@ public class BCryptTests {
Arrays.fill(ba, (byte) 0);
ba[i] = (byte) b;
String s = encode_base64(ba, 3);
assertThat(s).hasSize(4);
assertThat(s.length()).isEqualTo(4);
byte[] decoded = BCrypt.decode_base64(s, 3);
assertThat(decoded).isEqualTo(ba);
}

View File

@@ -20,6 +20,7 @@ import java.security.SecureRandom;
import java.util.Random;
import java.util.UUID;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -28,8 +29,6 @@ import org.springframework.security.crypto.encrypt.AesBytesEncryptor.CipherAlgor
import org.springframework.security.crypto.keygen.BytesKeyGenerator;
import org.springframework.security.crypto.keygen.KeyGenerators;
import static org.assertj.core.api.Assertions.assertThat;
public class BouncyCastleAesBytesEncryptorEquivalencyTests {
private byte[] testData;
@@ -97,11 +96,11 @@ public class BouncyCastleAesBytesEncryptorEquivalencyTests {
// and can decrypt back to the original input
byte[] leftEncrypted = left.encrypt(this.testData);
byte[] rightEncrypted = right.encrypt(this.testData);
assertThat(rightEncrypted).containsExactly(leftEncrypted);
Assertions.assertArrayEquals(leftEncrypted, rightEncrypted);
byte[] leftDecrypted = left.decrypt(leftEncrypted);
byte[] rightDecrypted = right.decrypt(rightEncrypted);
assertThat(leftDecrypted).containsExactly(this.testData);
assertThat(rightDecrypted).containsExactly(this.testData);
Assertions.assertArrayEquals(this.testData, leftDecrypted);
Assertions.assertArrayEquals(this.testData, rightDecrypted);
}
}
@@ -115,8 +114,8 @@ public class BouncyCastleAesBytesEncryptorEquivalencyTests {
byte[] rightEncrypted = right.encrypt(this.testData);
byte[] leftDecrypted = left.decrypt(rightEncrypted);
byte[] rightDecrypted = right.decrypt(leftEncrypted);
assertThat(leftDecrypted).containsExactly(this.testData);
assertThat(rightDecrypted).containsExactly(this.testData);
Assertions.assertArrayEquals(this.testData, leftDecrypted);
Assertions.assertArrayEquals(this.testData, rightDecrypted);
}
}

View File

@@ -20,13 +20,13 @@ import java.security.SecureRandom;
import java.util.UUID;
import org.bouncycastle.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.security.crypto.codec.Hex;
import org.springframework.security.crypto.keygen.KeyGenerators;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
public class BouncyCastleAesBytesEncryptorTests {
@@ -64,11 +64,11 @@ public class BouncyCastleAesBytesEncryptorTests {
private void generatesDifferentCipherTexts(BytesEncryptor bcEncryptor) {
byte[] encrypted1 = bcEncryptor.encrypt(this.testData);
byte[] encrypted2 = bcEncryptor.encrypt(this.testData);
assertThat(Arrays.areEqual(encrypted1, encrypted2)).isFalse();
Assertions.assertFalse(Arrays.areEqual(encrypted1, encrypted2));
byte[] decrypted1 = bcEncryptor.decrypt(encrypted1);
byte[] decrypted2 = bcEncryptor.decrypt(encrypted2);
assertThat(decrypted1).containsExactly(this.testData);
assertThat(decrypted2).containsExactly(this.testData);
Assertions.assertArrayEquals(this.testData, decrypted1);
Assertions.assertArrayEquals(this.testData, decrypted2);
}
@Test

View File

@@ -60,7 +60,7 @@ public class KeyGeneratorsTests {
public void string() {
StringKeyGenerator keyGenerator = KeyGenerators.string();
String hexStringKey = keyGenerator.generateKey();
assertThat(hexStringKey).hasSize(16);
assertThat(hexStringKey.length()).isEqualTo(16);
assertThat(Hex.decode(hexStringKey)).hasSize(8);
String hexStringKey2 = keyGenerator.generateKey();
assertThat(hexStringKey.equals(hexStringKey2)).isFalse();

View File

@@ -39,8 +39,8 @@ public class Pbkdf2PasswordEncoderTests {
// encode output is an hex coded String so with 2 chars per encoding result byte
// (ie. 1 char for 4 bits).
// The encoding result size is : (saltLength * 8) bits + hashWith bits.
assertThat(this.encoder.encode("password")).hasSize((8 * 8 + 256) / 4);
assertThat(this.encoderSalt16.encode("password")).hasSize((16 * 8 + 256) / 4);
assertThat(this.encoder.encode("password").length()).isEqualTo((8 * 8 + 256) / 4);
assertThat(this.encoderSalt16.encode("password").length()).isEqualTo((16 * 8 + 256) / 4);
}
@Test