// Copyright 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// syntax = "proto3"; package google.crypto.tink; option java_package = "com.google.crypto.tink.proto"; option java_multiple_files = true; option go_package = "github.com/google/tink/go/proto/aes_gcm_go_proto"; option objc_class_prefix = "TINKPB"; message AesGcmKeyFormat { uint32 key_size = 2; uint32 version = 3; } // key_type: type.googleapis.com/google.crypto.tink.AesGcmKey // // A AesGcmKey is an AEAD key. Mathematically, it represents the functions // Encrypt and Decrypt which we define in the following. // // First, Tink computes a "output prefix" OP by considering the // "OutputPrefixType" message in Keyset.Key and the ID of the key using the // Tink function "AEAD-OutputPrefix": (AesGcmKeys must always be stored in a // keyset). // // AEAD-OutputPrefix(output_prefix_type, id): // if output_prefix_type == RAW: // return ""; // if output_prefix_type == TINK: // return 0x01 + BigEndian(id) // if output_prefix_type == CRUNCHY: // return 0x00 + BigEndian(id) // // Then, the function defined by this is defined as: // [GCM], Section 5.2.1: // * "Encrypt" maps a plaintext P and associated data A to a ciphertext given // by the concatenation OP || IV || C || T. In addition to [GCM], Tink // has the following restriction: IV is a uniformly random initialization // vector of length 12 bytes and T is restricted to 16 bytes. // // * If OP matches the result of AEAD-OutputPrefix, then "Decrypt" maps the // input OP || IV || C || T and A to the the output P in the manner as // described in [GCM], Section 5.2.2. If OP does not match, then "Decrypt" // returns an error. // [GCM]: NIST Special Publication 800-38D: Recommendation for Block Cipher // Modes of Operation: Galois/Counter Mode (GCM) and GMAC. // http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf. message AesGcmKey { uint32 version = 1; bytes key_value = 3; }