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 CREDS_MANAGER_DEFINES_H 17 #define CREDS_MANAGER_DEFINES_H 18 19 #include "alg_defs.h" 20 #include "hc_vector.h" 21 #include "string_util.h" 22 23 #define PRESHARED_URL_CREDENTIAL_TYPE "credentialType" 24 #define PRESHARED_URL_KEY_TYPE "keyType" 25 #define PRESHARED_URL_TRUST_TYPE "trustType" 26 27 #define SHARED_KEY_ALIAS "sharedKeyAlias" 28 #define KEY_INFO_PERSISTENT_TOKEN "persistent_token" 29 #define TMP_AUTH_KEY_FACTOR "hichain_tmp_auth_enc_key" 30 #define ASCII_CASE_DIFFERENCE_VALUE 32 31 #define P256_SHARED_SECRET_KEY_SIZE 32 32 #define AUTH_TOKEN_SIZE 32 33 #define PAKE_KEY_ALIAS_LEN 64 34 #define PAKE_NONCE_LEN 32 35 #define PAKE_PSK_LEN 32 36 #define ISO_PSK_LEN 32 37 #define SEED_LEN 32 38 #define ISO_KEY_ALIAS_LEN 32 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 typedef enum { 45 KEY_TYPE_SYM, 46 KEY_TYPE_ASYM 47 } KeyType; 48 49 typedef enum { 50 TRUST_TYPE_PIN, 51 TRUST_TYPE_P2P, 52 TRUST_TYPE_UID 53 } TrustType; 54 55 typedef enum { 56 PRE_SHARED, 57 CERTIFICATED 58 } IdentityProofType; 59 60 typedef enum { 61 ALG_EC_SPEKE = 0x0001, 62 ALG_DL_SPEKE = 0x0002, 63 ALG_ISO = 0x0004 64 } ProtocolAlgType; 65 66 typedef enum { 67 CMD_EXCHANGE_PK = 0x0001, 68 CMD_IMPORT_AUTH_CODE = 0x0002, 69 CMD_ADD_TRUST_DEVICE = 0x0004, 70 CMD_MK_AGREE = 0x0008, 71 } ExpandProcessCmd; 72 73 typedef struct { 74 ProtocolAlgType protocolType; 75 uint32_t expandProcessCmds; 76 } ProtocolEntity; 77 DECLARE_HC_VECTOR(ProtocolEntityVec, ProtocolEntity*) 78 79 typedef struct { 80 Uint8Buff pkInfoStr; 81 Uint8Buff pkInfoSignature; 82 Algorithm signAlg; 83 bool isPseudonym; 84 } CertInfo; 85 86 typedef struct { 87 Uint8Buff preSharedUrl; 88 CertInfo certInfo; 89 } IdentityProof; 90 91 typedef struct { 92 IdentityProofType proofType; 93 IdentityProof proof; 94 ProtocolEntityVec protocolVec; 95 } IdentityInfo; 96 DECLARE_HC_VECTOR(IdentityInfoVec, IdentityInfo*) 97 98 #ifdef __cplusplus 99 } 100 #endif 101 102 #endif