Skip to content

Commit

Permalink
Apply spotless #837
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeeppler committed May 7, 2024
1 parent d581297 commit e489658
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
public class AesGcmSiv implements PersistenceCipher {

// TODO: Encrypt secret?
private SecretKey secret;
private Provider cryptoProvider;
private PersistenceCipherType cipherType;
Expand Down Expand Up @@ -66,7 +65,7 @@ public static AesGcmSiv create(BinaryString secret) throws InvalidKeyException {

instance = new AesGcmSiv(secretKey, cipherType);
} else {
throw new InvalidKeyException("The secret has to be 128, 192 or 256 bits long, but was " + (rawSecret.length * 8) + " bits long.");
throw new InvalidKeyException("The secret has to be 128 or 256 bits long, but was " + (rawSecret.length * 8) + " bits long.");
}

return instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static BinaryString createFromBytes(byte[] bytes, BinaryStringEncodingTyp
* @return
*/
public static BinaryString createFromString(String string) {
return createFromString(string, BinaryStringEncodingType.BASE64);
return createFromString(string, DEFAULT_ENCODING_TYPE);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,6 @@ public boolean isSecretRotationStrategy() {
}

public boolean isCipherRotationStrategy() {
return (currentCipher.getCipherType() != newCipher.getCipherType()) ? true : false;
return currentCipher.getCipherType() != newCipher.getCipherType();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void encrypt__aes_256_hex_format_and_emojis() throws InvalidKeyException, Invali
void encrypt__aes_128_base64_format_and_emojis() throws InvalidKeyException, InvalidAlgorithmParameterException {
/* prepare */
BinaryString secret = new Base64String("🍐🍌🍓🍉");
;

String plaintext = "Hello 👋, welcome to 🌐.";
String expectedCiphertext = "Qu7ICJBGMw9dAPPBWx86e5bjOq3YKC+x25n/YkluWZAGdSna08tKaE78pMk=";
BinaryString initializationVector = new Base64String("🧅".repeat(AesGcmSiv.IV_LENGTH_IN_BYTES / 4));
Expand Down

0 comments on commit e489658

Please sign in to comment.