From 740e8fd686a203b080abf1d09d93e9aa74a4eb5c Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Wed, 31 Oct 2018 20:42:03 -0700 Subject: [PATCH] watchtower/blob/justice_kit_test: remove external nonce The nonce is now passed in as the prefix to the ciphertext, and is generated randomly in calls to Encrypt. --- watchtower/blob/justice_kit_test.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/watchtower/blob/justice_kit_test.go b/watchtower/blob/justice_kit_test.go index 606e43e51..ba36f134a 100644 --- a/watchtower/blob/justice_kit_test.go +++ b/watchtower/blob/justice_kit_test.go @@ -163,15 +163,9 @@ func testBlobJusticeKitEncryptDecrypt(t *testing.T, test descriptorTest) { t.Fatalf("unable to generate blob encryption key: %v", err) } - nonce := make([]byte, blob.NonceSize) - _, err = io.ReadFull(rand.Reader, nonce) - if err != nil { - t.Fatalf("unable to generate nonce nonce: %v", err) - } - // Encrypt the blob plaintext using the generated key and // target version for this test. - ctxt, err := boj.Encrypt(nonce, key, test.encVersion) + ctxt, err := boj.Encrypt(key, test.encVersion) if err != test.encErr { t.Fatalf("unable to encrypt blob: %v", err) } else if test.encErr != nil { @@ -191,7 +185,7 @@ func testBlobJusticeKitEncryptDecrypt(t *testing.T, test descriptorTest) { // Decrypt the encrypted blob, reconstructing the original // blob plaintext from the decrypted contents. We use the target // decryption version specified by this test case. - boj2, err := blob.Decrypt(nonce, key, ctxt, test.decVersion) + boj2, err := blob.Decrypt(key, ctxt, test.decVersion) if err != test.decErr { t.Fatalf("unable to decrypt blob: %v", err) } else if test.decErr != nil {