1// Copyright 2017 Google Inc. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14// 15//////////////////////////////////////////////////////////////////////////////// 16 17syntax = "proto3"; 18 19package google.crypto.tink; 20 21option java_package = "com.google.crypto.tink.proto"; 22option java_multiple_files = true; 23option go_package = "github.com/google/tink/go/proto/aes_gcm_go_proto"; 24option objc_class_prefix = "TINKPB"; 25 26message AesGcmKeyFormat { 27 uint32 key_size = 2; 28 uint32 version = 3; 29} 30 31// key_type: type.googleapis.com/google.crypto.tink.AesGcmKey 32// 33// A AesGcmKey is an AEAD key. Mathematically, it represents the functions 34// Encrypt and Decrypt which we define in the following. 35// 36// First, Tink computes a "output prefix" OP by considering the 37// "OutputPrefixType" message in Keyset.Key and the ID of the key using the 38// Tink function "AEAD-OutputPrefix": (AesGcmKeys must always be stored in a 39// keyset). 40// 41// AEAD-OutputPrefix(output_prefix_type, id): 42// if output_prefix_type == RAW: 43// return ""; 44// if output_prefix_type == TINK: 45// return 0x01 + BigEndian(id) 46// if output_prefix_type == CRUNCHY: 47// return 0x00 + BigEndian(id) 48// 49// Then, the function defined by this is defined as: 50// [GCM], Section 5.2.1: 51// * "Encrypt" maps a plaintext P and associated data A to a ciphertext given 52// by the concatenation OP || IV || C || T. In addition to [GCM], Tink 53// has the following restriction: IV is a uniformly random initialization 54// vector of length 12 bytes and T is restricted to 16 bytes. 55// 56// * If OP matches the result of AEAD-OutputPrefix, then "Decrypt" maps the 57// input OP || IV || C || T and A to the the output P in the manner as 58// described in [GCM], Section 5.2.2. If OP does not match, then "Decrypt" 59// returns an error. 60// [GCM]: NIST Special Publication 800-38D: Recommendation for Block Cipher 61// Modes of Operation: Galois/Counter Mode (GCM) and GMAC. 62// http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf. 63 64message AesGcmKey { 65 uint32 version = 1; 66 bytes key_value = 3; 67} 68