Home | History | Annotate | Download | only in cts
      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 AES128GCMNoPaddingCipherTest extends AESGCMNoPaddingCipherTestBase {
     20 
     21     private static final byte[] KAT_KEY = HexEncoding.decode("ba76354f0aed6e8d91f45c4ff5a062db");
     22     private static final byte[] KAT_IV = HexEncoding.decode("b79437ae08ff355d7d8a4d0f");
     23     private static final byte[] KAT_PLAINTEXT = HexEncoding.decode(
     24             "6d7596a8fd56ceaec61de7940984b7736fec44f572afc3c8952e4dc6541e2bc6a702c440a37610989543f6"
     25             + "3fedb047ca2173bc18581944");
     26     private static final byte[] KAT_CIPHERTEXT_WITHOUT_AAD = HexEncoding.decode(
     27             "b3f6799e8f9326f2df1e80fcd2cb16d78c9dc7cc14bb677862dc6c639b3a6338d24b312d3989e5920b5dbf"
     28             + "c976765efbfe57bb385940a7a43bdf05bddae3c9d6a2fbbdfcc0cba0");
     29     private static final byte[] KAT_AAD = HexEncoding.decode(
     30             "d3bc7458914f45d56d5fcfbb2eeff2dcc0e620c1229d90904e98930ea71aa43b6898f846f3244d");
     31     private static final byte[] KAT_CIPHERTEXT_WITH_AAD = HexEncoding.decode(
     32             "b3f6799e8f9326f2df1e80fcd2cb16d78c9dc7cc14bb677862dc6c639b3a6338d24b312d3989e5920b5dbf"
     33             + "c976765efbfe57bb385940a70c106264d81506f8daf9cd6a1c70988c");
     34 
     35     @Override
     36     protected byte[] getKatKey() {
     37         return KAT_KEY.clone();
     38     }
     39 
     40     @Override
     41     protected byte[] getKatIv() {
     42         return KAT_IV.clone();
     43     }
     44 
     45     @Override
     46     protected byte[] getKatPlaintext() {
     47         return KAT_PLAINTEXT.clone();
     48     }
     49 
     50     @Override
     51     protected byte[] getKatCiphertext() {
     52         return KAT_CIPHERTEXT_WITHOUT_AAD.clone();
     53     }
     54 
     55     @Override
     56     protected byte[] getKatAad() {
     57         return KAT_AAD.clone();
     58     }
     59 
     60     @Override
     61     protected byte[] getKatCiphertextWhenKatAadPresent() {
     62         return KAT_CIPHERTEXT_WITH_AAD.clone();
     63     }
     64 }
     65