Path: blob/master/test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMBufferTest.java
41161 views
/*1* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @summary Use Cipher update and doFinal with a mixture of byte[], bytebuffer,26* and offset while verifying return values. Also using different and27* in-place buffers.28*29* in-place is not tested with different buffer types as it is not a logical30* scenario and is complicated by getOutputSize calculations.31*/3233import javax.crypto.Cipher;34import javax.crypto.SecretKey;35import javax.crypto.spec.GCMParameterSpec;36import javax.crypto.spec.SecretKeySpec;37import java.io.ByteArrayOutputStream;38import java.math.BigInteger;39import java.nio.ByteBuffer;40import java.security.SecureRandom;41import java.util.Arrays;42import java.util.HashMap;43import java.util.List;4445public class GCMBufferTest implements Cloneable {4647// Data type for the operation48enum dtype { BYTE, HEAP, DIRECT };49// Data map50static HashMap<String, List<Data>> datamap = new HashMap<>();51// List of enum values for order of operation52List<dtype> ops;5354static final int AESBLOCK = 16;55// The remaining input data length is inserted at the particular index56// in sizes[] during execution.57static final int REMAINDER = -1;5859String algo;60boolean same = true;61int[] sizes;62boolean incremental = false;63// In some cases the theoretical check is too complicated to verify64boolean theoreticalCheck;65List<Data> dataSet;66int inOfs = 0, outOfs = 0;6768static class Data {69int id;70SecretKey key;71byte[] iv;72byte[] pt;73byte[] aad;74byte[] ct;75byte[] tag;7677Data(String keyalgo, int id, String key, String iv, byte[] pt, String aad,78String ct, String tag) {79this.id = id;80this.key = new SecretKeySpec(HexToBytes(key), keyalgo);81this.iv = HexToBytes(iv);82this.pt = pt;83this.aad = HexToBytes(aad);84this.ct = HexToBytes(ct);85this.tag = HexToBytes(tag);86}8788Data(String keyalgo, int id, String key, String iv, String pt, String aad,89String ct, String tag) {90this(keyalgo, id, key, iv, HexToBytes(pt), aad, ct, tag);91}9293Data(String keyalgo, int id, String key, int ptlen) {94this.id = id;95this.key = new SecretKeySpec(HexToBytes(key), keyalgo);96iv = new byte[16];97pt = new byte[ptlen];98tag = new byte[12];99aad = new byte[0];100byte[] tct = null;101try {102SecureRandom r = new SecureRandom();103r.nextBytes(iv);104r.nextBytes(pt);105Cipher c = Cipher.getInstance("AES/GCM/NoPadding");106c.init(Cipher.ENCRYPT_MODE, this.key,107new GCMParameterSpec(tag.length * 8, this.iv));108tct = c.doFinal(pt);109} catch (Exception e) {110System.out.println("Error in generating data for length " +111ptlen);112}113ct = new byte[ptlen];114System.arraycopy(tct, 0, ct, 0, ct.length);115System.arraycopy(tct, ct.length, tag, 0, tag.length);116}117118}119120/**121* Construct a test with an algorithm and a list of dtype.122* @param algo Algorithm string123* @param ops List of dtypes. If only one dtype is specified, only a124* doFinal operation will occur. If multiple dtypes are125* specified, the last is a doFinal, the others are updates.126*/127GCMBufferTest(String algo, List<dtype> ops) {128this.algo = algo;129this.ops = ops;130theoreticalCheck = true;131dataSet = datamap.get(algo);132}133134public GCMBufferTest clone() throws CloneNotSupportedException{135return (GCMBufferTest)super.clone();136}137138/**139* Define particular data sizes to be tested. "REMAINDER", which has a140* value of -1, can be used to insert the remaining input text length at141* that index during execution.142* @param sizes Data sizes for each dtype in the list.143*/144GCMBufferTest dataSegments(int[] sizes) {145this.sizes = sizes;146return this;147}148149/**150* Do not perform in-place operations151*/152GCMBufferTest differentBufferOnly() {153this.same = false;154return this;155}156157/**158* Enable incrementing through each data size available. This can only be159* used when the List has more than one dtype entry.160*/161GCMBufferTest incrementalSegments() {162this.incremental = true;163return this;164}165166/**167* Specify a particular test dataset.168*169* @param id id value for the test data to used in this test.170*/171GCMBufferTest dataSet(int id) throws Exception {172for (Data d : datamap.get(algo)) {173if (d.id == id) {174dataSet = List.of(d);175return this;176}177}178throw new Exception("Unaeble to find dataSet id = " + id);179}180181/**182* Set both input and output offsets to the same offset183* @param offset value for inOfs and outOfs184* @return185*/186GCMBufferTest offset(int offset) {187this.inOfs = offset;188this.outOfs = offset;189return this;190}191192/**193* Set the input offset194* @param offset value for input offset195* @return196*/197GCMBufferTest inOfs(int offset) {198this.inOfs = offset;199return this;200}201202/**203* Set the output offset204* @param offset value for output offset205* @return206*/207GCMBufferTest outOfs(int offset) {208this.outOfs = offset;209return this;210}211212/**213* Reverse recursive loop that starts at the end-1 index, going to 0, in214* the size array to calculate all the possible sizes.215* It returns the remaining data size not used in the loop. This remainder216* is used for the end index which is the doFinal op.217*/218int inc(int index, int max, int total) {219if (sizes[index] == max - total) {220sizes[index + 1]++;221total++;222sizes[index] = 0;223} else if (index == 0) {224sizes[index]++;225}226227total += sizes[index];228if (index > 0) {229return inc(index - 1, max, total);230}231return total;232}233234// Call recursive loop and take returned remainder value for last index235boolean incrementSizes(int max) {236sizes[ops.size() - 1] = max - inc(ops.size() - 2, max, 0);237if (sizes[ops.size() - 2] == max) {238// We are at the end, exit test loop239return false;240}241return true;242}243244void test() throws Exception {245int i = 1;246System.out.println("Algo: " + algo + " \tOps: " + ops.toString());247for (Data data : dataSet) {248249// If incrementalSegments is enabled, run through that test only250if (incremental) {251if (ops.size() < 2) {252throw new Exception("To do incrementalSegments you must" +253"have more that 1 dtype in the list");254}255sizes = new int[ops.size()];256257while (incrementSizes(data.pt.length)) {258System.out.print("Encrypt: Data Index: " + i + " \tSizes[ ");259for (int v : sizes) {260System.out.print(v + " ");261}262System.out.println("]");263encrypt(data);264}265Arrays.fill(sizes, 0);266267while (incrementSizes(data.ct.length + data.tag.length)) {268System.out.print("Decrypt: Data Index: " + i + " \tSizes[ ");269for (int v : sizes) {270System.out.print(v + " ");271}272System.out.println("]");273decrypt(data);274}275276} else {277// Default test of 0 and 2 offset doing in place and different278// i/o buffers279System.out.println("Encrypt: Data Index: " + i);280encrypt(data);281282System.out.println("Decrypt: Data Index: " + i);283decrypt(data);284}285i++;286}287}288289// Setup data for encryption290void encrypt(Data data) throws Exception {291byte[] input, output;292293input = data.pt;294output = new byte[data.ct.length + data.tag.length];295System.arraycopy(data.ct, 0, output, 0, data.ct.length);296System.arraycopy(data.tag, 0, output, data.ct.length,297data.tag.length);298299// Test different input/output buffers300System.out.println("\tinput len: " + input.length + " inOfs " +301inOfs + " outOfs " + outOfs + " in/out buffer: different");302crypto(true, data, input, output);303304// Test with in-place buffers305if (same) {306System.out.println("\tinput len: " + input.length + " inOfs " +307inOfs + " outOfs " + outOfs + " in/out buffer: in-place");308cryptoSameBuffer(true, data, input, output);309}310}311312// Setup data for decryption313void decrypt(Data data) throws Exception {314byte[] input, output;315316input = new byte[data.ct.length + data.tag.length];317System.arraycopy(data.ct, 0, input, 0, data.ct.length);318System.arraycopy(data.tag, 0, input, data.ct.length, data.tag.length);319output = data.pt;320321// Test different input/output buffers322System.out.println("\tinput len: " + input.length + " inOfs " +323inOfs + " outOfs " + outOfs + " in-place: different");324crypto(false, data, input, output);325326// Test with in-place buffers327if (same) {328System.out.println("\tinput len: " + input.length + " inOfs " +329inOfs + " outOfs " + outOfs + " in-place: same");330cryptoSameBuffer(false, data, input, output);331}332}333334/**335* Perform cipher operation using different input and output buffers.336* This method allows mixing of data types (byte, heap, direct).337*/338void crypto(boolean encrypt, Data d, byte[] input, byte[] output)339throws Exception {340byte[] pt = new byte[input.length + inOfs];341System.arraycopy(input, 0, pt, inOfs, input.length);342byte[] expectedOut = new byte[output.length + outOfs];343System.arraycopy(output, 0, expectedOut, outOfs, output.length);344int plen = input.length / ops.size(); // partial input length345int theoreticallen;// expected output length346int dataoffset = 0; // offset of unconsumed data in pt347int index = 0; // index of which op we are on348int rlen; // result length349int pbuflen = 0; // plen remaining in the GCM internal buffers350351Cipher cipher = Cipher.getInstance(algo);352cipher.init((encrypt ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE),353d.key, new GCMParameterSpec(d.tag.length * 8, d.iv));354cipher.updateAAD(d.aad);355356ByteArrayOutputStream ba = new ByteArrayOutputStream();357ba.write(new byte[outOfs], 0, outOfs);358for (dtype v : ops) {359if (index < ops.size() - 1) {360if (sizes != null && input.length > 0) {361if (sizes[index] == -1) {362plen = input.length - dataoffset;363} else {364if (sizes[index] > input.length) {365plen = input.length;366} else {367plen = sizes[index];368}369}370}371372int olen = cipher.getOutputSize(plen) + outOfs;373374/*375* The theoretical limit is the length of the data sent to376* update() + any data might be setting in CipherCore or GCM377* internal buffers % the block size.378*/379theoreticallen = (plen + pbuflen) - ((plen + pbuflen) % AESBLOCK);380381// Update operations382switch (v) {383case BYTE -> {384byte[] out = new byte[olen];385rlen = cipher.update(pt, dataoffset + inOfs, plen, out,386outOfs);387ba.write(out, outOfs, rlen);388}389case HEAP -> {390ByteBuffer b = ByteBuffer.allocate(plen + outOfs);391b.position(outOfs);392b.put(pt, dataoffset + inOfs, plen);393b.flip();394b.position(outOfs);395ByteBuffer out = ByteBuffer.allocate(olen);396out.position(outOfs);397rlen = cipher.update(b, out);398ba.write(out.array(), outOfs, rlen);399}400case DIRECT -> {401ByteBuffer b = ByteBuffer.allocateDirect(plen + outOfs);402b.position(outOfs);403b.put(pt, dataoffset + inOfs, plen);404b.flip();405b.position(outOfs);406ByteBuffer out = ByteBuffer.allocateDirect(olen);407out.position(outOfs);408rlen = cipher.update(b, out);409byte[] o = new byte[rlen];410out.flip();411out.position(outOfs);412out.get(o, 0, rlen);413ba.write(o);414}415default -> throw new Exception("Unknown op: " + v.name());416}417418if (theoreticalCheck) {419pbuflen += plen - rlen;420if (encrypt && rlen != theoreticallen) {421throw new Exception("Wrong update return len (" +422v.name() + "): " + "rlen=" + rlen +423", expected output len=" + theoreticallen);424}425}426427dataoffset += plen;428index++;429430} else {431// doFinal operation432plen = input.length - dataoffset;433434int olen = cipher.getOutputSize(plen) + outOfs;435switch (v) {436case BYTE -> {437byte[] out = new byte[olen];438rlen = cipher.doFinal(pt, dataoffset + inOfs,439plen, out, outOfs);440ba.write(out, outOfs, rlen);441}442case HEAP -> {443ByteBuffer b = ByteBuffer.allocate(plen + inOfs);444b.limit(b.capacity());445b.position(inOfs);446b.put(pt, dataoffset + inOfs, plen);447b.flip();448b.position(inOfs);449ByteBuffer out = ByteBuffer.allocate(olen);450out.limit(out.capacity());451out.position(outOfs);452rlen = cipher.doFinal(b, out);453ba.write(out.array(), outOfs, rlen);454}455case DIRECT -> {456ByteBuffer b = ByteBuffer.allocateDirect(plen + inOfs);457b.limit(b.capacity());458b.position(inOfs);459b.put(pt, dataoffset + inOfs, plen);460b.flip();461b.position(inOfs);462ByteBuffer out = ByteBuffer.allocateDirect(olen);463out.limit(out.capacity());464out.position(outOfs);465rlen = cipher.doFinal(b, out);466byte[] o = new byte[rlen];467out.flip();468out.position(outOfs);469out.get(o, 0, rlen);470ba.write(o);471}472default -> throw new Exception("Unknown op: " + v.name());473}474475if (theoreticalCheck && rlen != olen - outOfs) {476throw new Exception("Wrong doFinal return len (" +477v.name() + "): " + "rlen=" + rlen +478", expected output len=" + (olen - outOfs));479}480481// Verify results482byte[] ctresult = ba.toByteArray();483if (ctresult.length != expectedOut.length ||484Arrays.compare(ctresult, expectedOut) != 0) {485String s = "Ciphertext mismatch (" + v.name() +486"):\nresult (len=" + ctresult.length + "):" +487String.format("%0" + (ctresult.length << 1) + "x",488new BigInteger(1, ctresult)) +489"\nexpected (len=" + output.length + "):" +490String.format("%0" + (output.length << 1) + "x",491new BigInteger(1, output));492System.err.println(s);493throw new Exception(s);494495}496}497}498}499500/**501* Perform cipher operation using in-place buffers. This method does not502* allow mixing of data types (byte, heap, direct).503*504* Mixing data types makes no sense for in-place operations and would505* greatly complicate the test code.506*/507void cryptoSameBuffer(boolean encrypt, Data d, byte[] input, byte[] output) throws Exception {508509byte[] data, out;510if (encrypt) {511data = new byte[output.length + Math.max(inOfs, outOfs)];512} else {513data = new byte[input.length + Math.max(inOfs, outOfs)];514}515516ByteBuffer bbin = null, bbout = null;517System.arraycopy(input, 0, data, inOfs, input.length);518byte[] expectedOut = new byte[output.length + outOfs];519System.arraycopy(output, 0, expectedOut, outOfs, output.length);520int plen = input.length / ops.size(); // partial input length521int theorticallen = plen - (plen % AESBLOCK); // output length522int dataoffset = 0;523int index = 0;524int rlen = 0; // result length525int len = 0;526527Cipher cipher = Cipher.getInstance(algo);528cipher.init((encrypt ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE),529d.key, new GCMParameterSpec(d.tag.length * 8, d.iv));530cipher.updateAAD(d.aad);531532// Prepare data533switch (ops.get(0)) {534case HEAP -> {535bbin = ByteBuffer.wrap(data);536bbin.limit(input.length + inOfs);537bbout = bbin.duplicate();538}539case DIRECT -> {540bbin = ByteBuffer.allocateDirect(data.length);541bbout = bbin.duplicate();542bbin.put(data, 0, input.length + inOfs);543bbin.flip();544}545}546547// Set data limits for bytebuffers548if (bbin != null) {549bbin.position(inOfs);550bbout.limit(output.length + outOfs);551bbout.position(outOfs);552}553554// Iterate through each operation555for (dtype v : ops) {556if (index < ops.size() - 1) {557switch (v) {558case BYTE -> {559rlen = cipher.update(data, dataoffset + inOfs, plen,560data, len + outOfs);561}562case HEAP, DIRECT -> {563theorticallen = bbin.remaining() -564(bbin.remaining() % AESBLOCK);565rlen = cipher.update(bbin, bbout);566}567default -> throw new Exception("Unknown op: " + v.name());568}569570// Check that the theoretical return value matches the actual.571if (theoreticalCheck && encrypt && rlen != theorticallen) {572throw new Exception("Wrong update return len (" +573v.name() + "): " + "rlen=" + rlen +574", expected output len=" + theorticallen);575}576577dataoffset += plen;578len += rlen;579index++;580581} else {582// Run doFinal op583plen = input.length - dataoffset;584585switch (v) {586case BYTE -> {587rlen = cipher.doFinal(data, dataoffset + inOfs,588plen, data, len + outOfs);589out = Arrays.copyOfRange(data, 0,len + rlen + outOfs);590}591case HEAP, DIRECT -> {592rlen = cipher.doFinal(bbin, bbout);593bbout.flip();594out = new byte[bbout.remaining()];595bbout.get(out);596}597default -> throw new Exception("Unknown op: " + v.name());598}599len += rlen;600601// Verify results602if (len != output.length ||603Arrays.compare(out, 0, len, expectedOut, 0,604output.length) != 0) {605String s = "Ciphertext mismatch (" + v.name() +606"):\nresult (len=" + len + "):\n" +607byteToHex(out) +608"\nexpected (len=" + output.length + "):\n" +609String.format("%0" + (output.length << 1) + "x",610new BigInteger(1, output));611System.err.println(s);612throw new Exception(s);613}614}615}616}617static void offsetTests(GCMBufferTest t) throws Exception {618t.clone().offset(2).test();619t.clone().inOfs(2).test();620// Test not designed for overlap situations621t.clone().outOfs(2).differentBufferOnly().test();622}623624public static void main(String args[]) throws Exception {625initTest();626// Test single byte array627new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.BYTE)).test();628offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.BYTE)));629// Test update-doFinal with byte arrays630new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.BYTE, dtype.BYTE)).test();631offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.BYTE, dtype.BYTE)));632// Test update-update-doFinal with byte arrays633new GCMBufferTest("AES/GCM/NoPadding",634List.of(dtype.BYTE, dtype.BYTE, dtype.BYTE)).test();635offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.BYTE, dtype.BYTE, dtype.BYTE)));636637// Test single heap bytebuffer638new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.HEAP)).test();639offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.HEAP)));640// Test update-doFinal with heap bytebuffer641new GCMBufferTest("AES/GCM/NoPadding",642List.of(dtype.HEAP, dtype.HEAP)).test();643offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.HEAP, dtype.HEAP)));644// Test update-update-doFinal with heap bytebuffer645new GCMBufferTest("AES/GCM/NoPadding",646List.of(dtype.HEAP, dtype.HEAP, dtype.HEAP)).test();647offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.HEAP, dtype.HEAP, dtype.HEAP)));648649// Test single direct bytebuffer650new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.DIRECT)).test();651offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.DIRECT)));652// Test update-doFinal with direct bytebuffer653new GCMBufferTest("AES/GCM/NoPadding",654List.of(dtype.DIRECT, dtype.DIRECT)).test();655offsetTests(new GCMBufferTest("AES/GCM/NoPadding",656List.of(dtype.DIRECT, dtype.DIRECT)));657// Test update-update-doFinal with direct bytebuffer658new GCMBufferTest("AES/GCM/NoPadding",659List.of(dtype.DIRECT, dtype.DIRECT, dtype.DIRECT)).test();660offsetTests(new GCMBufferTest("AES/GCM/NoPadding",661List.of(dtype.DIRECT, dtype.DIRECT, dtype.DIRECT)));662663// Test update-update-doFinal with byte arrays and preset data sizes664GCMBufferTest t = new GCMBufferTest("AES/GCM/NoPadding",665List.of(dtype.BYTE, dtype.BYTE, dtype.BYTE)).dataSegments(666new int[] { 1, 1, GCMBufferTest.REMAINDER});667t.clone().test();668offsetTests(t.clone());669670// Test update-doFinal with a byte array and a direct bytebuffer671t = new GCMBufferTest("AES/GCM/NoPadding",672List.of(dtype.BYTE, dtype.DIRECT)).differentBufferOnly();673t.clone().test();674offsetTests(t.clone());675// Test update-doFinal with a byte array and heap and direct bytebuffer676t = new GCMBufferTest("AES/GCM/NoPadding",677List.of(dtype.BYTE, dtype.HEAP, dtype.DIRECT)).differentBufferOnly();678t.clone().test();679offsetTests(t.clone());680// Test update-doFinal with a direct bytebuffer and a byte array.681t = new GCMBufferTest("AES/GCM/NoPadding",682List.of(dtype.DIRECT, dtype.BYTE)).differentBufferOnly();683t.clone().test();684offsetTests(t.clone());685686// Test update-doFinal with a direct bytebuffer and a byte array with687// preset data sizes.688t = new GCMBufferTest("AES/GCM/NoPadding",689List.of(dtype.DIRECT, dtype.BYTE)).differentBufferOnly().690dataSegments(new int[] { 20, GCMBufferTest.REMAINDER });691t.clone().test();692offsetTests(t.clone());693// Test update-update-doFinal with a direct and heap bytebuffer and a694// byte array with preset data sizes.695t = new GCMBufferTest("AES/GCM/NoPadding",696List.of(dtype.DIRECT, dtype.BYTE, dtype.HEAP)).697differentBufferOnly().dataSet(5).698dataSegments(new int[] { 5000, 1000, GCMBufferTest.REMAINDER });699t.clone().test();700offsetTests(t.clone());701702// Test update-update-doFinal with byte arrays, incrementing through703// every data size combination for the Data set 0704new GCMBufferTest("AES/GCM/NoPadding",705List.of(dtype.BYTE, dtype.BYTE, dtype.BYTE)).incrementalSegments().706dataSet(0).test();707// Test update-update-doFinal with direct bytebuffers, incrementing through708// every data size combination for the Data set 0709new GCMBufferTest("AES/GCM/NoPadding",710List.of(dtype.DIRECT, dtype.DIRECT, dtype.DIRECT)).711incrementalSegments().dataSet(0).test();712}713714private static byte[] HexToBytes(String hexVal) {715if (hexVal == null) {716return new byte[0];717}718byte[] result = new byte[hexVal.length()/2];719for (int i = 0; i < result.length; i++) {720String byteVal = hexVal.substring(2*i, 2*i +2);721result[i] = Integer.valueOf(byteVal, 16).byteValue();722}723return result;724}725726private static String byteToHex(byte[] barray) {727StringBuilder s = new StringBuilder();728for (byte b : barray) {729s.append(String.format("%02x", b));730}731return s.toString();732}733734// Test data735static void initTest() {736datamap.put("AES/GCM/NoPadding", List.of(737// GCM KAT738new Data("AES", 0,739"141f1ce91989b07e7eb6ae1dbd81ea5e",740"49451da24bd6074509d3cebc2c0394c972e6934b45a1d91f3ce1d3ca69e19" +741"4aa1958a7c21b6f21d530ce6d2cc5256a3f846b6f9d2f38df0102c4791e5" +742"7df038f6e69085646007df999751e248e06c47245f4cd3b8004585a7470d" +743"ee1690e9d2d63169a58d243c0b57b3e5b4a481a3e4e8c60007094ef3adea" +744"2e8f05dd3a1396f",745"d384305af2388699aa302f510913fed0f2cb63ba42efa8c5c9de2922a2ec" +746"2fe87719dadf1eb0aef212b51e74c9c5b934104a43",747"630cf18a91cc5a6481ac9eefd65c24b1a3c93396bd7294d6b8ba3239517" +748"27666c947a21894a079ef061ee159c05beeb4",749"f4c34e5fbe74c0297313268296cd561d59ccc95bbfcdfcdc71b0097dbd83" +750"240446b28dc088abd42b0fc687f208190ff24c0548",751"dbb93bbb56d0439cd09f620a57687f5d"),752// GCM KAT753new Data("AES", 1, "11754cd72aec309bf52f7687212e8957",754"3c819d9a9bed087615030b65",755(String)null, null, null,756"250327c674aaf477aef2675748cf6971"),757// GCM KAT758new Data("AES", 2, "272f16edb81a7abbea887357a58c1917",759"794ec588176c703d3d2a7a07",760(String)null, null, null,761"b6e6f197168f5049aeda32dafbdaeb"),762// zero'd test data763new Data("AES", 3, "272f16edb81a7abbea887357a58c1917",764"794ec588176c703d3d2a7a07",765new byte[256], null,766"15b461672153270e8ba1e6789f7641c5411f3e642abda731b6086f535c216457" +767"e87305bc59a1ff1f7e1e0bbdf302b75549b136606c67d7e5f71277aeca4bc670" +768"07a98f78e0cfa002ed183e62f07893ad31fe67aad1bb37e15b957a14d145f14f" +769"7483d041f2c3612ad5033155984470bdfc64d18df73c2745d92f28461bb09832" +770"33524811321ba87d213692825815dd13f528dba601a3c319cac6be9b48686c23" +771"a0ce23d5062916ea8827bbb243f585e446131489e951354c8ab24661f625c02e" +772"15536c5bb602244e98993ff745f3e523399b2059f0e062d8933fad2366e7e147" +773"510a931282bb0e3f635efe7bf05b1dd715f95f5858261b00735224256b6b3e80",774"08b3593840d4ed005f5234ae062a5c"),775// Random test data776new Data("AES", 4, "272f16edb81a7abbea887357a58c1917",777"794ec588176c703d3d2a7a07",778new byte[2075], null,779"15b461672153270e8ba1e6789f7641c5411f3e642abda731b6086f535c216457" +780"e87305bc59a1ff1f7e1e0bbdf302b75549b136606c67d7e5f71277aeca4bc670" +781"07a98f78e0cfa002ed183e62f07893ad31fe67aad1bb37e15b957a14d145f14f" +782"7483d041f2c3612ad5033155984470bdfc64d18df73c2745d92f28461bb09832" +783"33524811321ba87d213692825815dd13f528dba601a3c319cac6be9b48686c23" +784"a0ce23d5062916ea8827bbb243f585e446131489e951354c8ab24661f625c02e" +785"15536c5bb602244e98993ff745f3e523399b2059f0e062d8933fad2366e7e147" +786"510a931282bb0e3f635efe7bf05b1dd715f95f5858261b00735224256b6b3e80" +787"7364cb53ff6d4e88f928cf67ac70da127718a8a35542efbae9dd7567c818a074" +788"9a0c74bd69014639f59768bc55056d1166ea5523e8c66f9d78d980beb8f0d83b" +789"a9e2c5544b94dc3a1a4b6f0f95f897b010150e89ebcacf0daee3c2793d6501a0" +790"b58b411de273dee987e8e8cf8bb29ef2e7f655b46b55fabf64c6a4295e0d080b" +791"6a570ace90eb0fe0f5b5d878bdd90eddaa1150e4d5a6505b350aac814fe99615" +792"317ecd0516a464c7904011ef5922409c0d65b1e43b69d7c3293a8f7d3e9fbee9" +793"eb91ec0007a7d6f72e64deb675d459c5ba07dcfd58d08e6820b100465e6e04f0" +794"663e310584a00d36d23699c1bffc6afa094c75184fc7cde7ad35909c0f49f2f3" +795"fe1e6d745ab628d74ea56b757047de57ce18b4b3c71e8af31a6fac16189cb0a3" +796"a97a1bea447042ce382fcf726560476d759c24d5c735525ea26a332c2094408e" +797"671c7deb81d5505bbfd178f866a6f3a011b3cfdbe089b4957a790688028dfdf7" +798"9a096b3853f9d0d6d3feef230c7f5f46ffbf7486ebdaca5804dc5bf9d202415e" +799"e0d67b365c2f92a17ea740807e4f0b198b42b54f15faa9dff2c7c35d2cf8d72e" +800"b8f8b18875a2e7b5c43d1e0aa5139c461e8153c7f632895aa46ffe2b134e6a0d" +801"dfbf6a336e709adfe951bd52c4dfc7b07a15fb3888fc35b7e758922f87a104c4" +802"563c5c7839cfe5a7edbdb97264a7c4ebc90367b10cbe09dbf2390767ad7afaa8" +803"8fb46b39d3f55f216d2104e5cf040bf3d39b758bea28e2dbce576c808d17a8eb" +804"e2fd183ef42a774e39119dff1f539efeb6ad15d889dfcb0d54d0d4d4cc03c8d9" +805"aa6c9ebd157f5e7170183298d6a30ada8792dcf793d931e2a1eafccbc63c11c0" +806"c5c5ed60837f30017d693ccb294df392a8066a0594a56954aea7b78a16e9a11f" +807"4a8bc2104070a7319f5fab0d2c4ccad8ec5cd8f47c839179bfd54a7bf225d502" +808"cd0a318752fe763e8c09eb88fa57fc5399ad1f797d0595c7b8afdd23f13603e9" +809"6802192bb51433b7723f4e512bd4f799feb94b458e7f9792f5f9bd6733828f70" +810"a6b7ffbbc0bb7575021f081ec2a0d37fecd7cda2daec9a3a9d9dfe1c8034cead" +811"e4b56b581cc82bd5b74b2b30817967d9da33850336f171a4c68e2438e03f4b11" +812"96da92f01b3b7aeab795180ccf40a4b090b1175a1fc0b67c95f93105c3aef00e" +813"13d76cc402539192274fee703730cd0d1c5635257719cc96cacdbad00c6255e2" +814"bd40c775b43ad09599e84f2c3205d75a6661ca3f151183be284b354ce21457d1" +815"3ba65b9b2cdb81874bd14469c2008b3ddec78f7225ecc710cc70de7912ca6a6d" +816"348168322ab59fdafcf5c833bfa0ad4046f4b6da90e9f263db7079af592eda07" +817"5bf16c6b1a8346da9c292a48bf660860a4fc89eaef40bc132779938eca294569" +818"787c740af2b5a8de7f5e10ac750d1e3d0ef3ed168ba408a676e10b8a20bd4be8" +819"3e8336b45e54481726d73e1bd19f165a98e242aca0d8387f2dd22d02d74e23db" +820"4cef9a523587413e0a44d7e3260019a34d3a6b38426ae9fa4655be338d721970" +821"cb9fe76c073f26f9303093a033022cd2c62b2790bce633ba9026a1c93b6535f1" +822"1882bf5880e511b9e1b0b7d8f23a993aae5fd275faac3a5b4ccaf7c06b0b266a" +823"ee970a1e3a4cd7a41094f516960630534e692545b25a347c30e3f328bba4825f" +824"ed754e5525d846131ecba7ca120a6aeabc7bab9f59c890c80b7e31f9bc741591" +825"55d292433ce9558e104102f2cc63ee267c1c8333e841522707ea6d595cb802b9" +826"61697da77bbc4cb404ea62570ab335ebffa2023730732ac5ddba1c3dbb5be408" +827"3c50aea462c1ffa166d7cc3db4b742b747e81b452db2363e91374dee8c6b40f0" +828"e7fbf50e60eaf5cc5649f6bb553aae772c185026ceb052af088c545330a1ffbf" +829"50615b8c7247c6cd386afd7440654f4e15bcfae0c45442ec814fe88433a9d616" +830"ee6cc3f163f0d3d325526d05f25d3b37ad5eeb3ca77248ad86c9042b16c65554" +831"aebb6ad3e17b981492b13f42c5a5dc088e991da303e5a273fdbb8601aece4267" +832"47b01f6cb972e6da1743a0d7866cf206e95f23c6f8e337c901b9cd34a9a1fbbe" +833"1694f2c26b00dfa4d02c0d54540163e798fbdc9c25f30d6406f5b4c13f7ed619" +834"34e350f4059c13aa5e973307a9e3058917cda96fdd082e9c629ccfb2a9f98d12" +835"5c6e4703a7b0f348f5cdeb63cef2133d1c6c1a087591e0a2bca29d09c6565e66" +836"e91042f83b0e74e60a5d57562c23e2fbcd6599c29d7c19e47cf625c2ce24bb8a" +837"13f8e54041498437eec2cedd1e3d8e57a051baa962c0a62d70264d99c5ee716d" +838"5c8b9078db08c8b2c5613f464198a7aff43f76c5b4612b46a4f1cd2a494386c5" +839"7fd28f3d199f0ba8d8e39116cc7db16ce6188205ee49a9dce3d4fa32ea394919" +840"f6e91ef58b84d00b99596b4306c2d9f432d917bb4ac73384c42ae12adb4920d8" +841"c33a816febcb299dcddf3ec7a8eb6e04cdc90891c6e145bd9fc5f41dc4061a46" +842"9feba38545b64ec8203f386ceef52785619e991d274ae80af7e54af535e0b011" +843"5effdf847472992875e09398457604d04e0bb965db692c0cdcf11a",844"687cc09c89298491deb51061d709af"),845// Randomly generated data at the time of execution.846new Data("AES", 5, "11754cd72aec309bf52f7687212e8957", 12345)847)848);849}850}851852853