mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-01 09:42:13 +00:00
AesBytesEncryptorTests Check Key Strength
Fixes: gh-6121
This commit is contained in:
parent
7232dabd48
commit
9ee291e659
@ -46,6 +46,7 @@ public class AesBytesEncryptorTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void roundtripWhenUsingDefaultsThenEncryptsAndDecrypts() {
|
public void roundtripWhenUsingDefaultsThenEncryptsAndDecrypts() {
|
||||||
|
CryptoAssumptions.assumeCBCJCE();
|
||||||
AesBytesEncryptor encryptor = new AesBytesEncryptor(this.password, this.hexSalt);
|
AesBytesEncryptor encryptor = new AesBytesEncryptor(this.password, this.hexSalt);
|
||||||
byte[] encryption = encryptor.encrypt(this.secret.getBytes());
|
byte[] encryption = encryptor.encrypt(this.secret.getBytes());
|
||||||
byte[] decryption = encryptor.decrypt(encryption);
|
byte[] decryption = encryptor.decrypt(encryption);
|
||||||
@ -54,6 +55,7 @@ public class AesBytesEncryptorTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void roundtripWhenUsingDefaultCipherThenEncryptsAndDecrypts() {
|
public void roundtripWhenUsingDefaultCipherThenEncryptsAndDecrypts() {
|
||||||
|
CryptoAssumptions.assumeCBCJCE();
|
||||||
AesBytesEncryptor encryptor = new AesBytesEncryptor(this.password, this.hexSalt, this.generator);
|
AesBytesEncryptor encryptor = new AesBytesEncryptor(this.password, this.hexSalt, this.generator);
|
||||||
byte[] encryption = encryptor.encrypt(this.secret.getBytes());
|
byte[] encryption = encryptor.encrypt(this.secret.getBytes());
|
||||||
assertThat(new String(Hex.encode(encryption)))
|
assertThat(new String(Hex.encode(encryption)))
|
||||||
@ -65,6 +67,7 @@ public class AesBytesEncryptorTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void roundtripWhenUsingGcmThenEncryptsAndDecrypts() {
|
public void roundtripWhenUsingGcmThenEncryptsAndDecrypts() {
|
||||||
|
CryptoAssumptions.assumeGCMJCE();
|
||||||
AesBytesEncryptor encryptor = new AesBytesEncryptor(this.password, this.hexSalt, this.generator, GCM);
|
AesBytesEncryptor encryptor = new AesBytesEncryptor(this.password, this.hexSalt, this.generator, GCM);
|
||||||
byte[] encryption = encryptor.encrypt(this.secret.getBytes());
|
byte[] encryption = encryptor.encrypt(this.secret.getBytes());
|
||||||
assertThat(new String(Hex.encode(encryption)))
|
assertThat(new String(Hex.encode(encryption)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user