1 /* 2 * Copyright 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 org.conscrypt; 18 19 /** 20 * GCM parameters used during an ciphering operation with {@link OpenSSLCipher}. 21 * This class exists solely for backward compatibility with Android versions 22 * that did not have the {@code GCMParameterSpec} class. 23 */ 24 public class GCMParameters { 25 /** The tag length in bits. */ 26 public final int tLen; 27 28 /** Actually the nonce value for the GCM operation. */ 29 public final byte[] iv; 30 GCMParameters(int tLen, byte[] iv)31 public GCMParameters(int tLen, byte[] iv) { 32 this.tLen = tLen; 33 this.iv = iv; 34 } 35 36 /** 37 * Returns the tag length in bits. 38 */ getTLen()39 public int getTLen() { 40 return tLen; 41 } 42 43 /** 44 * Returns a non-cloned version of the IV. 45 */ getIV()46 public byte[] getIV() { 47 return iv; 48 } 49 } 50