1 /* 2 * Copyright (c) 2022-2024 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_MANGAGER_API_H 17 #define CERT_MANGAGER_API_H 18 19 #include "cm_type.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 CM_API_EXPORT int32_t CmGetCertList(uint32_t store, struct CertList *certificateList); 26 27 CM_API_EXPORT int32_t CmGetCertInfo(const struct CmBlob *certUri, uint32_t store, 28 struct CertInfo *certificateInfo); 29 30 CM_API_EXPORT int32_t CmSetCertStatus(const struct CmBlob *certUri, const uint32_t store, 31 const bool status); 32 33 CM_API_EXPORT int32_t CmInstallAppCert(const struct CmBlob *appCert, const struct CmBlob *appCertPwd, 34 const struct CmBlob *certAlias, const uint32_t store, struct CmBlob *keyUri); 35 36 CM_API_EXPORT int32_t CmInstallAppCertEx(const struct CmAppCertParam *certParam, struct CmBlob *keyUri); 37 38 CM_API_EXPORT int32_t CmUninstallAppCert(const struct CmBlob *keyUri, const uint32_t store); 39 40 CM_API_EXPORT int32_t CmUninstallAllAppCert(void); 41 42 CM_API_EXPORT int32_t CmGetAppCertList(const uint32_t store, struct CredentialList *certificateList); 43 44 CM_API_EXPORT int32_t CmCallingGetAppCertList(const uint32_t store, struct CredentialList *certificateList); 45 46 CM_API_EXPORT int32_t CmGetAppCert(const struct CmBlob *keyUri, const uint32_t store, struct Credential *certificate); 47 48 CM_API_EXPORT int32_t CmGrantAppCertificate(const struct CmBlob *keyUri, uint32_t appUid, struct CmBlob *authUri); 49 50 CM_API_EXPORT int32_t CmGetAuthorizedAppList(const struct CmBlob *keyUri, struct CmAppUidList *appUidList); 51 52 CM_API_EXPORT int32_t CmIsAuthorizedApp(const struct CmBlob *authUri); 53 54 CM_API_EXPORT int32_t CmRemoveGrantedApp(const struct CmBlob *keyUri, uint32_t appUid); 55 56 CM_API_EXPORT int32_t CmInit(const struct CmBlob *authUri, const struct CmSignatureSpec *spec, struct CmBlob *handle); 57 58 CM_API_EXPORT int32_t CmUpdate(const struct CmBlob *handle, const struct CmBlob *inData); 59 60 CM_API_EXPORT int32_t CmFinish(const struct CmBlob *handle, const struct CmBlob *inData, struct CmBlob *outData); 61 62 CM_API_EXPORT int32_t CmAbort(const struct CmBlob *handle); 63 64 CM_API_EXPORT int32_t CmGetUserCertList(uint32_t store, struct CertList *certificateList); 65 66 CM_API_EXPORT int32_t CmGetUserCertInfo(const struct CmBlob *certUri, uint32_t store, 67 struct CertInfo *certificateInfo); 68 69 CM_API_EXPORT int32_t CmSetUserCertStatus(const struct CmBlob *certUri, uint32_t store, 70 const bool status); 71 72 CM_API_EXPORT int32_t CmInstallUserTrustedCert(const struct CmBlob *userCert, 73 const struct CmBlob *certAlias, struct CmBlob *certUri); 74 75 CM_API_EXPORT int32_t CmUninstallUserTrustedCert(const struct CmBlob *certUri); 76 77 CM_API_EXPORT int32_t CmUninstallAllUserTrustedCert(void); 78 79 CM_API_EXPORT int32_t CmInstallSystemAppCert(const struct CmAppCertParam *certParam, struct CmBlob *keyUri); 80 81 CM_API_EXPORT int32_t CmInstallUserCACert(const struct CmBlob *userCert, 82 const struct CmBlob *certAlias, const uint32_t userId, const bool status, struct CmBlob *certUri); 83 84 CM_API_EXPORT int32_t CmGetUserCACertList(const struct UserCAProperty *property, struct CertList *certificateList); 85 86 CM_API_EXPORT int32_t CmGetCertStorePath(const enum CmCertType type, const uint32_t userId, 87 char *path, uint32_t pathLen); 88 89 CM_API_EXPORT int32_t CmInstallUserTrustedP7BCert(const struct CmInstallCertInfo *installCertInfo, const bool status, 90 struct CertUriList *certUriList); 91 92 #ifdef __cplusplus 93 } 94 #endif 95 96 #endif /* CERT_MANGAGER_API_H */