1 // Copyright 2019 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 #ifndef TINK_PRF_PRF_KEY_TEMPLATES_H_ 18 #define TINK_PRF_PRF_KEY_TEMPLATES_H_ 19 20 #include "proto/tink.pb.h" 21 22 namespace crypto { 23 namespace tink { 24 25 /////////////////////////////////////////////////////////////////////////////// 26 // Pre-generated KeyTemplate for Prf key types. One can use these templates 27 // to generate new KeysetHandle object with fresh keys. 28 // To generate a new keyset that contains a single HkdfPrfKey, one can do: 29 // 30 // auto handle_result = 31 // KeysetHandle::GenerateNew(PrfKeyTemplates::HkdfSha256()); 32 // if (!handle_result.ok()) { /* fail with error */ } 33 // auto keyset_handle = std::move(handle_result.value()); 34 class PrfKeyTemplates { 35 public: 36 // Hkdf 37 // * Hash function: SHA256 38 // * Key size: 256 bit 39 // * Salt: empty 40 static const google::crypto::tink::KeyTemplate& HkdfSha256(); 41 static const google::crypto::tink::KeyTemplate& HmacSha256(); 42 static const google::crypto::tink::KeyTemplate& HmacSha512(); 43 static const google::crypto::tink::KeyTemplate& AesCmac(); 44 }; 45 46 } // namespace tink 47 } // namespace crypto 48 49 #endif // TINK_PRF_PRF_KEY_TEMPLATES_H_ 50