1 /* 2 * Copyright (c) 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 CJ_CERT_MANAGER_FFI_H 17 #define CJ_CERT_MANAGER_FFI_H 18 19 #include "cert_manager_api.h" 20 21 struct CjCredential { 22 uint32_t isExist; 23 char *type; 24 char *alias; 25 char *keyUri; 26 uint32_t certNum; 27 uint32_t keyNum; 28 struct CmBlob credData; 29 }; 30 31 struct CjSignatureSpec { 32 uint32_t purpose; 33 uint32_t padding; 34 uint32_t digest; 35 }; 36 37 struct CjCertAbstract { 38 char *uri; 39 char *certAlias; 40 bool status; 41 char *subjectName; 42 }; 43 44 struct CjCertInfo { 45 char *uri; 46 char *certAlias; 47 bool status; 48 char *issuerName; 49 char *subjectName; 50 char *serial; 51 char *notBefore; 52 char *notAfter; 53 char *fingerprintSha256; 54 struct CmBlob certInfo; 55 }; 56 57 int32_t FfiCertManagerInstallAppCert(const struct CmBlob *appCert, const struct CmBlob *appCertPwd, 58 const struct CmBlob *certAlias, const uint32_t store, struct CmBlob *keyUri); 59 int32_t FfiCertManagerUninstallAppCert(const struct CmBlob *keyUri, const uint32_t store); 60 int32_t FfiCertManagerGetAppCert(const struct CmBlob *keyUri, const uint32_t store, struct CjCredential *retObj); 61 int32_t FfiCertManagerInit(const struct CmBlob *authUri, const struct CjSignatureSpec *spec, struct CmBlob *handle); 62 int32_t FfiCertManagerUpdate(const struct CmBlob *handle, const struct CmBlob *inData); 63 int32_t FfiCertManagerFinish(const struct CmBlob *handle, const struct CmBlob *inData, struct CmBlob *outData); 64 int32_t FfiCertManagerAbort(const struct CmBlob *handle); 65 int32_t FfiCertManagerIsAuthorizedApp(const struct CmBlob *authUri); 66 int32_t FfiCertManagerGetUserCertList(const uint32_t store, uint32_t *retCount, struct CjCertAbstract **retObj); 67 int32_t FfiCertManagerGetUserCertInfo(const struct CmBlob *certUri, const uint32_t store, struct CjCertInfo *retObj); 68 69 70 #endif //CJ_CERT_MANAGER_FFI_H 71