1 /* 2 * Copyright (c) 2022 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 CERT_MANAGER_STORAGE_H 17 #define CERT_MANAGER_STORAGE_H 18 19 #include "cm_type.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 #define CERT_DIR "/data/service/el1/public/cert_manager_service/certificates" 26 #define CREDNTIAL_STORE "/data/service/el1/public/cert_manager_service/certificates/credential/" 27 #define SYSTEM_CA_STORE "/system/etc/security/certificates/" 28 #define USER_CA_STORE "/data/service/el1/public/cert_manager_service/certificates/user/" 29 #define PRI_CREDNTIAL_STORE "/data/service/el1/public/cert_manager_service/certificates/priv_credential/" 30 31 int32_t GetRootPath(uint32_t store, char *rootPath, uint32_t pathLen); 32 33 int32_t ConstructUserIdPath(const struct CmContext *context, uint32_t store, 34 char *userIdPath, uint32_t pathLen); 35 36 int32_t ConstructUidPath(const struct CmContext *context, uint32_t store, 37 char *uidPath, uint32_t pathLen); 38 39 int32_t ConstructAuthListPath(const struct CmContext *context, uint32_t store, 40 char *authListPath, uint32_t pathLen); 41 42 int32_t CmStorageGetBuf(const char *path, const char *fileName, struct CmBlob *storageBuf); 43 44 int32_t CmStorageGetAppCert(const struct CmContext *context, uint32_t store, 45 const struct CmBlob *keyUri, struct CmBlob *certBlob); 46 47 int32_t CmGetCertFilePath(const struct CmContext *context, uint32_t store, struct CmMutableBlob *pathBlob); 48 49 #ifdef __cplusplus 50 } 51 #endif 52 53 #endif /* CERT_MANAGER_STORAGE_H */ 54 55