• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 The gRPC Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package io.grpc.alts.internal;
18 
19 import static com.google.common.truth.Truth.assertWithMessage;
20 
21 import com.google.common.io.BaseEncoding;
22 import java.nio.ByteBuffer;
23 import java.security.GeneralSecurityException;
24 import java.util.Arrays;
25 import org.junit.Test;
26 import org.junit.runner.RunWith;
27 import org.junit.runners.JUnit4;
28 
29 /** Unit tests for {@link AesGcmHkdfAeadCrypter}. */
30 @RunWith(JUnit4.class)
31 public final class AesGcmHkdfAeadCrypterTest {
32 
33   private static class TestVector {
34     final String comment;
35     final byte[] key;
36     final byte[] nonce;
37     final byte[] aad;
38     final byte[] plaintext;
39     final byte[] ciphertext;
40 
TestVector(TestVectorBuilder builder)41     TestVector(TestVectorBuilder builder) {
42       comment = builder.comment;
43       key = builder.key;
44       nonce = builder.nonce;
45       aad = builder.aad;
46       plaintext = builder.plaintext;
47       ciphertext = builder.ciphertext;
48     }
49 
builder()50     static TestVectorBuilder builder() {
51       return new TestVectorBuilder();
52     }
53   }
54 
55   private static class TestVectorBuilder {
56     String comment;
57     byte[] key;
58     byte[] nonce;
59     byte[] aad;
60     byte[] plaintext;
61     byte[] ciphertext;
62 
build()63     TestVector build() {
64       if (comment == null
65           && key == null
66           && nonce == null
67           && aad == null
68           && plaintext == null
69           && ciphertext == null) {
70         throw new IllegalStateException("All fields must be set before calling build().");
71       }
72       return new TestVector(this);
73     }
74 
withComment(String comment)75     TestVectorBuilder withComment(String comment) {
76       this.comment = comment;
77       return this;
78     }
79 
withKey(String key)80     TestVectorBuilder withKey(String key) {
81       this.key = BaseEncoding.base16().lowerCase().decode(key);
82       return this;
83     }
84 
withNonce(String nonce)85     TestVectorBuilder withNonce(String nonce) {
86       this.nonce = BaseEncoding.base16().lowerCase().decode(nonce);
87       return this;
88     }
89 
withAad(String aad)90     TestVectorBuilder withAad(String aad) {
91       this.aad = BaseEncoding.base16().lowerCase().decode(aad);
92       return this;
93     }
94 
withPlaintext(String plaintext)95     TestVectorBuilder withPlaintext(String plaintext) {
96       this.plaintext = BaseEncoding.base16().lowerCase().decode(plaintext);
97       return this;
98     }
99 
withCiphertext(String ciphertext)100     TestVectorBuilder withCiphertext(String ciphertext) {
101       this.ciphertext = BaseEncoding.base16().lowerCase().decode(ciphertext);
102       return this;
103     }
104   }
105 
106   @Test
testVectorEncrypt()107   public void testVectorEncrypt() throws GeneralSecurityException {
108     int i = 0;
109     for (TestVector testVector : testVectors) {
110       int bufferSize = testVector.ciphertext.length;
111       byte[] ciphertext = new byte[bufferSize];
112       ByteBuffer ciphertextBuffer = ByteBuffer.wrap(ciphertext);
113 
114       AesGcmHkdfAeadCrypter aeadCrypter = new AesGcmHkdfAeadCrypter(testVector.key);
115       aeadCrypter.encrypt(
116           ciphertextBuffer,
117           ByteBuffer.wrap(testVector.plaintext),
118           ByteBuffer.wrap(testVector.aad),
119           testVector.nonce);
120       String msg = "Failure for test vector " + i;
121       assertWithMessage(msg)
122           .that(ciphertextBuffer.remaining())
123           .isEqualTo(bufferSize - testVector.ciphertext.length);
124       byte[] exactCiphertext = Arrays.copyOf(ciphertext, testVector.ciphertext.length);
125       assertWithMessage(msg).that(exactCiphertext).isEqualTo(testVector.ciphertext);
126       i++;
127     }
128   }
129 
130   @Test
testVectorDecrypt()131   public void testVectorDecrypt() throws GeneralSecurityException {
132     int i = 0;
133     for (TestVector testVector : testVectors) {
134       // The plaintext buffer might require space for the tag to decrypt (e.g., for conscrypt).
135       int bufferSize = testVector.ciphertext.length;
136       byte[] plaintext = new byte[bufferSize];
137       ByteBuffer plaintextBuffer = ByteBuffer.wrap(plaintext);
138 
139       AesGcmHkdfAeadCrypter aeadCrypter = new AesGcmHkdfAeadCrypter(testVector.key);
140       aeadCrypter.decrypt(
141           plaintextBuffer,
142           ByteBuffer.wrap(testVector.ciphertext),
143           ByteBuffer.wrap(testVector.aad),
144           testVector.nonce);
145       String msg = "Failure for test vector " + i;
146       assertWithMessage(msg)
147           .that(plaintextBuffer.remaining())
148           .isEqualTo(bufferSize - testVector.plaintext.length);
149       byte[] exactPlaintext = Arrays.copyOf(plaintext, testVector.plaintext.length);
150       assertWithMessage(msg).that(exactPlaintext).isEqualTo(testVector.plaintext);
151       i++;
152     }
153   }
154 
155   /*
156    * NIST vectors from:
157    *  http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf
158    *
159    *  IEEE vectors from:
160    *  http://www.ieee802.org/1/files/public/docs2011/bn-randall-test-vectors-0511-v1.pdf
161    * Key expanded by setting
162    * expandedKey = (key||(key ^ {0x01, .., 0x01})||key ^ {0x02,..,0x02}))[0:44].
163    */
164   private static final TestVector[] testVectors =
165       new TestVector[] {
166         TestVector.builder()
167             .withComment("Derived from NIST test vector 1")
168             .withKey(
169                 "0000000000000000000000000000000001010101010101010101010101010101020202020202020202"
170                     + "020202")
171             .withNonce("000000000000000000000000")
172             .withAad("")
173             .withPlaintext("")
174             .withCiphertext("85e873e002f6ebdc4060954eb8675508")
175             .build(),
176         TestVector.builder()
177             .withComment("Derived from NIST test vector 2")
178             .withKey(
179                 "0000000000000000000000000000000001010101010101010101010101010101020202020202020202"
180                     + "020202")
181             .withNonce("000000000000000000000000")
182             .withAad("")
183             .withPlaintext("00000000000000000000000000000000")
184             .withCiphertext("51e9a8cb23ca2512c8256afff8e72d681aca19a1148ac115e83df4888cc00d11")
185             .build(),
186         TestVector.builder()
187             .withComment("Derived from NIST test vector 3")
188             .withKey(
189                 "feffe9928665731c6d6a8f9467308308fffee8938764721d6c6b8e9566318209fcfdeb908467711e6f"
190                     + "688d96")
191             .withNonce("cafebabefacedbaddecaf888")
192             .withAad("")
193             .withPlaintext(
194                 "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532f"
195                     + "cf0e2449a6b525b16aedf5aa0de657ba637b391aafd255")
196             .withCiphertext(
197                 "1018ed5a1402a86516d6576d70b2ffccca261b94df88b58f53b64dfba435d18b2f6e3b7869f9353d4a"
198                     + "c8cf09afb1663daa7b4017e6fc2c177c0c087c0df1162129952213cee1bc6e9c8495dd705e1f"
199                     + "3d")
200             .build(),
201         TestVector.builder()
202             .withComment("Derived from NIST test vector 4")
203             .withKey(
204                 "feffe9928665731c6d6a8f9467308308fffee8938764721d6c6b8e9566318209fcfdeb908467711e6f"
205                     + "688d96")
206             .withNonce("cafebabefacedbaddecaf888")
207             .withAad("feedfacedeadbeeffeedfacedeadbeefabaddad2")
208             .withPlaintext(
209                 "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532f"
210                     + "cf0e2449a6b525b16aedf5aa0de657ba637b39")
211             .withCiphertext(
212                 "1018ed5a1402a86516d6576d70b2ffccca261b94df88b58f53b64dfba435d18b2f6e3b7869f9353d4a"
213                     + "c8cf09afb1663daa7b4017e6fc2c177c0c087c4764565d077e9124001ddb27fc0848c5")
214             .build(),
215         TestVector.builder()
216             .withComment(
217                 "Derived from adapted NIST test vector 4"
218                     + " for KDF counter boundary (flip nonce bit 15)")
219             .withKey(
220                 "feffe9928665731c6d6a8f9467308308fffee8938764721d6c6b8e9566318209fcfdeb908467711e6f"
221                     + "688d96")
222             .withNonce("ca7ebabefacedbaddecaf888")
223             .withAad("feedfacedeadbeeffeedfacedeadbeefabaddad2")
224             .withPlaintext(
225                 "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532f"
226                     + "cf0e2449a6b525b16aedf5aa0de657ba637b39")
227             .withCiphertext(
228                 "e650d3c0fb879327f2d03287fa93cd07342b136215adbca00c3bd5099ec41832b1d18e0423ed26bb12"
229                     + "c6cd09debb29230a94c0cee15903656f85edb6fc509b1b28216382172ecbcc31e1e9b1")
230             .build(),
231         TestVector.builder()
232             .withComment(
233                 "Derived from adapted NIST test vector 4"
234                     + " for KDF counter boundary (flip nonce bit 16)")
235             .withKey(
236                 "feffe9928665731c6d6a8f9467308308fffee8938764721d6c6b8e9566318209fcfdeb908467711e6f"
237                     + "688d96")
238             .withNonce("cafebbbefacedbaddecaf888")
239             .withAad("feedfacedeadbeeffeedfacedeadbeefabaddad2")
240             .withPlaintext(
241                 "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532f"
242                     + "cf0e2449a6b525b16aedf5aa0de657ba637b39")
243             .withCiphertext(
244                 "c0121e6c954d0767f96630c33450999791b2da2ad05c4190169ccad9ac86ff1c721e3d82f2ad22ab46"
245                     + "3bab4a0754b7dd68ca4de7ea2531b625eda01f89312b2ab957d5c7f8568dd95fcdcd1f")
246             .build(),
247         TestVector.builder()
248             .withComment(
249                 "Derived from adapted NIST test vector 4"
250                     + " for KDF counter boundary (flip nonce bit 63)")
251             .withKey(
252                 "feffe9928665731c6d6a8f9467308308fffee8938764721d6c6b8e9566318209fcfdeb908467711e6f"
253                     + "688d96")
254             .withNonce("cafebabefacedb2ddecaf888")
255             .withAad("feedfacedeadbeeffeedfacedeadbeefabaddad2")
256             .withPlaintext(
257                 "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532f"
258                     + "cf0e2449a6b525b16aedf5aa0de657ba637b39")
259             .withCiphertext(
260                 "8af37ea5684a4d81d4fd817261fd9743099e7e6a025eaacf8e54b124fb5743149e05cb89f4a49467fe"
261                     + "2e5e5965f29a19f99416b0016b54585d12553783ba59e9f782e82e097c336bf7989f08")
262             .build(),
263         TestVector.builder()
264             .withComment(
265                 "Derived from adapted NIST test vector 4"
266                     + " for KDF counter boundary (flip nonce bit 64)")
267             .withKey(
268                 "feffe9928665731c6d6a8f9467308308fffee8938764721d6c6b8e9566318209fcfdeb908467711e6f"
269                     + "688d96")
270             .withNonce("cafebabefacedbaddfcaf888")
271             .withAad("feedfacedeadbeeffeedfacedeadbeefabaddad2")
272             .withPlaintext(
273                 "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532f"
274                     + "cf0e2449a6b525b16aedf5aa0de657ba637b39")
275             .withCiphertext(
276                 "fbd528448d0346bfa878634864d407a35a039de9db2f1feb8e965b3ae9356ce6289441d77f8f0df294"
277                     + "891f37ea438b223e3bf2bdc53d4c5a74fb680bb312a8dec6f7252cbcd7f5799750ad78")
278             .build(),
279         TestVector.builder()
280             .withComment("Derived from IEEE 2.1.1 54-byte auth")
281             .withKey(
282                 "ad7a2bd03eac835a6f620fdcb506b345ac7b2ad13fad825b6e630eddb407b244af7829d23cae81586d"
283                     + "600dde")
284             .withNonce("12153524c0895e81b2c28465")
285             .withAad(
286                 "d609b1f056637a0d46df998d88e5222ab2c2846512153524c0895e8108000f10111213141516171819"
287                     + "1a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233340001")
288             .withPlaintext("")
289             .withCiphertext("3ea0b584f3c85e93f9320ea591699efb")
290             .build(),
291         TestVector.builder()
292             .withComment("Derived from IEEE 2.1.2 54-byte auth")
293             .withKey(
294                 "e3c08a8f06c6e3ad95a70557b23f75483ce33021a9c72b7025666204c69c0b72e1c2888d04c4e1af97"
295                     + "a50755")
296             .withNonce("12153524c0895e81b2c28465")
297             .withAad(
298                 "d609b1f056637a0d46df998d88e5222ab2c2846512153524c0895e8108000f10111213141516171819"
299                     + "1a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233340001")
300             .withPlaintext("")
301             .withCiphertext("294e028bf1fe6f14c4e8f7305c933eb5")
302             .build(),
303         TestVector.builder()
304             .withComment("Derived from IEEE 2.2.1 60-byte crypt")
305             .withKey(
306                 "ad7a2bd03eac835a6f620fdcb506b345ac7b2ad13fad825b6e630eddb407b244af7829d23cae81586d"
307                     + "600dde")
308             .withNonce("12153524c0895e81b2c28465")
309             .withAad("d609b1f056637a0d46df998d88e52e00b2c2846512153524c0895e81")
310             .withPlaintext(
311                 "08000f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435"
312                     + "363738393a0002")
313             .withCiphertext(
314                 "db3d25719c6b0a3ca6145c159d5c6ed9aff9c6e0b79f17019ea923b8665ddf52137ad611f0d1bf417a"
315                     + "7ca85e45afe106ff9c7569d335d086ae6c03f00987ccd6")
316             .build(),
317         TestVector.builder()
318             .withComment("Derived from IEEE 2.2.2 60-byte crypt")
319             .withKey(
320                 "e3c08a8f06c6e3ad95a70557b23f75483ce33021a9c72b7025666204c69c0b72e1c2888d04c4e1af97"
321                     + "a50755")
322             .withNonce("12153524c0895e81b2c28465")
323             .withAad("d609b1f056637a0d46df998d88e52e00b2c2846512153524c0895e81")
324             .withPlaintext(
325                 "08000f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435"
326                     + "363738393a0002")
327             .withCiphertext(
328                 "1641f28ec13afcc8f7903389787201051644914933e9202bb9d06aa020c2a67ef51dfe7bc00a856c55"
329                     + "b8f8133e77f659132502bad63f5713d57d0c11e0f871ed")
330             .build(),
331         TestVector.builder()
332             .withComment("Derived from IEEE 2.3.1 60-byte auth")
333             .withKey(
334                 "071b113b0ca743fecccf3d051f737382061a103a0da642ffcdce3c041e727283051913390ea541fcce"
335                     + "cd3f07")
336             .withNonce("f0761e8dcd3d000176d457ed")
337             .withAad(
338                 "e20106d7cd0df0761e8dcd3d88e5400076d457ed08000f101112131415161718191a1b1c1d1e1f2021"
339                     + "22232425262728292a2b2c2d2e2f303132333435363738393a0003")
340             .withPlaintext("")
341             .withCiphertext("58837a10562b0f1f8edbe58ca55811d3")
342             .build(),
343         TestVector.builder()
344             .withComment("Derived from IEEE 2.3.2 60-byte auth")
345             .withKey(
346                 "691d3ee909d7f54167fd1ca0b5d769081f2bde1aee655fdbab80bd5295ae6be76b1f3ceb0bd5f74365"
347                     + "ff1ea2")
348             .withNonce("f0761e8dcd3d000176d457ed")
349             .withAad(
350                 "e20106d7cd0df0761e8dcd3d88e5400076d457ed08000f101112131415161718191a1b1c1d1e1f2021"
351                     + "22232425262728292a2b2c2d2e2f303132333435363738393a0003")
352             .withPlaintext("")
353             .withCiphertext("c2722ff6ca29a257718a529d1f0c6a3b")
354             .build(),
355         TestVector.builder()
356             .withComment("Derived from IEEE 2.4.1 54-byte crypt")
357             .withKey(
358                 "071b113b0ca743fecccf3d051f737382061a103a0da642ffcdce3c041e727283051913390ea541fcce"
359                     + "cd3f07")
360             .withNonce("f0761e8dcd3d000176d457ed")
361             .withAad("e20106d7cd0df0761e8dcd3d88e54c2a76d457ed")
362             .withPlaintext(
363                 "08000f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333400"
364                     + "04")
365             .withCiphertext(
366                 "fd96b715b93a13346af51e8acdf792cdc7b2686f8574c70e6b0cbf16291ded427ad73fec48cd298e05"
367                     + "28a1f4c644a949fc31dc9279706ddba33f")
368             .build(),
369         TestVector.builder()
370             .withComment("Derived from IEEE 2.4.2 54-byte crypt")
371             .withKey(
372                 "691d3ee909d7f54167fd1ca0b5d769081f2bde1aee655fdbab80bd5295ae6be76b1f3ceb0bd5f74365"
373                     + "ff1ea2")
374             .withNonce("f0761e8dcd3d000176d457ed")
375             .withAad("e20106d7cd0df0761e8dcd3d88e54c2a76d457ed")
376             .withPlaintext(
377                 "08000f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333400"
378                     + "04")
379             .withCiphertext(
380                 "b68f6300c2e9ae833bdc070e24021a3477118e78ccf84e11a485d861476c300f175353d5cdf92008a4"
381                     + "f878e6cc3577768085c50a0e98fda6cbb8")
382             .build(),
383         TestVector.builder()
384             .withComment("Derived from IEEE 2.5.1 65-byte auth")
385             .withKey(
386                 "013fe00b5f11be7f866d0cbbc55a7a90003ee10a5e10bf7e876c0dbac45b7b91033de2095d13bc7d84"
387                     + "6f0eb9")
388             .withNonce("7cfde9f9e33724c68932d612")
389             .withAad(
390                 "84c5d513d2aaf6e5bbd2727788e523008932d6127cfde9f9e33724c608000f10111213141516171819"
391                     + "1a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
392                     + "0005")
393             .withPlaintext("")
394             .withCiphertext("cca20eecda6283f09bb3543dd99edb9b")
395             .build(),
396         TestVector.builder()
397             .withComment("Derived from IEEE 2.5.2 65-byte auth")
398             .withKey(
399                 "83c093b58de7ffe1c0da926ac43fb3609ac1c80fee1b624497ef942e2f79a82381c291b78fe5fde3c2"
400                     + "d89068")
401             .withNonce("7cfde9f9e33724c68932d612")
402             .withAad(
403                 "84c5d513d2aaf6e5bbd2727788e523008932d6127cfde9f9e33724c608000f10111213141516171819"
404                     + "1a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
405                     + "0005")
406             .withPlaintext("")
407             .withCiphertext("b232cc1da5117bf15003734fa599d271")
408             .build(),
409         TestVector.builder()
410             .withComment("Derived from IEEE  2.6.1 61-byte crypt")
411             .withKey(
412                 "013fe00b5f11be7f866d0cbbc55a7a90003ee10a5e10bf7e876c0dbac45b7b91033de2095d13bc7d84"
413                     + "6f0eb9")
414             .withNonce("7cfde9f9e33724c68932d612")
415             .withAad("84c5d513d2aaf6e5bbd2727788e52f008932d6127cfde9f9e33724c6")
416             .withPlaintext(
417                 "08000f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435"
418                     + "363738393a3b0006")
419             .withCiphertext(
420                 "ff1910d35ad7e5657890c7c560146fd038707f204b66edbc3d161f8ace244b985921023c436e3a1c35"
421                     + "32ecd5d09a056d70be583f0d10829d9387d07d33d872e490")
422             .build(),
423         TestVector.builder()
424             .withComment("Derived from IEEE 2.6.2 61-byte crypt")
425             .withKey(
426                 "83c093b58de7ffe1c0da926ac43fb3609ac1c80fee1b624497ef942e2f79a82381c291b78fe5fde3c2"
427                     + "d89068")
428             .withNonce("7cfde9f9e33724c68932d612")
429             .withAad("84c5d513d2aaf6e5bbd2727788e52f008932d6127cfde9f9e33724c6")
430             .withPlaintext(
431                 "08000f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435"
432                     + "363738393a3b0006")
433             .withCiphertext(
434                 "0db4cf956b5f97eca4eab82a6955307f9ae02a32dd7d93f83d66ad04e1cfdc5182ad12abdea5bbb619"
435                     + "a1bd5fb9a573590fba908e9c7a46c1f7ba0905d1b55ffda4")
436             .build(),
437         TestVector.builder()
438             .withComment("Derived from IEEE 2.7.1 79-byte crypt")
439             .withKey(
440                 "88ee087fd95da9fbf6725aa9d757b0cd89ef097ed85ca8faf7735ba8d656b1cc8aec0a7ddb5fabf9f4"
441                     + "7058ab")
442             .withNonce("7ae8e2ca4ec500012e58495c")
443             .withAad(
444                 "68f2e77696ce7ae8e2ca4ec588e541002e58495c08000f101112131415161718191a1b1c1d1e1f2021"
445                     + "22232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f4041424344454647"
446                     + "48494a4b4c4d0007")
447             .withPlaintext("")
448             .withCiphertext("813f0e630f96fb2d030f58d83f5cdfd0")
449             .build(),
450         TestVector.builder()
451             .withComment("Derived from IEEE 2.7.2 79-byte crypt")
452             .withKey(
453                 "4c973dbc7364621674f8b5b89e5c15511fced9216490fb1c1a2caa0ffe0407e54e953fbe7166601476"
454                     + "fab7ba")
455             .withNonce("7ae8e2ca4ec500012e58495c")
456             .withAad(
457                 "68f2e77696ce7ae8e2ca4ec588e541002e58495c08000f101112131415161718191a1b1c1d1e1f2021"
458                     + "22232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f4041424344454647"
459                     + "48494a4b4c4d0007")
460             .withPlaintext("")
461             .withCiphertext("77e5a44c21eb07188aacbd74d1980e97")
462             .build(),
463         TestVector.builder()
464             .withComment("Derived from IEEE 2.8.1 61-byte crypt")
465             .withKey(
466                 "88ee087fd95da9fbf6725aa9d757b0cd89ef097ed85ca8faf7735ba8d656b1cc8aec0a7ddb5fabf9f4"
467                     + "7058ab")
468             .withNonce("7ae8e2ca4ec500012e58495c")
469             .withAad("68f2e77696ce7ae8e2ca4ec588e54d002e58495c")
470             .withPlaintext(
471                 "08000f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435"
472                     + "363738393a3b3c3d3e3f404142434445464748490008")
473             .withCiphertext(
474                 "958ec3f6d60afeda99efd888f175e5fcd4c87b9bcc5c2f5426253a8b506296c8c43309ab2adb593946"
475                     + "2541d95e80811e04e706b1498f2c407c7fb234f8cc01a647550ee6b557b35a7e3945381821"
476                     + "f4")
477             .build(),
478         TestVector.builder()
479             .withComment("Derived from IEEE 2.8.2 61-byte crypt")
480             .withKey(
481                 "4c973dbc7364621674f8b5b89e5c15511fced9216490fb1c1a2caa0ffe0407e54e953fbe7166601476"
482                     + "fab7ba")
483             .withNonce("7ae8e2ca4ec500012e58495c")
484             .withAad("68f2e77696ce7ae8e2ca4ec588e54d002e58495c")
485             .withPlaintext(
486                 "08000f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435"
487                     + "363738393a3b3c3d3e3f404142434445464748490008")
488             .withCiphertext(
489                 "b44d072011cd36d272a9b7a98db9aa90cbc5c67b93ddce67c854503214e2e896ec7e9db649ed4bcf6f"
490                     + "850aac0223d0cf92c83db80795c3a17ecc1248bb00591712b1ae71e268164196252162810b"
491                     + "00")
492             .build()
493       };
494 }
495