• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef CERT_MANAGER_H
16 #define CERT_MANAGER_H
17 
18 #include "cm_type.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #define CM_ERROR(rc)  (int32_t) (rc)
25 
26 #define CERT_DIR            "/data/service/el1/public/cert_manager_service/certificates"
27 #define CREDNTIAL_STORE     "/data/service/el1/public/cert_manager_service/certificates/credential/"
28 #define SYSTEM_CA_STORE     "/system/etc/security/certificates/"
29 #define USER_CA_STORE       "/data/service/el1/public/cert_manager_service/certificates/user/"
30 #define APP_CA_STORE        "/data/service/el1/public/cert_manager_service/certificates/priv_credential/"
31 #define CREDENTIAL_STORE    "./certificates/credential/"
32 
33 int32_t CertManagerInitialize(void);
34 
35 int32_t CertManagerFindCertFileNameByUri(
36     const struct CmContext *context, const struct CmBlob *certUri, uint32_t store, struct CmMutableBlob *path);
37 
38 int32_t CmRemoveAppCert(const struct CmContext *context, const struct CmBlob *keyUri,
39     const uint32_t store);
40 
41 int32_t CmRemoveAllAppCert(const struct CmContext *context);
42 
43 int32_t CmServiceGetAppCertList(const struct CmContext *context, uint32_t store, struct CmBlob *fileNames,
44     const uint32_t fileSize, uint32_t *fileCount);
45 
46 void CmFreeFileNames(struct CmBlob *fileNames, const uint32_t fileSize);
47 
48 int32_t CmGetUri(const char *filePath, struct CmBlob *uriBlob);
49 
50 int32_t CmWriteUserCert(const struct CmContext *context, struct CmMutableBlob *pathBlob,
51     const struct CmBlob *userCert, const struct CmBlob *certAlias, struct CmBlob *certUri);
52 
53 int32_t CmRemoveUserCert(struct CmMutableBlob *pathBlob, const struct CmBlob *certUri);
54 
55 int32_t CmRemoveAllUserCert(const struct CmContext *context, uint32_t store, const struct CmMutableBlob *pathList);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif