1 /* 2 * Copyright (C) 2015 The Android Open Source Project 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 android.keystore.cts; 18 19 public class AES256GCMNoPaddingCipherTest extends AESGCMNoPaddingCipherTestBase { 20 21 private static final byte[] KAT_KEY = HexEncoding.decode( 22 "7972140d831eedac75d5ea515c9a4c3bb124499a90b5f317ac1a685e88fae395"); 23 private static final byte[] KAT_IV = HexEncoding.decode("a66c5252808d823dd4151fed"); 24 private static final byte[] KAT_PLAINTEXT = HexEncoding.decode( 25 "c2b9dabf3a55adaa94e8c0d1e77a84a3435aee23b2c3c4abb587b09a9c2afbf0"); 26 private static final byte[] KAT_CIPHERTEXT_WITHOUT_AAD = HexEncoding.decode( 27 "a960619314657b2afb96b93bebb372bffd09e19d53e351f17d1ba2611f9dc33c9c92d563e8fd381254ac26" 28 + "2aa2a4ea0d"); 29 private static final byte[] KAT_AAD = HexEncoding.decode( 30 "3727229db7a3ccda7283f628fb8a3cdf093ea1f4e8bd1bc40a830fc6df6fb0e249845dd7d449b2bc3b5ba4" 31 + "2258fb92c7"); 32 private static final byte[] KAT_CIPHERTEXT_WITH_AAD = HexEncoding.decode( 33 "a960619314657b2afb96b93bebb372bffd09e19d53e351f17d1ba2611f9dc33c1501caa6cca0a281f42bc3" 34 + "10d1e4488f"); 35 36 @Override 37 protected byte[] getKatKey() { 38 return KAT_KEY.clone(); 39 } 40 41 @Override 42 protected byte[] getKatIv() { 43 return KAT_IV.clone(); 44 } 45 46 @Override 47 protected byte[] getKatPlaintext() { 48 return KAT_PLAINTEXT.clone(); 49 } 50 51 @Override 52 protected byte[] getKatCiphertext() { 53 return KAT_CIPHERTEXT_WITHOUT_AAD.clone(); 54 } 55 56 @Override 57 protected byte[] getKatAad() { 58 return KAT_AAD.clone(); 59 } 60 61 @Override 62 protected byte[] getKatCiphertextWhenKatAadPresent() { 63 return KAT_CIPHERTEXT_WITH_AAD.clone(); 64 } 65 } 66