1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 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 #ifndef KEY_MANAGER_H 17 #define KEY_MANAGER_H 18 19 #include "string_util.h" 20 21 typedef struct { 22 const char *peerInfo; 23 const char *pdidIndex; 24 } PseudonymKeyInfo; 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 int32_t GenerateDeviceKeyPair(void); 31 int32_t GenerateMk(const char *peerDeviceId, const Uint8Buff *peerPubKey); 32 int32_t DeleteMk(const char *peerDeviceId); 33 int32_t GeneratePseudonymPsk(const char *peerDeviceId, const Uint8Buff *salt); 34 int32_t DeletePseudonymPsk(const char *peerDeviceId); 35 int32_t GenerateAndSavePseudonymId(int32_t osAccountId, const char *peerDeviceId, const PseudonymKeyInfo *info, 36 const Uint8Buff *saltBuff, Uint8Buff *returnHmac); 37 int32_t GetDevicePubKey(Uint8Buff *devicePk); 38 39 #ifdef __cplusplus 40 } 41 #endif 42 #endif