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 #include "tink/config/config_util.h"
18
19 #include <string>
20
21 namespace crypto {
22 namespace tink {
23
CreateTinkKeyTypeEntry(const std::string & catalogue_name,const std::string & primitive_name,const std::string & key_proto_name,int key_manager_version,bool new_key_allowed)24 google::crypto::tink::KeyTypeEntry CreateTinkKeyTypeEntry(
25 const std::string& catalogue_name, const std::string& primitive_name,
26 const std::string& key_proto_name, int key_manager_version,
27 bool new_key_allowed) {
28 std::string prefix = "type.googleapis.com/google.crypto.tink.";
29 google::crypto::tink::KeyTypeEntry entry;
30 entry.set_catalogue_name(catalogue_name);
31 entry.set_primitive_name(primitive_name);
32 entry.set_type_url(prefix.append(key_proto_name));
33 entry.set_key_manager_version(key_manager_version);
34 entry.set_new_key_allowed(new_key_allowed);
35 return entry;
36 }
37
38 } // namespace tink
39 } // namespace crypto
40