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 keyset provides methods to generate, read, write or validate 18// keysets. 19package keyset 20 21import ( 22 "github.com/google/tink/go/internal" 23 tinkpb "github.com/google/tink/go/proto/tink_go_proto" 24) 25 26// keysetHandle is used by package insecurecleartextkeyset and package 27// testkeyset (via package internal) to create a keyset.Handle from cleartext 28// key material. 29func keysetHandle(ks *tinkpb.Keyset, opts ...Option) (*Handle, error) { 30 return newWithOptions(ks, opts...) 31} 32 33// keysetMaterial is used by package insecurecleartextkeyset and package 34// testkeyset (via package internal) to read the key material in a 35// keyset.Handle. 36func keysetMaterial(h *Handle) *tinkpb.Keyset { 37 return h.ks 38} 39 40func init() { 41 internal.KeysetHandle = keysetHandle 42 internal.KeysetMaterial = keysetMaterial 43} 44