1 /* 2 * Copyright 2019 Google LLC. 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 * https://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 #ifndef PRIVATE_JOIN_AND_COMPUTE_UTIL_EC_KEY_UTIL_H_ 17 #define PRIVATE_JOIN_AND_COMPUTE_UTIL_EC_KEY_UTIL_H_ 18 19 #include "private_join_and_compute/crypto/big_num.h" 20 #include "private_join_and_compute/crypto/context.h" 21 #include "private_join_and_compute/crypto/ec_key.pb.h" 22 #include "private_join_and_compute/util/status.inc" 23 24 namespace private_join_and_compute::ec_key_util { 25 26 // Generates an EC key and writes it to the provided files as 27 // EcKeyProto message. 28 Status GenerateEcKey(int curve_id, absl::string_view ec_key_filename); 29 30 // Converts the given EC key proto to a BigNum. It fails if the curve_id of key 31 // doesn't match the given curve id value. 32 StatusOr<BigNum> DeserializeEcKey(Context* context, int curve_id, 33 EcKeyProto ec_key_proto); 34 35 } // namespace private_join_and_compute::ec_key_util 36 37 #endif // PRIVATE_JOIN_AND_COMPUTE_UTIL_EC_KEY_UTIL_H_ 38