From d6f2039bd1f0eec1534ab082eb36e68ab90d357b Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Tue, 30 Apr 2024 10:29:11 -0400 Subject: [PATCH] Update attachment cipher tests to use longer inputs. --- .../signalservice/api/crypto/AttachmentCipherTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libsignal-service/src/test/java/org/whispersystems/signalservice/api/crypto/AttachmentCipherTest.java b/libsignal-service/src/test/java/org/whispersystems/signalservice/api/crypto/AttachmentCipherTest.java index 8f992701b6..782c696c3e 100644 --- a/libsignal-service/src/test/java/org/whispersystems/signalservice/api/crypto/AttachmentCipherTest.java +++ b/libsignal-service/src/test/java/org/whispersystems/signalservice/api/crypto/AttachmentCipherTest.java @@ -39,7 +39,7 @@ public final class AttachmentCipherTest { } } - private static int MEBIBYTE = 1024 * 1024; + private static final int MEBIBYTE = 1024 * 1024; @Test public void attachment_encryptDecrypt_nonIncremental() throws IOException, InvalidMessageException { @@ -391,7 +391,7 @@ public final class AttachmentCipherTest { try { byte[] key = Util.getSecretBytes(64); - byte[] plaintextInput = "Uncle Ben".getBytes(); + byte[] plaintextInput = Util.getSecretBytes(MEBIBYTE); EncryptResult encryptResult = encryptData(plaintextInput, key, true); byte[] badMacCiphertext = Arrays.copyOf(encryptResult.ciphertext, encryptResult.ciphertext.length); @@ -418,7 +418,7 @@ public final class AttachmentCipherTest { assumeLibSignalSupportedOnOS(); byte[] packKey = Util.getSecretBytes(32); - byte[] plaintextInput = "Peter Parker".getBytes(); + byte[] plaintextInput = Util.getSecretBytes(MEBIBYTE); EncryptResult encryptResult = encryptData(plaintextInput, expandPackKey(packKey), true); InputStream inputStream = AttachmentCipherInputStream.createForStickerData(encryptResult.ciphertext, packKey); byte[] plaintextOutput = readInputStreamFully(inputStream); @@ -447,7 +447,7 @@ public final class AttachmentCipherTest { try { byte[] packKey = Util.getSecretBytes(32); - byte[] plaintextInput = "Gwen Stacy".getBytes(); + byte[] plaintextInput = Util.getSecretBytes(MEBIBYTE); EncryptResult encryptResult = encryptData(plaintextInput, expandPackKey(packKey), true); byte[] badPackKey = new byte[32]; @@ -467,7 +467,7 @@ public final class AttachmentCipherTest { try { byte[] packKey = Util.getSecretBytes(32); - byte[] plaintextInput = "Uncle Ben".getBytes(); + byte[] plaintextInput = Util.getSecretBytes(MEBIBYTE); EncryptResult encryptResult = encryptData(plaintextInput, expandPackKey(packKey), true); byte[] badMacCiphertext = Arrays.copyOf(encryptResult.ciphertext, encryptResult.ciphertext.length);