1// Copyright 2018 Google LLC 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 17// Package aead provides implementations of the AEAD primitive. 18// 19// AEAD encryption assures the confidentiality and authenticity of the data. This primitive is CPA secure. 20package aead 21 22import ( 23 "fmt" 24 25 "github.com/google/tink/go/core/registry" 26 "github.com/google/tink/go/internal/internalregistry" 27) 28 29func init() { 30 if err := registry.RegisterKeyManager(new(aesCTRHMACAEADKeyManager)); err != nil { 31 panic(fmt.Sprintf("aead.init() failed: %v", err)) 32 } 33 34 if err := registry.RegisterKeyManager(new(aesGCMKeyManager)); err != nil { 35 panic(fmt.Sprintf("aead.init() failed: %v", err)) 36 } 37 if err := internalregistry.AllowKeyDerivation(aesGCMTypeURL); err != nil { 38 panic(fmt.Sprintf("aead.init() failed: %v", err)) 39 } 40 41 if err := registry.RegisterKeyManager(new(chaCha20Poly1305KeyManager)); err != nil { 42 panic(fmt.Sprintf("aead.init() failed: %v", err)) 43 } 44 45 if err := registry.RegisterKeyManager(new(xChaCha20Poly1305KeyManager)); err != nil { 46 panic(fmt.Sprintf("aead.init() failed: %v", err)) 47 } 48 if err := internalregistry.AllowKeyDerivation(xChaCha20Poly1305TypeURL); err != nil { 49 panic(fmt.Sprintf("aead.init() failed: %v", err)) 50 } 51 52 if err := registry.RegisterKeyManager(new(kmsEnvelopeAEADKeyManager)); err != nil { 53 panic(fmt.Sprintf("aead.init() failed: %v", err)) 54 } 55 56 if err := registry.RegisterKeyManager(new(aesGCMSIVKeyManager)); err != nil { 57 panic(fmt.Sprintf("aead.init() failed: %v", err)) 58 } 59} 60