diff --git a/interfaces/innerkits/cert_manager_standard/main/include/cert_manager_api.h b/interfaces/innerkits/cert_manager_standard/main/include/cert_manager_api.h index a80e5a9af091459ee4ad76b2076cbe986efe3550..ac1f2a679f926d3e58e9bf02761d6191951aa3be 100644 --- a/interfaces/innerkits/cert_manager_standard/main/include/cert_manager_api.h +++ b/interfaces/innerkits/cert_manager_standard/main/include/cert_manager_api.h @@ -30,24 +30,24 @@ CM_API_EXPORT int32_t CmGetCertInfo(const struct CmBlob *certUri, uint32_t store CM_API_EXPORT int32_t CmSetCertStatus(const struct CmBlob *certUri, const uint32_t store, const bool status); -CM_API_EXPORT int32_t CmInstallAppCert(const struct CmBlob *appCert, const struct CmBlob *appCertPwd, +CM_API_EXPORT int32_t CmInstallPublicCert(const struct CmBlob *appCert, const struct CmBlob *appCertPwd, const struct CmBlob *certAlias, const uint32_t store, struct CmBlob *keyUri); -CM_API_EXPORT int32_t CmUninstallAppCert(const struct CmBlob *keyUri, const uint32_t store); +CM_API_EXPORT int32_t CmUninstallPublicCert(const struct CmBlob *keyUri, const uint32_t store); CM_API_EXPORT int32_t CmUninstallAllAppCert(void); -CM_API_EXPORT int32_t CmGetAppCertList(const uint32_t store, struct CredentialList *certificateList); +CM_API_EXPORT int32_t CmGetAllPublicCertList(const uint32_t store, struct CredentialList *certificateList); -CM_API_EXPORT int32_t CmGetAppCert(const struct CmBlob *keyUri, const uint32_t store, struct Credential *certificate); +CM_API_EXPORT int32_t CmGetPublicCert(const struct CmBlob *keyUri, const uint32_t store, struct Credential *certificate); -CM_API_EXPORT int32_t CmGrantAppCertificate(const struct CmBlob *keyUri, uint32_t appUid, struct CmBlob *authUri); +CM_API_EXPORT int32_t CmGrantPublicCertificate(const struct CmBlob *keyUri, uint32_t appUid, struct CmBlob *authUri); CM_API_EXPORT int32_t CmGetAuthorizedAppList(const struct CmBlob *keyUri, struct CmAppUidList *appUidList); CM_API_EXPORT int32_t CmIsAuthorizedApp(const struct CmBlob *authUri); -CM_API_EXPORT int32_t CmRemoveGrantedApp(const struct CmBlob *keyUri, uint32_t appUid); +CM_API_EXPORT int32_t CmRemoveGrantedPublic(const struct CmBlob *keyUri, uint32_t appUid); CM_API_EXPORT int32_t CmInit(const struct CmBlob *authUri, const struct CmSignatureSpec *spec, struct CmBlob *handle); @@ -57,7 +57,7 @@ CM_API_EXPORT int32_t CmFinish(const struct CmBlob *handle, const struct CmBlob CM_API_EXPORT int32_t CmAbort(const struct CmBlob *handle); -CM_API_EXPORT int32_t CmGetUserCertList(uint32_t store, struct CertList *certificateList); +CM_API_EXPORT int32_t CmGetAllUserCertList(uint32_t store, struct CertList *certificateList); CM_API_EXPORT int32_t CmGetUserCertInfo(const struct CmBlob *certUri, uint32_t store, struct CertInfo *certificateInfo); diff --git a/interfaces/innerkits/cert_manager_standard/main/include/cm_type.h b/interfaces/innerkits/cert_manager_standard/main/include/cm_type.h index c026d9b2efdd9c995a2d059eaa54a9431806bcea..caae9eb98a6114b924d50c21b00860e7953bc7f7 100644 --- a/interfaces/innerkits/cert_manager_standard/main/include/cm_type.h +++ b/interfaces/innerkits/cert_manager_standard/main/include/cm_type.h @@ -132,6 +132,7 @@ enum CmErrorCode { CMR_ERROR_AUTH_CHECK_FAILED = -24, CMR_ERROR_KEY_OPERATION_FAILED = -25, CMR_ERROR_NOT_SYSTEMP_APP = -26, + CMR_ERROR_MAX_QUANTITY_REACHED = -27, }; enum CMErrorCode { /* temp use */ diff --git a/interfaces/innerkits/cert_manager_standard/main/src/cert_manager_api.c b/interfaces/innerkits/cert_manager_standard/main/src/cert_manager_api.c index 0f30e3e30136f8300359f7b008a7a72aa4322dbd..1448f34a866350330aacaab2e97d2b86080c77c9 100644 --- a/interfaces/innerkits/cert_manager_standard/main/src/cert_manager_api.c +++ b/interfaces/innerkits/cert_manager_standard/main/src/cert_manager_api.c @@ -79,7 +79,7 @@ CM_API_EXPORT int32_t CmSetCertStatus(const struct CmBlob *certUri, const uint32 return ret; } -CM_API_EXPORT int32_t CmInstallAppCert(const struct CmBlob *appCert, const struct CmBlob *appCertPwd, +CM_API_EXPORT int32_t CmInstallPublicCert(const struct CmBlob *appCert, const struct CmBlob *appCertPwd, const struct CmBlob *certAlias, const uint32_t store, struct CmBlob *keyUri) { CM_LOG_D("enter install app certificate"); @@ -94,7 +94,7 @@ CM_API_EXPORT int32_t CmInstallAppCert(const struct CmBlob *appCert, const struc return ret; } -CM_API_EXPORT int32_t CmUninstallAppCert(const struct CmBlob *keyUri, const uint32_t store) +CM_API_EXPORT int32_t CmUninstallPublicCert(const struct CmBlob *keyUri, const uint32_t store) { CM_LOG_D("enter uninstall app certificate"); if (keyUri == NULL || (store != CM_CREDENTIAL_STORE && @@ -117,7 +117,7 @@ CM_API_EXPORT int32_t CmUninstallAllAppCert(void) return ret; } -CM_API_EXPORT int32_t CmGetAppCertList(const uint32_t store, struct CredentialList *certificateList) +CM_API_EXPORT int32_t CmGetAllPublicCertList(const uint32_t store, struct CredentialList *certificateList) { CM_LOG_D("enter get app certificatelist"); if (certificateList == NULL || (store != CM_CREDENTIAL_STORE && @@ -130,7 +130,7 @@ CM_API_EXPORT int32_t CmGetAppCertList(const uint32_t store, struct CredentialLi return ret; } -CM_API_EXPORT int32_t CmGetAppCert(const struct CmBlob *keyUri, const uint32_t store, +CM_API_EXPORT int32_t CmGetPublicCert(const struct CmBlob *keyUri, const uint32_t store, struct Credential *certificate) { CM_LOG_D("enter get app certificate"); @@ -144,7 +144,7 @@ CM_API_EXPORT int32_t CmGetAppCert(const struct CmBlob *keyUri, const uint32_t s return ret; } -CM_API_EXPORT int32_t CmGrantAppCertificate(const struct CmBlob *keyUri, uint32_t appUid, struct CmBlob *authUri) +CM_API_EXPORT int32_t CmGrantPublicCertificate(const struct CmBlob *keyUri, uint32_t appUid, struct CmBlob *authUri) { CM_LOG_D("enter grant app certificate"); if ((keyUri == NULL) || (authUri == NULL)) { @@ -183,7 +183,7 @@ CM_API_EXPORT int32_t CmIsAuthorizedApp(const struct CmBlob *authUri) return ret; } -CM_API_EXPORT int32_t CmRemoveGrantedApp(const struct CmBlob *keyUri, uint32_t appUid) +CM_API_EXPORT int32_t CmRemoveGrantedPublic(const struct CmBlob *keyUri, uint32_t appUid) { CM_LOG_D("enter remove granted app"); if (keyUri == NULL) { @@ -248,7 +248,7 @@ CM_API_EXPORT int32_t CmAbort(const struct CmBlob *handle) return ret; } -CM_API_EXPORT int32_t CmGetUserCertList(uint32_t store, struct CertList *certificateList) +CM_API_EXPORT int32_t CmGetAllUserCertList(uint32_t store, struct CertList *certificateList) { CM_LOG_D("enter get cert list"); if (certificateList == NULL) { diff --git a/interfaces/kits/napi/include/cm_napi_common.h b/interfaces/kits/napi/include/cm_napi_common.h index 64e6d7cbdaa1b7ecd7cdd000bc1ffc033ca087bf..0e187ae92ab15def2fac22bb1f8c3d00365cd747 100644 --- a/interfaces/kits/napi/include/cm_napi_common.h +++ b/interfaces/kits/napi/include/cm_napi_common.h @@ -155,6 +155,7 @@ enum ErrorCode { INNER_FAILURE = 17500001, NOT_FOUND = 17500002, INVALID_CERT_FORMAT = 17500003, + MAX_QUANTITY_REACHED = 17500004, }; enum CmJSKeyDigest { diff --git a/interfaces/kits/napi/include/cm_napi_get_app_cert_info.h b/interfaces/kits/napi/include/cm_napi_get_app_cert_info.h index 153881e18a2612fd7e63377897a20d54d92e70e7..0b297ecec3c4795fac6ffcfa9e182fbd4c862ded 100644 --- a/interfaces/kits/napi/include/cm_napi_get_app_cert_info.h +++ b/interfaces/kits/napi/include/cm_napi_get_app_cert_info.h @@ -20,7 +20,7 @@ #include "napi/native_node_api.h" namespace CMNapi { -napi_value CMNapiGetAppCertInfo(napi_env env, napi_callback_info info); +napi_value CMNapiGetPublicCertInfo(napi_env env, napi_callback_info info); napi_value CMNapiGetPrivateAppCertInfo(napi_env env, napi_callback_info info); } // namespace CertManagerNapi diff --git a/interfaces/kits/napi/include/cm_napi_get_app_cert_list.h b/interfaces/kits/napi/include/cm_napi_get_app_cert_list.h index 83ba2f52d1e8e8cf2497ba384d7ec92a3c2d07cf..31a9f0f21adea72f4609ab81b24151b952a42fda 100644 --- a/interfaces/kits/napi/include/cm_napi_get_app_cert_list.h +++ b/interfaces/kits/napi/include/cm_napi_get_app_cert_list.h @@ -20,7 +20,7 @@ #include "napi/native_node_api.h" namespace CMNapi { -napi_value CMNapiGetAppCertList(napi_env env, napi_callback_info info); +napi_value CMNapiGetAllPublicCertList(napi_env env, napi_callback_info info); napi_value CMNapiGetPrivateAppCertList(napi_env env, napi_callback_info info); } // namespace CertManagerNapi diff --git a/interfaces/kits/napi/include/cm_napi_get_system_cert_list.h b/interfaces/kits/napi/include/cm_napi_get_system_cert_list.h index 6acbd97eafc26e7fd62c0f5e85d37768d9988b37..67d5b5c1ceefac69ac9da03fa3c461da1cc5e111 100644 --- a/interfaces/kits/napi/include/cm_napi_get_system_cert_list.h +++ b/interfaces/kits/napi/include/cm_napi_get_system_cert_list.h @@ -22,7 +22,7 @@ namespace CMNapi { napi_value CMNapiGetSystemCertList(napi_env env, napi_callback_info info); -napi_value CMNapiGetUserTrustedCertList(napi_env env, napi_callback_info info); +napi_value CMNapiGetAllUserTrustedCertList(napi_env env, napi_callback_info info); } // namespace CertManagerNapi #endif // CM_NAPI_GET_CERTIFICATE_LIST_H \ No newline at end of file diff --git a/interfaces/kits/napi/include/cm_napi_grant.h b/interfaces/kits/napi/include/cm_napi_grant.h index e69b8d22d4062d31eefe06a1ed7b5fc56727934f..9a14721082b4727625b13607f719e28be1f28bb2 100755 --- a/interfaces/kits/napi/include/cm_napi_grant.h +++ b/interfaces/kits/napi/include/cm_napi_grant.h @@ -20,10 +20,10 @@ #include "napi/native_node_api.h" namespace CMNapi { - napi_value CMNapiGrantAppCertificate(napi_env env, napi_callback_info info); + napi_value CMNapiGrantPublicCertificate(napi_env env, napi_callback_info info); napi_value CMNapiIsAuthorizedApp(napi_env env, napi_callback_info info); napi_value CMNapiGetAuthorizedAppList(napi_env env, napi_callback_info info); - napi_value CMNapiRemoveGrantedApp(napi_env env, napi_callback_info info); + napi_value CMNapiRemoveGrantedPublic(napi_env env, napi_callback_info info); } // namespace CMNapi #endif /* CM_NAPI_GRANT_H */ diff --git a/interfaces/kits/napi/include/cm_napi_install_app_cert.h b/interfaces/kits/napi/include/cm_napi_install_app_cert.h index 67aa60e280549253fd15f58c1d54a1c87db9b109..64cda4ee4fe3f9ccf44d6549842c17ed1d82fa70 100644 --- a/interfaces/kits/napi/include/cm_napi_install_app_cert.h +++ b/interfaces/kits/napi/include/cm_napi_install_app_cert.h @@ -20,7 +20,7 @@ #include "napi/native_node_api.h" namespace CMNapi { -napi_value CMNapiInstallAppCert(napi_env env, napi_callback_info info); +napi_value CMNapiInstallPublicCert(napi_env env, napi_callback_info info); napi_value CMNapiInstallPrivateAppCert(napi_env env, napi_callback_info info); } // namespace CertManagerNapi diff --git a/interfaces/kits/napi/include/cm_napi_install_app_cert_common.h b/interfaces/kits/napi/include/cm_napi_install_app_cert_common.h index 4106491ba32dce17c2d0e4dc0e9ea388e03e16af..3fb7dd937b5c8025d72b95da0824316e6cce2b47 100755 --- a/interfaces/kits/napi/include/cm_napi_install_app_cert_common.h +++ b/interfaces/kits/napi/include/cm_napi_install_app_cert_common.h @@ -43,7 +43,7 @@ napi_value InstallAppCertParseParams( napi_value InstallAppCertAsyncWork(napi_env env, InstallAppCertAsyncContext asyncContext); -napi_value CMNapiInstallAppCertCommon(napi_env env, napi_callback_info info, uint32_t store); +napi_value CMNapiInstallPublicCertCommon(napi_env env, napi_callback_info info, uint32_t store); } // namespace CertManagerNapi #endif // CM_NAPI_INSTALL_APP_CERT_COMMON_H \ No newline at end of file diff --git a/interfaces/kits/napi/include/cm_napi_uninstall_app_cert.h b/interfaces/kits/napi/include/cm_napi_uninstall_app_cert.h index f434a9127ae1ee2ee0a5cc56bcf8a436a5cf4718..cb13fda7b2df520f9ea7aa7ef1809227dc6923e7 100644 --- a/interfaces/kits/napi/include/cm_napi_uninstall_app_cert.h +++ b/interfaces/kits/napi/include/cm_napi_uninstall_app_cert.h @@ -20,7 +20,7 @@ #include "napi/native_node_api.h" namespace CMNapi { -napi_value CMNapiUninstallAppCert(napi_env env, napi_callback_info info); +napi_value CMNapiUninstallPublicCert(napi_env env, napi_callback_info info); napi_value CMNapiUninstallPrivateAppCert(napi_env env, napi_callback_info info); } // namespace CertManagerNapi diff --git a/interfaces/kits/napi/src/cm_napi.cpp b/interfaces/kits/napi/src/cm_napi.cpp index bea9393481f651164b272d0009b0f5882036970d..d879472ff6a2c166531da006510ce3e4840b7fa2 100644 --- a/interfaces/kits/napi/src/cm_napi.cpp +++ b/interfaces/kits/napi/src/cm_napi.cpp @@ -46,6 +46,7 @@ namespace CMNapi { AddInt32Property(env, errorCode, "CM_ERROR_GENERIC", INNER_FAILURE); AddInt32Property(env, errorCode, "CM_ERROR_NO_FOUND", NOT_FOUND); AddInt32Property(env, errorCode, "CM_ERROR_INCORRECT_FORMAT", INVALID_CERT_FORMAT); + AddInt32Property(env, errorCode, "CM_ERROR_MAX_QUANTITY_REACHED", MAX_QUANTITY_REACHED); } static napi_value CreateCMErrorCode(napi_env env) @@ -110,26 +111,26 @@ extern "C" { DECLARE_NAPI_FUNCTION("getSystemTrustedCertificateList", CMNapiGetSystemCertList), DECLARE_NAPI_FUNCTION("getSystemTrustedCertificate", CMNapiGetSystemCertInfo), DECLARE_NAPI_FUNCTION("setCertificateStatus", CMNapiSetCertStatus), - DECLARE_NAPI_FUNCTION("installAppCertificate", CMNapiInstallAppCert), + DECLARE_NAPI_FUNCTION("installPublicCertificate", CMNapiInstallPublicCert), DECLARE_NAPI_FUNCTION("uninstallAllAppCertificate", CMNapiUninstallAllAppCert), - DECLARE_NAPI_FUNCTION("uninstallAppCertificate", CMNapiUninstallAppCert), - DECLARE_NAPI_FUNCTION("getAppCertificateList", CMNapiGetAppCertList), - DECLARE_NAPI_FUNCTION("getAppCertificate", CMNapiGetAppCertInfo), + DECLARE_NAPI_FUNCTION("uninstallPublicCertificate", CMNapiUninstallPublicCert), + DECLARE_NAPI_FUNCTION("getAllPublicCertificates", CMNapiGetAllPublicCertList), + DECLARE_NAPI_FUNCTION("getPublicCertificate", CMNapiGetPublicCertInfo), DECLARE_NAPI_FUNCTION("installUserTrustedCertificate", CMNapiInstallUserTrustedCert), DECLARE_NAPI_FUNCTION("uninstallAllUserTrustedCertificate", CMNapiUninstallAllUserTrustedCert), DECLARE_NAPI_FUNCTION("uninstallUserTrustedCertificate", CMNapiUninstallUserTrustedCert), - DECLARE_NAPI_FUNCTION("getUserTrustedCertificateList", CMNapiGetUserTrustedCertList), + DECLARE_NAPI_FUNCTION("getAllUserTrustedCertificates", CMNapiGetAllUserTrustedCertList), DECLARE_NAPI_FUNCTION("getUserTrustedCertificate", CMNapiGetUserTrustedCertInfo), DECLARE_NAPI_FUNCTION("installPrivateCertificate", CMNapiInstallPrivateAppCert), DECLARE_NAPI_FUNCTION("uninstallPrivateCertificate", CMNapiUninstallPrivateAppCert), DECLARE_NAPI_FUNCTION("getPrivateCertificateList", CMNapiGetPrivateAppCertList), DECLARE_NAPI_FUNCTION("getAllAppPrivateCertificates", CMNapiGetPrivateAppCertList), DECLARE_NAPI_FUNCTION("getPrivateCertificate", CMNapiGetPrivateAppCertInfo), - DECLARE_NAPI_FUNCTION("grantAppCertificate", CMNapiGrantAppCertificate), + DECLARE_NAPI_FUNCTION("grantPublicCertificate", CMNapiGrantPublicCertificate), DECLARE_NAPI_FUNCTION("isAuthorizedApp", CMNapiIsAuthorizedApp), DECLARE_NAPI_FUNCTION("getAuthorizedAppList", CMNapiGetAuthorizedAppList), - DECLARE_NAPI_FUNCTION("removeGrantedAppCertificate", CMNapiRemoveGrantedApp), + DECLARE_NAPI_FUNCTION("removeGrantedPublicCertificate", CMNapiRemoveGrantedPublic), DECLARE_NAPI_FUNCTION("init", CMNapiInit), DECLARE_NAPI_FUNCTION("update", CMNapiUpdate), DECLARE_NAPI_FUNCTION("finish", CMNapiFinish), diff --git a/interfaces/kits/napi/src/cm_napi_common.cpp b/interfaces/kits/napi/src/cm_napi_common.cpp index 6c237e69cd83ce9c5c04e2694528070f61201923..6cada6e9bed25e37008779a63895c5a4b83303e5 100644 --- a/interfaces/kits/napi/src/cm_napi_common.cpp +++ b/interfaces/kits/napi/src/cm_napi_common.cpp @@ -349,6 +349,9 @@ int32_t TranformErrorCode(int32_t errorCode) if (errorCode == CMR_ERROR_INVALID_ARGUMENT) { return PARAM_ERROR; } + if (errorCode == CMR_ERROR_MAX_QUANTITY_REACHED) { + return MAX_QUANTITY_REACHED; + } return INNER_FAILURE; } diff --git a/interfaces/kits/napi/src/cm_napi_get_app_cert_info.cpp b/interfaces/kits/napi/src/cm_napi_get_app_cert_info.cpp index fdbc134a969b6914886813f665bb9d5445faf3ae..1a0418c09bbcfc59e31729578f7d6f70c04ee0f8 100644 --- a/interfaces/kits/napi/src/cm_napi_get_app_cert_info.cpp +++ b/interfaces/kits/napi/src/cm_napi_get_app_cert_info.cpp @@ -19,7 +19,7 @@ #include "cm_log.h" namespace CMNapi { -napi_value CMNapiGetAppCertInfo(napi_env env, napi_callback_info info) +napi_value CMNapiGetPublicCertInfo(napi_env env, napi_callback_info info) { return CMNapiGetAppCertInfoCommon(env, info, APPLICATION_CERTIFICATE_STORE); } diff --git a/interfaces/kits/napi/src/cm_napi_get_app_cert_info_common.cpp b/interfaces/kits/napi/src/cm_napi_get_app_cert_info_common.cpp index 7259659c836878c5b479c8cbf399714f8c2a416e..0a3ed5b566edd70f596607b75a6b28211e598352 100644 --- a/interfaces/kits/napi/src/cm_napi_get_app_cert_info_common.cpp +++ b/interfaces/kits/napi/src/cm_napi_get_app_cert_info_common.cpp @@ -138,7 +138,7 @@ napi_value GetAppCertInfoAsyncWork(napi_env env, GetAppCertInfoAsyncContext asyn (void)memset_s(context->credential, sizeof(struct Credential), 0, sizeof(struct Credential)); InitAppCert(context->credential); } - context->result = CmGetAppCert(context->keyUri, context->store, context->credential); + context->result = CmGetPublicCert(context->keyUri, context->store, context->credential); }, [](napi_env env, napi_status status, void *data) { GetAppCertInfoAsyncContext context = static_cast(data); diff --git a/interfaces/kits/napi/src/cm_napi_get_app_cert_list.cpp b/interfaces/kits/napi/src/cm_napi_get_app_cert_list.cpp index fbc46101d719b4a6daa0d331e7ad2bd57b9da822..e55e8a8deef8532e1b6c3034192f5dd3ba2d0089 100644 --- a/interfaces/kits/napi/src/cm_napi_get_app_cert_list.cpp +++ b/interfaces/kits/napi/src/cm_napi_get_app_cert_list.cpp @@ -19,7 +19,7 @@ #include "cm_log.h" namespace CMNapi { -napi_value CMNapiGetAppCertList(napi_env env, napi_callback_info info) +napi_value CMNapiGetAllPublicCertList(napi_env env, napi_callback_info info) { return CMNapiGetAppCertListCommon(env, info, APPLICATION_CERTIFICATE_STORE); } diff --git a/interfaces/kits/napi/src/cm_napi_get_app_cert_list_common.cpp b/interfaces/kits/napi/src/cm_napi_get_app_cert_list_common.cpp index 1565828f1668a30bb7b054113739b8aff2b120e1..6f7bf18f1180669d38fbb99643fed4a5917ad37d 100644 --- a/interfaces/kits/napi/src/cm_napi_get_app_cert_list_common.cpp +++ b/interfaces/kits/napi/src/cm_napi_get_app_cert_list_common.cpp @@ -127,7 +127,7 @@ napi_value GetAppCertListAsyncWork(napi_env env, GetAppCertListAsyncContext asyn if (context->credentialList != nullptr) { InitAppCertList(context->credentialList); } - context->result = CmGetAppCertList(context->store, context->credentialList); + context->result = CmGetAllPublicCertList(context->store, context->credentialList); }, [](napi_env env, napi_status status, void *data) { GetAppCertListAsyncContext context = static_cast(data); diff --git a/interfaces/kits/napi/src/cm_napi_get_system_cert_list.cpp b/interfaces/kits/napi/src/cm_napi_get_system_cert_list.cpp index 35a607667e03d6cbe9a93b0dd24cedf26f13b310..76598459be63d54ab8dc7914997c061a57a13707 100644 --- a/interfaces/kits/napi/src/cm_napi_get_system_cert_list.cpp +++ b/interfaces/kits/napi/src/cm_napi_get_system_cert_list.cpp @@ -135,7 +135,7 @@ static void GetCertListExecute(napi_env env, void *data) if (context->store == CM_SYSTEM_TRUSTED_STORE) { context->result = CmGetCertList(context->store, context->certificateList); } else { - context->result = CmGetUserCertList(context->store, context->certificateList); + context->result = CmGetAllUserCertList(context->store, context->certificateList); } } @@ -208,7 +208,7 @@ napi_value CMNapiGetSystemCertList(napi_env env, napi_callback_info info) return result; } -napi_value CMNapiGetUserTrustedCertList(napi_env env, napi_callback_info info) +napi_value CMNapiGetAllUserTrustedCertList(napi_env env, napi_callback_info info) { GetCertListAsyncContext context = CreateGetCertListAsyncContext(); if (context == nullptr) { diff --git a/interfaces/kits/napi/src/cm_napi_grant.cpp b/interfaces/kits/napi/src/cm_napi_grant.cpp index 65cad06df6c20d6b611b342f5f029c4aa4689471..fbff06a716ba19684d6f3a837d7c59e1854b4024 100644 --- a/interfaces/kits/napi/src/cm_napi_grant.cpp +++ b/interfaces/kits/napi/src/cm_napi_grant.cpp @@ -196,7 +196,7 @@ static void GrantUidExecute(napi_env env, void *data) (void)memset_s(context->authUri->data, OUT_AUTH_URI_SIZE, 0, OUT_AUTH_URI_SIZE); context->authUri->size = OUT_AUTH_URI_SIZE; - context->errCode = CmGrantAppCertificate(context->keyUri, context->appUid, context->authUri); + context->errCode = CmGrantPublicCertificate(context->keyUri, context->appUid, context->authUri); } static napi_value ConvertResultAuthUri(napi_env env, const CmBlob *authUri) @@ -235,7 +235,7 @@ static void GrantUidComplete(napi_env env, napi_status status, void *data) static void RemoveUidExecute(napi_env env, void *data) { GrantAsyncContext context = static_cast(data); - context->errCode = CmRemoveGrantedApp(context->keyUri, context->appUid); + context->errCode = CmRemoveGrantedPublic(context->keyUri, context->appUid); } static void RemoveOrIsAuthedComplete(napi_env env, napi_status status, void *data) @@ -428,7 +428,7 @@ static napi_value GetUidListAsyncWork(napi_env env, GrantAsyncContext context) return promise; } -napi_value CMNapiGrantAppCertificate(napi_env env, napi_callback_info info) +napi_value CMNapiGrantPublicCertificate(napi_env env, napi_callback_info info) { GrantAsyncContext context = InitGrantAsyncContext(); if (context == nullptr) { @@ -503,7 +503,7 @@ napi_value CMNapiGetAuthorizedAppList(napi_env env, napi_callback_info info) return result; } -napi_value CMNapiRemoveGrantedApp(napi_env env, napi_callback_info info) +napi_value CMNapiRemoveGrantedPublic(napi_env env, napi_callback_info info) { GrantAsyncContext context = InitGrantAsyncContext(); if (context == nullptr) { diff --git a/interfaces/kits/napi/src/cm_napi_install_app_cert.cpp b/interfaces/kits/napi/src/cm_napi_install_app_cert.cpp index ee0a2e0439ce074ae61c3e6549ab7d599fd4fc5e..bca164a304be4f758cf8c916ee5279b7012a63cd 100644 --- a/interfaces/kits/napi/src/cm_napi_install_app_cert.cpp +++ b/interfaces/kits/napi/src/cm_napi_install_app_cert.cpp @@ -19,13 +19,13 @@ #include "cm_log.h" namespace CMNapi { -napi_value CMNapiInstallAppCert(napi_env env, napi_callback_info info) +napi_value CMNapiInstallPublicCert(napi_env env, napi_callback_info info) { - return CMNapiInstallAppCertCommon(env, info, APPLICATION_CERTIFICATE_STORE); + return CMNapiInstallPublicCertCommon(env, info, APPLICATION_CERTIFICATE_STORE); } napi_value CMNapiInstallPrivateAppCert(napi_env env, napi_callback_info info) { - return CMNapiInstallAppCertCommon(env, info, APPLICATION_PRIVATE_CERTIFICATE_STORE); + return CMNapiInstallPublicCertCommon(env, info, APPLICATION_PRIVATE_CERTIFICATE_STORE); } } // namespace CertManagerNapi diff --git a/interfaces/kits/napi/src/cm_napi_install_app_cert_common.cpp b/interfaces/kits/napi/src/cm_napi_install_app_cert_common.cpp index c9355a5f7f0c74747249051c74245fd4353188fe..22d70942c5157f0e655a67e0647f283becde7bde 100644 --- a/interfaces/kits/napi/src/cm_napi_install_app_cert_common.cpp +++ b/interfaces/kits/napi/src/cm_napi_install_app_cert_common.cpp @@ -174,7 +174,7 @@ napi_value InstallAppCertAsyncWork(napi_env env, InstallAppCertAsyncContext asyn [](napi_env env, void *data) { InstallAppCertAsyncContext context = static_cast(data); InitKeyUri(context->keyUri); - context->result = CmInstallAppCert(context->keystore, + context->result = CmInstallPublicCert(context->keystore, context->keystorePwd, context->keyAlias, context->store, context->keyUri); }, [](napi_env env, napi_status status, void *data) { @@ -208,7 +208,7 @@ napi_value InstallAppCertAsyncWork(napi_env env, InstallAppCertAsyncContext asyn return promise; } -napi_value CMNapiInstallAppCertCommon(napi_env env, napi_callback_info info, uint32_t store) +napi_value CMNapiInstallPublicCertCommon(napi_env env, napi_callback_info info, uint32_t store) { InstallAppCertAsyncContext context = CreateInstallAppCertAsyncContext(); if (context == nullptr) { diff --git a/interfaces/kits/napi/src/cm_napi_uninstall_app_cert.cpp b/interfaces/kits/napi/src/cm_napi_uninstall_app_cert.cpp index e855e4a015bd2ba551fe6efd5dee515ca16db92b..6fdecb52e537a5194dda958e15a13056c3d79a1c 100644 --- a/interfaces/kits/napi/src/cm_napi_uninstall_app_cert.cpp +++ b/interfaces/kits/napi/src/cm_napi_uninstall_app_cert.cpp @@ -19,7 +19,7 @@ #include "cm_log.h" namespace CMNapi { -napi_value CMNapiUninstallAppCert(napi_env env, napi_callback_info info) +napi_value CMNapiUninstallPublicCert(napi_env env, napi_callback_info info) { return CMNapiUninstallAppCertCommon(env, info, APPLICATION_CERTIFICATE_STORE); } diff --git a/interfaces/kits/napi/src/cm_napi_uninstall_app_cert_common.cpp b/interfaces/kits/napi/src/cm_napi_uninstall_app_cert_common.cpp index ae0dba588b40c1c2c3e1ea518d249da74246ac2a..0661adf901ab70cf29dd17cf62bf2f831f617ae1 100644 --- a/interfaces/kits/napi/src/cm_napi_uninstall_app_cert_common.cpp +++ b/interfaces/kits/napi/src/cm_napi_uninstall_app_cert_common.cpp @@ -105,7 +105,7 @@ napi_value UninstallAppCertAsyncWork(napi_env env, UninstallAppCertAsyncContext resourceName, [](napi_env env, void *data) { UninstallAppCertAsyncContext context = static_cast(data); - context->result = CmUninstallAppCert(context->keyUri, context->store); + context->result = CmUninstallPublicCert(context->keyUri, context->store); }, [](napi_env env, napi_status status, void *data) { UninstallAppCertAsyncContext context = static_cast(data); diff --git a/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager.c b/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager.c index dea56965588c57aa4536676958073c9ebd731fd4..11c61e49a17b1de39e729699699efe289b0d33c6 100644 --- a/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager.c +++ b/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager.c @@ -488,7 +488,7 @@ int32_t CmWriteUserCert(const struct CmContext *context, struct CmMutableBlob *p ret = CherkCertCountBeyondMax((char*)pathBlob->data, (char *)certUri->data); if (ret != CM_SUCCESS) { CM_LOG_E("cert count beyond maxcount, can't install"); - ret = CMR_ERROR_INVALID_ARGUMENT; + ret = CMR_ERROR_MAX_QUANTITY_REACHED; break; } diff --git a/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager_service.c b/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager_service.c index 1405fdb7ed8b74378ce057a73c066333cd66877f..e3c86d899251130ff95ec8e951cac98972054a80 100755 --- a/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager_service.c +++ b/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager_service.c @@ -76,7 +76,7 @@ int32_t CmServicInstallAppCert(const struct CmContext *context, struct CmAppCert ret = CmInstallAppCertPro(context, appCertInfo, certAlias, store, keyUri); if (ret != CM_SUCCESS) { - CM_LOG_E("CmInstallAppCert fail, ret = %d", ret); + CM_LOG_E("CmInstallPublicCert fail, ret = %d", ret); return ret; } return ret; @@ -533,7 +533,6 @@ int32_t CmInstallUserCert(const struct CmContext *context, const struct CmBlob * ret = CmWriteUserCert(context, &pathBlob, userCert, certAlias, certUri); if (ret != CM_SUCCESS) { CM_LOG_E("CertManagerWriteUserCert fail"); - ret = CM_FAILURE; break; } diff --git a/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc/cm_ipc_service.c b/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc/cm_ipc_service.c index 1f9a41e4f5ea8e34887916786d9ecc25da47e088..1e81b7d04aff779efe380da7e8eea0aa9b394209 100644 --- a/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc/cm_ipc_service.c +++ b/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc/cm_ipc_service.c @@ -207,7 +207,7 @@ void CmIpcServiceSetCertStatus(const struct CmBlob *paramSetBlob, struct CmBlob CM_LOG_D("CmIpcServiceSetCertStatus end:%d", ret); } -void CmIpcServiceInstallAppCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceInstallPublicCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context) { struct CmContext cmContext = {0}; @@ -243,10 +243,10 @@ void CmIpcServiceInstallAppCert(const struct CmBlob *paramSetBlob, struct CmBlob CmSendResponse(context, ret, outData); CmReportSGInstallAppCert(&certAlias, store, ret); CmFreeParamSet(¶mSet); - CM_LOG_D("CmIpcServiceInstallAppCert end:%d", ret); + CM_LOG_D("CmIpcServiceInstallPublicCert end:%d", ret); } -void CmIpcServiceUninstallAppCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceUninstallPublicCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context) { int32_t ret; @@ -288,7 +288,7 @@ void CmIpcServiceUninstallAppCert(const struct CmBlob *paramSetBlob, struct CmBl CmSendResponse(context, ret, NULL); CmReportSGUninstallAppCert(&keyUri, store, false, ret); CmFreeParamSet(¶mSet); - CM_LOG_D("CmIpcServiceUninstallAppCert end:%d", ret); + CM_LOG_D("CmIpcServiceUninstallPublicCert end:%d", ret); } void CmIpcServiceUninstallAllAppCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, @@ -435,7 +435,7 @@ static int32_t CmServiceGetAppCertListPack(struct CmBlob *certificateList, const return ret; } -void CmIpcServiceGetAppCertList(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceGetAllPublicCertList(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context) { int32_t ret; @@ -455,7 +455,7 @@ void CmIpcServiceGetAppCertList(const struct CmBlob *paramSetBlob, struct CmBlob do { ret = GetInputParams(paramSetBlob, ¶mSet, &cmContext, params, CM_ARRAY_SIZE(params)); if (ret != CM_SUCCESS) { - CM_LOG_E("CmIpcServiceGetAppCertList get input params failed, ret = %d", ret); + CM_LOG_E("CmIpcServiceGetAllPublicCertList get input params failed, ret = %d", ret); break; } @@ -481,7 +481,7 @@ void CmIpcServiceGetAppCertList(const struct CmBlob *paramSetBlob, struct CmBlob CmFreeParamSet(¶mSet); CmFreeFileNames(fileNames, fileCount); CM_FREE_BLOB(certificateList); - CM_LOG_D("CmIpcServiceGetAppCertList end:%d", ret); + CM_LOG_D("CmIpcServiceGetAllPublicCertList end:%d", ret); } static int32_t CopyCertificateInfoToBuffer(const struct CmBlob *certBlob, @@ -590,7 +590,7 @@ static int32_t CmAppCertificateInfoPack(struct CmBlob *certificateInfo, return ret; } -void CmIpcServiceGetAppCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceGetPublicCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context) { int32_t ret; @@ -614,7 +614,7 @@ void CmIpcServiceGetAppCert(const struct CmBlob *paramSetBlob, struct CmBlob *ou do { ret = GetInputParams(paramSetBlob, ¶mSet, &cmContext, params, CM_ARRAY_SIZE(params)); if (ret != CM_SUCCESS) { - CM_LOG_E("CmIpcServiceGetAppCert get input params failed, ret = %d", ret); + CM_LOG_E("CmIpcServiceGetPublicCert get input params failed, ret = %d", ret); break; } @@ -640,7 +640,7 @@ void CmIpcServiceGetAppCert(const struct CmBlob *paramSetBlob, struct CmBlob *ou CmFreeParamSet(¶mSet); CM_FREE_BLOB(certBlob); CM_FREE_BLOB(certificateInfo); - CM_LOG_D("CmIpcServiceGetAppCert end:%d", ret); + CM_LOG_D("CmIpcServiceGetPublicCert end:%d", ret); } static int32_t GetAuthedList(const struct CmContext *context, const struct CmBlob *keyUri, struct CmBlob *outData) @@ -669,7 +669,7 @@ static int32_t GetAuthedList(const struct CmContext *context, const struct CmBlo return CM_SUCCESS; } -void CmIpcServiceGrantAppCertificate(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceGrantPublicCertificate(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context) { struct CmContext cmContext = { 0, 0, {0} }; @@ -697,7 +697,7 @@ void CmIpcServiceGrantAppCertificate(const struct CmBlob *paramSetBlob, struct C CmReport(__func__, &cmContext, &keyUri, ret); - CM_LOG_D("CmIpcServiceGrantAppCertificate end:%d", ret); + CM_LOG_D("CmIpcServiceGrantPublicCertificate end:%d", ret); CmSendResponse(context, ret, outData); CmReportSGGrantAppCert(&keyUri, grantUid, false, ret); CmFreeParamSet(¶mSet); @@ -766,7 +766,7 @@ void CmIpcServiceIsAuthorizedApp(const struct CmBlob *paramSetBlob, struct CmBlo CmFreeParamSet(¶mSet); } -void CmIpcServiceRemoveGrantedApp(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceRemoveGrantedPublic(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context) { struct CmContext cmContext = { 0, 0, {0} }; @@ -794,7 +794,7 @@ void CmIpcServiceRemoveGrantedApp(const struct CmBlob *paramSetBlob, struct CmBl } while (0); CmReport(__func__, &cmContext, &keyUri, ret); - CM_LOG_D("CmIpcServiceRemoveGrantedApp end:%d", ret); + CM_LOG_D("CmIpcServiceRemoveGrantedPublic end:%d", ret); CmSendResponse(context, ret, NULL); CmReportSGGrantAppCert(&keyUri, appUid, true, ret); CmFreeParamSet(¶mSet); @@ -936,7 +936,7 @@ void CmIpcServiceAbort(const struct CmBlob *paramSetBlob, struct CmBlob *outData CmFreeParamSet(¶mSet); } -void CmIpcServiceGetUserCertList(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceGetAllUserCertList(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context) { int32_t ret = CM_SUCCESS; diff --git a/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc/cm_ipc_service.h b/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc/cm_ipc_service.h index a7a4e3bdcad68612f4dfa95301f722dcb07b5dd9..70580628e3e8db8777dd5d5726e5b7f745891cdd 100644 --- a/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc/cm_ipc_service.h +++ b/services/cert_manager_standard/cert_manager_service/main/os_dependency/idl/cm_ipc/cm_ipc_service.h @@ -31,22 +31,22 @@ void CmIpcServiceGetCertificateInfo(const struct CmBlob *paramSetBlob, struct Cm void CmIpcServiceSetCertStatus(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context); -void CmIpcServiceInstallAppCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceInstallPublicCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context); -void CmIpcServiceUninstallAppCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceUninstallPublicCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context); void CmIpcServiceUninstallAllAppCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context); -void CmIpcServiceGetAppCertList(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceGetAllPublicCertList(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context); -void CmIpcServiceGetAppCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceGetPublicCert(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context); -void CmIpcServiceGrantAppCertificate(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceGrantPublicCertificate(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context); void CmIpcServiceGetAuthorizedAppList(const struct CmBlob *paramSetBlob, struct CmBlob *outData, @@ -55,7 +55,7 @@ void CmIpcServiceGetAuthorizedAppList(const struct CmBlob *paramSetBlob, struct void CmIpcServiceIsAuthorizedApp(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context); -void CmIpcServiceRemoveGrantedApp(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceRemoveGrantedPublic(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context); void CmIpcServiceInit(const struct CmBlob *paramSetBlob, struct CmBlob *outData, @@ -70,7 +70,7 @@ void CmIpcServiceFinish(const struct CmBlob *paramSetBlob, struct CmBlob *outDat void CmIpcServiceAbort(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context); -void CmIpcServiceGetUserCertList(const struct CmBlob *paramSetBlob, struct CmBlob *outData, +void CmIpcServiceGetAllUserCertList(const struct CmBlob *paramSetBlob, struct CmBlob *outData, const struct CmContext *context); void CmIpcServiceGetUserCertInfo(const struct CmBlob *paramSetBlob, struct CmBlob *outData, diff --git a/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.cpp b/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.cpp index cbcfbb4726bea726a43a1cfd7cbcb923a8b470be..bc1f6f8c256be1d51f173758aecaa91c89234d70 100644 --- a/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.cpp +++ b/services/cert_manager_standard/cert_manager_service/main/os_dependency/sa/cm_sa.cpp @@ -58,22 +58,22 @@ struct CmIpcPoint { }; static struct CmIpcPoint g_cmIpcHandler[] = { - { CM_MSG_INSTALL_APP_CERTIFICATE, CmIpcServiceInstallAppCert }, - { CM_MSG_UNINSTALL_APP_CERTIFICATE, CmIpcServiceUninstallAppCert }, + { CM_MSG_INSTALL_APP_CERTIFICATE, CmIpcServiceInstallPublicCert }, + { CM_MSG_UNINSTALL_APP_CERTIFICATE, CmIpcServiceUninstallPublicCert }, { CM_MSG_UNINSTALL_ALL_APP_CERTIFICATE, CmIpcServiceUninstallAllAppCert }, - { CM_MSG_GET_APP_CERTIFICATE_LIST, CmIpcServiceGetAppCertList }, - { CM_MSG_GET_APP_CERTIFICATE, CmIpcServiceGetAppCert }, + { CM_MSG_GET_APP_CERTIFICATE_LIST, CmIpcServiceGetAllPublicCertList }, + { CM_MSG_GET_APP_CERTIFICATE, CmIpcServiceGetPublicCert }, - { CM_MSG_GRANT_APP_CERT, CmIpcServiceGrantAppCertificate }, + { CM_MSG_GRANT_APP_CERT, CmIpcServiceGrantPublicCertificate }, { CM_MSG_GET_AUTHED_LIST, CmIpcServiceGetAuthorizedAppList }, { CM_MSG_CHECK_IS_AUTHED_APP, CmIpcServiceIsAuthorizedApp }, - { CM_MSG_REMOVE_GRANT_APP, CmIpcServiceRemoveGrantedApp }, + { CM_MSG_REMOVE_GRANT_APP, CmIpcServiceRemoveGrantedPublic }, { CM_MSG_INIT, CmIpcServiceInit }, { CM_MSG_UPDATE, CmIpcServiceUpdate }, { CM_MSG_FINISH, CmIpcServiceFinish }, { CM_MSG_ABORT, CmIpcServiceAbort }, - { CM_MSG_GET_USER_CERTIFICATE_LIST, CmIpcServiceGetUserCertList }, + { CM_MSG_GET_USER_CERTIFICATE_LIST, CmIpcServiceGetAllUserCertList }, { CM_MSG_GET_USER_CERTIFICATE_INFO, CmIpcServiceGetUserCertInfo }, { CM_MSG_SET_USER_CERTIFICATE_STATUS, CmIpcServiceSetUserCertStatus }, { CM_MSG_INSTALL_USER_CERTIFICATE, CmIpcServiceInstallUserCert }, diff --git a/services/cert_manager_standard/cert_manager_service/main/security_guard_report/src/cm_security_guard_info.c b/services/cert_manager_standard/cert_manager_service/main/security_guard_report/src/cm_security_guard_info.c index 20aaa0369fa5f7d038daa9fde874eb37bdc299c2..3b524a021452b0f8f056bb44a632bb32b8d80d99 100644 --- a/services/cert_manager_standard/cert_manager_service/main/security_guard_report/src/cm_security_guard_info.c +++ b/services/cert_manager_standard/cert_manager_service/main/security_guard_report/src/cm_security_guard_info.c @@ -172,7 +172,7 @@ void CmReportSGInstallAppCert(const struct CmBlob *certAlias, uint32_t store, in info.isSetGrantUid = false; info.isSetStatus = false; - char *action = (store == CM_CREDENTIAL_STORE) ? "CmInstallAppCert" : "CmInstallPriAppCert"; + char *action = (store == CM_CREDENTIAL_STORE) ? "CmInstallPublicCert" : "CmInstallPriAppCert"; ConstructInfoAndReport(certAlias, action, &info); #else (void)certAlias; @@ -200,7 +200,7 @@ void CmReportSGUninstallAppCert(const struct CmBlob *keyUri, uint32_t store, boo return CmReportSGRecord(&info); } - char *action = (store == CM_CREDENTIAL_STORE) ? "CmUninstallAppCert" : "CmUninstallPriAppCert"; + char *action = (store == CM_CREDENTIAL_STORE) ? "CmUninstallPublicCert" : "CmUninstallPriAppCert"; ConstructInfoAndReport(keyUri, action, &info); #else (void)keyUri; diff --git a/test/fuzz_test/cmgetappcert_fuzzer/cmgetappcert_fuzzer.cpp b/test/fuzz_test/cmgetappcert_fuzzer/cmgetappcert_fuzzer.cpp index 69cef83d8747d338f460cdbec68789df3ff5db7e..74358f3faa7423652ddfcf065f824cd03268dc5f 100644 --- a/test/fuzz_test/cmgetappcert_fuzzer/cmgetappcert_fuzzer.cpp +++ b/test/fuzz_test/cmgetappcert_fuzzer/cmgetappcert_fuzzer.cpp @@ -59,7 +59,7 @@ namespace OHOS { credCert.credData.data = const_cast(myData + offset); CertmanagerTest::SetATPermission(); - (void)CmGetAppCert(&appCertUri, store, &credCert); + (void)CmGetPublicCert(&appCertUri, store, &credCert); CmFree(myData); return true; diff --git a/test/fuzz_test/cmgetappcertlist_fuzzer/cmgetappcertlist_fuzzer.cpp b/test/fuzz_test/cmgetappcertlist_fuzzer/cmgetappcertlist_fuzzer.cpp index 3f2420cdb1867e217229d348737e9674ab692123..643a89c7b7a393811905d56a5fbee697b0850980 100644 --- a/test/fuzz_test/cmgetappcertlist_fuzzer/cmgetappcertlist_fuzzer.cpp +++ b/test/fuzz_test/cmgetappcertlist_fuzzer/cmgetappcertlist_fuzzer.cpp @@ -50,7 +50,7 @@ namespace OHOS { credCertList.credentialAbstract = reinterpret_cast(myData + offset); CertmanagerTest::SetATPermission(); - (void)CmGetAppCertList(credStore, &credCertList); + (void)CmGetAllPublicCertList(credStore, &credCertList); CmFree(myData); return true; diff --git a/test/fuzz_test/cmgetusercertlist_fuzzer/cmgetusercertlist_fuzzer.cpp b/test/fuzz_test/cmgetusercertlist_fuzzer/cmgetusercertlist_fuzzer.cpp index 7b38d51fb1bb17a950d01d583f4ea506d62a6d24..09853904b081b552d2341c6b0193b868bb07a693 100644 --- a/test/fuzz_test/cmgetusercertlist_fuzzer/cmgetusercertlist_fuzzer.cpp +++ b/test/fuzz_test/cmgetusercertlist_fuzzer/cmgetusercertlist_fuzzer.cpp @@ -45,7 +45,7 @@ namespace OHOS { } CertmanagerTest::SetATPermission(); - (void)CmGetUserCertList(userStore, &userCertList); + (void)CmGetAllUserCertList(userStore, &userCertList); CmFree(myData); return true; diff --git a/test/fuzz_test/cmgrantappcertificate_fuzzer/cmgrantappcertificate_fuzzer.cpp b/test/fuzz_test/cmgrantappcertificate_fuzzer/cmgrantappcertificate_fuzzer.cpp index fceeb5946d2e55cb35b6ab6341e61be471484498..40cb7c0ce8996aa6738bb56b841dad52b239cd3a 100644 --- a/test/fuzz_test/cmgrantappcertificate_fuzzer/cmgrantappcertificate_fuzzer.cpp +++ b/test/fuzz_test/cmgrantappcertificate_fuzzer/cmgrantappcertificate_fuzzer.cpp @@ -51,7 +51,7 @@ namespace OHOS { } CertmanagerTest::SetATPermission(); - (void)CmGrantAppCertificate(&keyUri, appUid, &authUri); + (void)CmGrantPublicCertificate(&keyUri, appUid, &authUri); CmFree(myData); return true; diff --git a/test/fuzz_test/cminstallappcert_fuzzer/cminstallappcert_fuzzer.cpp b/test/fuzz_test/cminstallappcert_fuzzer/cminstallappcert_fuzzer.cpp index 09affe140617c746d5ae66cd22828e45cf9ffbad..2d5cfdd5ecedaed2130f4d90d6fea1ebddd0171b 100644 --- a/test/fuzz_test/cminstallappcert_fuzzer/cminstallappcert_fuzzer.cpp +++ b/test/fuzz_test/cminstallappcert_fuzzer/cminstallappcert_fuzzer.cpp @@ -65,7 +65,7 @@ namespace OHOS { } CertmanagerTest::SetATPermission(); - (void)CmInstallAppCert(&appCert, &appCertPwd, &certAlias, store, &keyUri); + (void)CmInstallPublicCert(&appCert, &appCertPwd, &certAlias, store, &keyUri); CmFree(myData); return true; diff --git a/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp b/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp index a63da8c81aa207b5d40c9e2e747d417e0be96d18..c8bc40c9c1c8502967c47e597a334cfa86473caa 100644 --- a/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetappcert_fuzzer/cmipcservicegetappcert_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { { CertmanagerTest::SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_APP_CERTIFICATE, - false, CmIpcServiceGetAppCert)) { + false, CmIpcServiceGetPublicCert)) { return false; } diff --git a/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp b/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp index 694297dd218926561fcef7744da5f515e290bfe0..43430380cdbde4b3f05e96ecadb9d725780d5a37 100644 --- a/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetappcertlist_fuzzer/cmipcservicegetappcertlist_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { { CertmanagerTest::SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_APP_CERTIFICATE_LIST, - false, CmIpcServiceGetAppCertList)) { + false, CmIpcServiceGetAllPublicCertList)) { return false; } diff --git a/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp b/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp index 39cd98ed4bb7e84d632fc31dfdd03268763e8560..ad9c9793993ccbfea5d9a77d47bf0aa244327cfb 100644 --- a/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegetusercertlist_fuzzer/cmipcservicegetusercertlist_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { { CertmanagerTest::SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GET_USER_CERTIFICATE_LIST, - false, CmIpcServiceGetUserCertList)) { + false, CmIpcServiceGetAllUserCertList)) { return false; } diff --git a/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp b/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp index 1cbb366f7ee7cdd33f708f2e576ac9e2e4ade7f2..23509b15345991eaa100c90eff333f27270b63a3 100644 --- a/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp +++ b/test/fuzz_test/cmipcservicegrantappcertificate_fuzzer/cmipcservicegrantappcertificate_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { { CertmanagerTest::SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_GRANT_APP_CERT, - false, CmIpcServiceGrantAppCertificate)) { + false, CmIpcServiceGrantPublicCertificate)) { return false; } diff --git a/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp b/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp index 507c3c8b9bfe8c6c10569e0a098acf5a0feaccda..95e7d9b9657d00a9a509f6c68f356471dbe28919 100644 --- a/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceinstallappcert_fuzzer/cmipcserviceinstallappcert_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { { CertmanagerTest::SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_INSTALL_APP_CERTIFICATE, - false, CmIpcServiceInstallAppCert)) { + false, CmIpcServiceInstallPublicCert)) { return false; } diff --git a/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp b/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp index 35040319d7de257ec43245b981e9449a7ad2e136..f8df5be7875735868301352e1c9a785576f3c205 100644 --- a/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceremovegrantedapp_fuzzer/cmipcserviceremovegrantedapp_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { { CertmanagerTest::SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_REMOVE_GRANT_APP, - false, CmIpcServiceRemoveGrantedApp)) { + false, CmIpcServiceRemoveGrantedPublic)) { return false; } diff --git a/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp b/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp index 2ed14dd18083bd6a253ab8f38e2b954df330f099..53d5fd740bbe72eb86ad435ee0f53c772044d814 100644 --- a/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp +++ b/test/fuzz_test/cmipcserviceuninstallappcert_fuzzer/cmipcserviceuninstallappcert_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { { CertmanagerTest::SetATPermission(); if (!IpcServiceApiFuzzerTest(data, size, CM_MSG_UNINSTALL_APP_CERTIFICATE, - false, CmIpcServiceUninstallAppCert)) { + false, CmIpcServiceUninstallPublicCert)) { return false; } diff --git a/test/fuzz_test/cmremovegrantedapp_fuzzer/cmremovegrantedapp_fuzzer.cpp b/test/fuzz_test/cmremovegrantedapp_fuzzer/cmremovegrantedapp_fuzzer.cpp index bcf1d8b433e22fb2988eada22b03508aefab08bd..880656690659447519acf805e26fe31f288534ac 100644 --- a/test/fuzz_test/cmremovegrantedapp_fuzzer/cmremovegrantedapp_fuzzer.cpp +++ b/test/fuzz_test/cmremovegrantedapp_fuzzer/cmremovegrantedapp_fuzzer.cpp @@ -45,7 +45,7 @@ namespace OHOS { } CertmanagerTest::SetATPermission(); - (void)CmRemoveGrantedApp(&grantKeyUri, appUid); + (void)CmRemoveGrantedPublic(&grantKeyUri, appUid); CmFree(myData); return true; diff --git a/test/fuzz_test/cmuninstallappcert_fuzzer/cmuninstallappcert_fuzzer.cpp b/test/fuzz_test/cmuninstallappcert_fuzzer/cmuninstallappcert_fuzzer.cpp index 5467aad56864aec9168593747818a7093dc23fc7..1c086b546940727928909fa4cce7e1785f0c18da 100644 --- a/test/fuzz_test/cmuninstallappcert_fuzzer/cmuninstallappcert_fuzzer.cpp +++ b/test/fuzz_test/cmuninstallappcert_fuzzer/cmuninstallappcert_fuzzer.cpp @@ -45,7 +45,7 @@ namespace OHOS { } CertmanagerTest::SetATPermission(); - (void)CmUninstallAppCert(&rmKeyUri, store); + (void)CmUninstallPublicCert(&rmKeyUri, store); CmFree(myData); return true; diff --git a/test/unittest/common_permission_test/cm_common_permission_test.cpp b/test/unittest/common_permission_test/cm_common_permission_test.cpp index cdc26b4ded3bb5a3e25151b7e736171f51acfc36..19c04288d3e97f7ba59076deed237397b0e8590f 100644 --- a/test/unittest/common_permission_test/cm_common_permission_test.cpp +++ b/test/unittest/common_permission_test/cm_common_permission_test.cpp @@ -51,7 +51,7 @@ void CmCommonPermissionTest::TearDown() /** * @tc.name: CmCommonPermissionTest001 -* @tc.desc: test CmGetAppCertList +* @tc.desc: test CmGetAllPublicCertList * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -104,7 +104,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest003, TestSize.Level0) /** * @tc.name: CmCommonPermissionTest004 -* @tc.desc: test CmInstallAppCert pub credential +* @tc.desc: test CmInstallPublicCert pub credential * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -118,7 +118,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest004, TestSize.Level0) /** * @tc.name: CmCommonPermissionTest005 -* @tc.desc: test CmInstallAppCert pri credential +* @tc.desc: test CmInstallPublicCert pri credential * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -132,7 +132,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest005, TestSize.Level0) /** * @tc.name: CmCommonPermissionTest006 -* @tc.desc: test CmUninstallAppCert pub credential +* @tc.desc: test CmUninstallPublicCert pub credential * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -140,13 +140,13 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest006, TestSize.Level0) { uint8_t uriData[] = "Common006"; struct CmBlob uri = { sizeof(uriData), uriData }; - int32_t ret = CmUninstallAppCert(&uri, CM_CREDENTIAL_STORE); + int32_t ret = CmUninstallPublicCert(&uri, CM_CREDENTIAL_STORE); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); } /** * @tc.name: CmCommonPermissionTest007 -* @tc.desc: test CmUninstallAppCert pri credential +* @tc.desc: test CmUninstallPublicCert pri credential * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -154,7 +154,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest007, TestSize.Level0) { uint8_t uriData[] = "Common007"; struct CmBlob uri = { sizeof(uriData), uriData }; - int32_t ret = CmUninstallAppCert(&uri, CM_PRI_CREDENTIAL_STORE); + int32_t ret = CmUninstallPublicCert(&uri, CM_PRI_CREDENTIAL_STORE); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); } @@ -172,7 +172,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest008, TestSize.Level0) /** * @tc.name: CmCommonPermissionTest009 -* @tc.desc: test CmGetAppCertList pub +* @tc.desc: test CmGetAllPublicCertList pub * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -181,13 +181,13 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest009, TestSize.Level0) struct CredentialAbstract abstract[MAX_COUNT_CERTIFICATE]; (void)memset_s(abstract, sizeof(abstract), 0, sizeof(abstract)); struct CredentialList certList = { MAX_COUNT_CERTIFICATE, abstract }; - int32_t ret = CmGetAppCertList(CM_CREDENTIAL_STORE, &certList); + int32_t ret = CmGetAllPublicCertList(CM_CREDENTIAL_STORE, &certList); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); } /** * @tc.name: CmCommonPermissionTest010 -* @tc.desc: test CmGetAppCertList pri +* @tc.desc: test CmGetAllPublicCertList pri * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -196,13 +196,13 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest010, TestSize.Level0) struct CredentialAbstract abstract[MAX_COUNT_CERTIFICATE]; (void)memset_s(abstract, sizeof(abstract), 0, sizeof(abstract)); struct CredentialList certList = { MAX_COUNT_CERTIFICATE, abstract }; - int32_t ret = CmGetAppCertList(CM_PRI_CREDENTIAL_STORE, &certList); + int32_t ret = CmGetAllPublicCertList(CM_PRI_CREDENTIAL_STORE, &certList); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); } /** * @tc.name: CmCommonPermissionTest011 -* @tc.desc: test CmGetAppCert pub +* @tc.desc: test CmGetPublicCert pub * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -217,7 +217,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest011, TestSize.Level0) uint8_t uriData[] = "Common011"; struct CmBlob uri = { sizeof(uriData), uriData }; - int32_t ret = CmGetAppCert(&uri, CM_CREDENTIAL_STORE, &cred); + int32_t ret = CmGetPublicCert(&uri, CM_CREDENTIAL_STORE, &cred); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); free(cred.credData.data); @@ -225,7 +225,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest011, TestSize.Level0) /** * @tc.name: CmCommonPermissionTest012 -* @tc.desc: test CmGetAppCert pri +* @tc.desc: test CmGetPublicCert pri * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -240,7 +240,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest012, TestSize.Level0) uint8_t uriData[] = "Common012"; struct CmBlob uri = { sizeof(uriData), uriData }; - int32_t ret = CmGetAppCert(&uri, CM_PRI_CREDENTIAL_STORE, &cred); + int32_t ret = CmGetPublicCert(&uri, CM_PRI_CREDENTIAL_STORE, &cred); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); free(cred.credData.data); @@ -248,7 +248,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest012, TestSize.Level0) /** * @tc.name: CmCommonPermissionTest013 -* @tc.desc: test CmGetUserCertList +* @tc.desc: test CmGetAllUserCertList * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -258,7 +258,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest013, TestSize.Level0) int32_t ret = InitCertList(&certList); ASSERT_EQ(ret, CM_SUCCESS); - ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList); + ret = CmGetAllUserCertList(CM_USER_TRUSTED_STORE, certList); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); FreeCertList(certList); @@ -347,7 +347,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest018, TestSize.Level0) /** * @tc.name: CmCommonPermissionTest019 -* @tc.desc: test CmGrantAppCertificate +* @tc.desc: test CmGrantPublicCertificate * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -358,7 +358,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest019, TestSize.Level0) uint8_t authUriData[] = "common019"; struct CmBlob authUri = { sizeof(authUriData), authUriData }; - int32_t ret = CmGrantAppCertificate(&uri, 0, &authUri); + int32_t ret = CmGrantPublicCertificate(&uri, 0, &authUri); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); } @@ -393,7 +393,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest021, TestSize.Level0) /** * @tc.name: CmCommonPermissionTest022 -* @tc.desc: test CmRemoveGrantedApp +* @tc.desc: test CmRemoveGrantedPublic * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -401,7 +401,7 @@ HWTEST_F(CmCommonPermissionTest, CmCommonPermissionTest022, TestSize.Level0) { uint8_t uriData[] = "common021"; struct CmBlob uri = { sizeof(uriData), uriData }; - int32_t ret = CmRemoveGrantedApp(&uri, 0); + int32_t ret = CmRemoveGrantedPublic(&uri, 0); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); } diff --git a/test/unittest/inner_permission_test/cm_inner_permission_test.cpp b/test/unittest/inner_permission_test/cm_inner_permission_test.cpp index 44a730a0676411991f13bc711ce489bbf87fe4ad..0f40f5ec44eecfa1a146c2e508b4e91390874f3e 100644 --- a/test/unittest/inner_permission_test/cm_inner_permission_test.cpp +++ b/test/unittest/inner_permission_test/cm_inner_permission_test.cpp @@ -72,7 +72,7 @@ void CmInnerPermissionTest::TearDown() /** * @tc.name: CmInnerPermissionTest001 -* @tc.desc: test CmGetAppCertList +* @tc.desc: test CmGetAllPublicCertList * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -125,7 +125,7 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest003, TestSize.Level0) /** * @tc.name: CmInnerPermissionTest004 -* @tc.desc: test CmInstallAppCert pub credential +* @tc.desc: test CmInstallPublicCert pub credential * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -139,7 +139,7 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest004, TestSize.Level0) /** * @tc.name: CmInnerPermissionTest005 -* @tc.desc: test CmUninstallAppCert pub credential +* @tc.desc: test CmUninstallPublicCert pub credential * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -147,7 +147,7 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest005, TestSize.Level0) { uint8_t uriData[] = "inner005"; struct CmBlob uri = { sizeof(uriData), uriData }; - int32_t ret = CmUninstallAppCert(&uri, CM_CREDENTIAL_STORE); + int32_t ret = CmUninstallPublicCert(&uri, CM_CREDENTIAL_STORE); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); } @@ -165,7 +165,7 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest006, TestSize.Level0) /** * @tc.name: CmInnerPermissionTest007 -* @tc.desc: test CmGetAppCertList pub +* @tc.desc: test CmGetAllPublicCertList pub * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -174,13 +174,13 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest007, TestSize.Level0) struct CredentialAbstract abstract[MAX_COUNT_CERTIFICATE]; (void)memset_s(abstract, sizeof(abstract), 0, sizeof(abstract)); struct CredentialList certList = { MAX_COUNT_CERTIFICATE, abstract }; - int32_t ret = CmGetAppCertList(CM_CREDENTIAL_STORE, &certList); + int32_t ret = CmGetAllPublicCertList(CM_CREDENTIAL_STORE, &certList); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); } /** * @tc.name: CmInnerPermissionTest008 -* @tc.desc: test CmGetAppCertList pri +* @tc.desc: test CmGetAllPublicCertList pri * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -189,13 +189,13 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest008, TestSize.Level0) struct CredentialAbstract abstract[MAX_COUNT_CERTIFICATE]; (void)memset_s(abstract, sizeof(abstract), 0, sizeof(abstract)); struct CredentialList certList = { MAX_COUNT_CERTIFICATE, abstract }; - int32_t ret = CmGetAppCertList(CM_PRI_CREDENTIAL_STORE, &certList); + int32_t ret = CmGetAllPublicCertList(CM_PRI_CREDENTIAL_STORE, &certList); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); } /** * @tc.name: CmInnerPermissionTest009 -* @tc.desc: test CmGetAppCert pub +* @tc.desc: test CmGetPublicCert pub * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -210,7 +210,7 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest009, TestSize.Level0) uint8_t uriData[] = "oh:t=ak;o=inner009;u=0;a=0"; struct CmBlob uri = { sizeof(uriData), uriData }; - int32_t ret = CmGetAppCert(&uri, CM_CREDENTIAL_STORE, &cred); + int32_t ret = CmGetPublicCert(&uri, CM_CREDENTIAL_STORE, &cred); EXPECT_NE(ret, CMR_ERROR_PERMISSION_DENIED); free(cred.credData.data); @@ -218,7 +218,7 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest009, TestSize.Level0) /** * @tc.name: CmInnerPermissionTest010 -* @tc.desc: test CmGetUserCertList +* @tc.desc: test CmGetAllUserCertList * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -228,7 +228,7 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest010, TestSize.Level0) int32_t ret = InitCertList(&certList); ASSERT_EQ(ret, CM_SUCCESS); - ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList); + ret = CmGetAllUserCertList(CM_USER_TRUSTED_STORE, certList); EXPECT_EQ(ret, CM_SUCCESS); FreeCertList(certList); @@ -317,7 +317,7 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest015, TestSize.Level0) /** * @tc.name: CmInnerPermissionTest016 -* @tc.desc: test CmGrantAppCertificate +* @tc.desc: test CmGrantPublicCertificate * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -328,7 +328,7 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest016, TestSize.Level0) uint8_t authUriData[] = "inner016"; struct CmBlob authUri = { sizeof(authUriData), authUriData }; - int32_t ret = CmGrantAppCertificate(&uri, 0, &authUri); + int32_t ret = CmGrantPublicCertificate(&uri, 0, &authUri); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); } @@ -364,7 +364,7 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest018, TestSize.Level0) /** * @tc.name: CmInnerPermissionTest019 -* @tc.desc: test CmRemoveGrantedApp +* @tc.desc: test CmRemoveGrantedPublic * @tc.type: FUNC * @tc.require: AR000H0MIA /SR000H09NA */ @@ -372,7 +372,7 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest019, TestSize.Level0) { uint8_t uriData[] = "inner019"; struct CmBlob uri = { sizeof(uriData), uriData }; - int32_t ret = CmRemoveGrantedApp(&uri, 0); + int32_t ret = CmRemoveGrantedPublic(&uri, 0); EXPECT_EQ(ret, CMR_ERROR_PERMISSION_DENIED); } @@ -431,12 +431,12 @@ HWTEST_F(CmInnerPermissionTest, CmInnerPermissionTest020, TestSize.Level0) cred.credData.size = MAX_LEN_CERTIFICATE_CHAIN; cred.credData.data = static_cast(malloc(MAX_LEN_CERTIFICATE_CHAIN)); ASSERT_TRUE(cred.credData.data != nullptr); - ret = CmGetAppCert(&keyUri, CM_PRI_CREDENTIAL_STORE, &cred); + ret = CmGetPublicCert(&keyUri, CM_PRI_CREDENTIAL_STORE, &cred); EXPECT_EQ(ret, CM_SUCCESS); free(cred.credData.data); /* uninstall pri app cert */ - ret = CmUninstallAppCert(&keyUri, CM_PRI_CREDENTIAL_STORE); + ret = CmUninstallPublicCert(&keyUri, CM_PRI_CREDENTIAL_STORE); EXPECT_EQ(ret, CM_SUCCESS); } } // end of namespace diff --git a/test/unittest/multi_thread_test/src/cm_app_cert_multi_thread_test.cpp b/test/unittest/multi_thread_test/src/cm_app_cert_multi_thread_test.cpp index 9811063bc1af4c503e946ca31a39c9152c51b2f5..3affd7dbc3befd962a2441a610351183404dfa9e 100644 --- a/test/unittest/multi_thread_test/src/cm_app_cert_multi_thread_test.cpp +++ b/test/unittest/multi_thread_test/src/cm_app_cert_multi_thread_test.cpp @@ -67,7 +67,7 @@ void CmAppCertMultiThreadTest::TearDown() */ HWMTEST_F(CmAppCertMultiThreadTest, CmAppCertMultiThreadTest001, TestSize.Level0, MULTI_THREAD_NUM) { - int32_t ret = CmUninstallAppCert(nullptr, CM_CREDENTIAL_STORE); + int32_t ret = CmUninstallPublicCert(nullptr, CM_CREDENTIAL_STORE); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "CmAppCertMultiThreadTest001 test failed, retcode:" << ret; } @@ -82,7 +82,7 @@ HWMTEST_F(CmAppCertMultiThreadTest, CmAppCertMultiThreadTest002, TestSize.Level0 uint8_t keyUriBuf[] = "oh:t=ak;o=keyA;u=0;a=0"; struct CmBlob keyUri = { sizeof(keyUriBuf), keyUriBuf }; - int32_t ret = CmUninstallAppCert(&keyUri, CM_PRI_CREDENTIAL_STORE + 1); + int32_t ret = CmUninstallPublicCert(&keyUri, CM_PRI_CREDENTIAL_STORE + 1); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "CmAppCertMultiThreadTest002 test failed, retcode:" << ret; } @@ -118,10 +118,10 @@ HWTEST_F(CmAppCertMultiThreadTest, CmAppCertMultiThreadTest004, TestSize.Level0) uint8_t uriBuf[MAX_LEN_URI] = {0}; struct CmBlob keyUri = { sizeof(uriBuf), uriBuf }; - int32_t ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "CmAppCertMultiThreadTest004 1 failed, retcode:" << ret; - ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); + ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "CmAppCertMultiThreadTest004 2 failed, retcode:" << ret; SET_THREAD_NUM(MULTI_THREAD_NUM); diff --git a/test/unittest/multi_thread_test/src/cm_get_auth_list_multi_thread_test.cpp b/test/unittest/multi_thread_test/src/cm_get_auth_list_multi_thread_test.cpp index f93d341fc7bcab9fcd111ef3a66c1bbe8e58884f..29d4aea2456ff80dfcef694f5df4c0f1a81ee94c 100644 --- a/test/unittest/multi_thread_test/src/cm_get_auth_list_multi_thread_test.cpp +++ b/test/unittest/multi_thread_test/src/cm_get_auth_list_multi_thread_test.cpp @@ -69,14 +69,14 @@ void CmGetAuthListMultiThreadTest::SetUp() uint8_t authUriData[DEFAULT_AUTH_URI_LEN] = {0}; struct CmBlob authUri = { DEFAULT_AUTH_URI_LEN, authUriData }; - ret = CmGrantAppCertificate(&g_keyUri, appId, &authUri); - EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantAppCertificate failed, retcode:" << ret; + ret = CmGrantPublicCertificate(&g_keyUri, appId, &authUri); + EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantPublicCertificate failed, retcode:" << ret; } void CmGetAuthListMultiThreadTest::TearDown() { - int32_t ret = CmUninstallAppCert(&g_keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + int32_t ret = CmUninstallPublicCert(&g_keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; uint32_t appUid[DEFAULT_APP_UID_COUNT] = {0}; struct CmAppUidList appUidList = { DEFAULT_APP_UID_COUNT, appUid }; @@ -93,8 +93,8 @@ static void TestRemoveGrant(uint32_t count, uint32_t baseAppId) uint32_t appId; for (uint32_t i = 0; i < count; ++i) { appId = baseAppId + i; - ret = CmRemoveGrantedApp(&g_keyUri, appId); - EXPECT_EQ(ret, CM_SUCCESS) << "CmRemoveGrantedApp failed, retcode:" << ret; + ret = CmRemoveGrantedPublic(&g_keyUri, appId); + EXPECT_EQ(ret, CM_SUCCESS) << "CmRemoveGrantedPublic failed, retcode:" << ret; } } @@ -108,8 +108,8 @@ static void TestGrant(uint32_t count, uint32_t baseAppId) for (uint32_t i = 0; i < count; ++i) { appId = baseAppId + i; authUri.size = DEFAULT_AUTH_URI_LEN; - ret = CmGrantAppCertificate(&g_keyUri, appId, &authUri); - EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantAppCertificate failed, retcode:" << ret; + ret = CmGrantPublicCertificate(&g_keyUri, appId, &authUri); + EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantPublicCertificate failed, retcode:" << ret; ret = CmIsAuthorizedApp(&authUri); EXPECT_EQ(ret, CM_SUCCESS) << "CmIsAuthorizedApp failed, retcode:" << ret; } diff --git a/test/unittest/multi_thread_test/src/cm_grant_multi_thread_test.cpp b/test/unittest/multi_thread_test/src/cm_grant_multi_thread_test.cpp index 6980a12b2855c3d06cf38b5cb829d61437d748e5..03f10049cf5ff80b4ef995eb1e538f2d55c0a545 100644 --- a/test/unittest/multi_thread_test/src/cm_grant_multi_thread_test.cpp +++ b/test/unittest/multi_thread_test/src/cm_grant_multi_thread_test.cpp @@ -83,8 +83,8 @@ static void TestGrantAppCertificate(void) appId += i; } authUri.size = DEFAULT_AUTH_URI_LEN; /* clear authUri size */ - ret = CmGrantAppCertificate(&keyUri, appId, &authUri); - EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantAppCertificate failed, retcode:" << ret; + ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); + EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantPublicCertificate failed, retcode:" << ret; } } @@ -92,8 +92,8 @@ static void TestGrantAppCertificateAfterAction(void) { uint8_t uriData[] = "oh:t=ak;o=TestNormalGrant;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; - int32_t ret = CmUninstallAppCert(&keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + int32_t ret = CmUninstallPublicCert(&keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; } /** @@ -111,7 +111,7 @@ HWMTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest001, TestSize.Level0, MU uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -131,7 +131,7 @@ HWMTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest002, TestSize.Level0, MU uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -151,7 +151,7 @@ HWMTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest003, TestSize.Level0, MU uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -171,7 +171,7 @@ HWMTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest004, TestSize.Level0, MU uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -192,7 +192,7 @@ HWMTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest005, TestSize.Level0, MU uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_NOT_EXIST); } @@ -213,7 +213,7 @@ HWMTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest006, TestSize.Level0, MU uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_NOT_EXIST); } @@ -234,7 +234,7 @@ HWMTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest007, TestSize.Level0, MU uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_NOT_EXIST); } @@ -255,7 +255,7 @@ HWMTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest008, TestSize.Level0, MU uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_NOT_EXIST); } @@ -272,7 +272,7 @@ HWMTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest009, TestSize.Level0, MU uint32_t appId = DEFAULT_APP_ID; struct CmBlob *authUri = nullptr; /* authUri nullptr */ - int32_t ret = CmGrantAppCertificate(&keyUri, appId, authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -292,7 +292,7 @@ HWMTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest010, TestSize.Level0, MU uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -309,7 +309,7 @@ HWMTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest011, TestSize.Level0, MU struct CmBlob authUri = { DEFAULT_AUTH_URI_LEN, nullptr }; /* authUri data is NULL */ uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -369,8 +369,8 @@ static void TestBufferTooSmall(void) struct CmBlob authUri = { INVALID_AUTH_URI_LEN, authUriData }; uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); - EXPECT_EQ(ret, CMR_ERROR_BUFFER_TOO_SMALL) << "CmGrantAppCertificate failed, retcode:" << ret; + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); + EXPECT_EQ(ret, CMR_ERROR_BUFFER_TOO_SMALL) << "CmGrantPublicCertificate failed, retcode:" << ret; } /** @@ -392,8 +392,8 @@ HWTEST_F(CmGrantMultiThreadTest, CmGrantMultiThreadTest015, TestSize.Level0) SET_THREAD_NUM(MULTI_THREAD_NUM); GTEST_RUN_TASK(TestBufferTooSmall); - ret = CmUninstallAppCert(&keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + ret = CmUninstallPublicCert(&keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; } } // end of namespace diff --git a/test/unittest/multi_thread_test/src/cm_remove_grant_multi_thread_test.cpp b/test/unittest/multi_thread_test/src/cm_remove_grant_multi_thread_test.cpp index 46d9fac3917f64675ac357be56ff6cb377392d1f..f0ff9b0357c722559926d0b0b67e70ba937bfbd7 100644 --- a/test/unittest/multi_thread_test/src/cm_remove_grant_multi_thread_test.cpp +++ b/test/unittest/multi_thread_test/src/cm_remove_grant_multi_thread_test.cpp @@ -74,8 +74,8 @@ static void TestRemoveGrantPreAction(void) struct CmBlob authUri = { DEFAULT_AUTH_URI_LEN, authUriData }; uint32_t appId = DEFAULT_APP_ID; - ret = CmGrantAppCertificate(&keyUri, appId, &authUri); - EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantAppCertificate failed, retcode:" << ret; + ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); + EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantPublicCertificate failed, retcode:" << ret; } static void TestRemoveGrant(void) @@ -85,8 +85,8 @@ static void TestRemoveGrant(void) struct CmBlob keyUri = { sizeof(uriData), uriData }; for (uint32_t i = 0; i < g_removeCount; ++i) { - ret = CmRemoveGrantedApp(&keyUri, g_removeAppUid); - EXPECT_EQ(ret, CM_SUCCESS) << "CmRemoveGrantedApp failed, index:" << i << ", retcode:" << ret; + ret = CmRemoveGrantedPublic(&keyUri, g_removeAppUid); + EXPECT_EQ(ret, CM_SUCCESS) << "CmRemoveGrantedPublic failed, index:" << i << ", retcode:" << ret; } } @@ -95,8 +95,8 @@ static void TestRemoveGrantAfterAction(void) uint8_t uriData[] = "oh:t=ak;o=TestRemoveGrant;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; - int32_t ret = CmUninstallAppCert(&keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + int32_t ret = CmUninstallPublicCert(&keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; } /** @@ -109,7 +109,7 @@ HWMTEST_F(CmRemoveGrantMultiThreadTest, CmRemoveGrantMultiThreadTest001, TestSiz { struct CmBlob *keyUri = nullptr; /* keyUri is NULL */ uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -124,7 +124,7 @@ HWMTEST_F(CmRemoveGrantMultiThreadTest, CmRemoveGrantMultiThreadTest002, TestSiz uint8_t uriData[] = "oh:t=ak;o=keyA;u=0;a=0"; struct CmBlob keyUri = { 0, uriData }; /* keyUri size is 0 */ uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -139,7 +139,7 @@ HWMTEST_F(CmRemoveGrantMultiThreadTest, CmRemoveGrantMultiThreadTest003, TestSiz uint8_t uriData[] = "oh:t=ak;o=keyA;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), nullptr }; /* keyUri data is null */ uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -154,7 +154,7 @@ HWMTEST_F(CmRemoveGrantMultiThreadTest, CmRemoveGrantMultiThreadTest004, TestSiz uint8_t uriData[] = "oh:t=ak;o=keyA;u=0;a=0"; struct CmBlob keyUri = { strlen((char *)uriData), uriData }; /* keyUri data not end of '\0' */ uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -170,7 +170,7 @@ HWMTEST_F(CmRemoveGrantMultiThreadTest, CmRemoveGrantMultiThreadTest005, TestSiz uint8_t uriData[] = "oh:t=ak;o=keyA;u=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -186,7 +186,7 @@ HWMTEST_F(CmRemoveGrantMultiThreadTest, CmRemoveGrantMultiThreadTest006, TestSiz uint8_t uriData[] = "oh:t=ak;o=keyA;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -202,7 +202,7 @@ HWMTEST_F(CmRemoveGrantMultiThreadTest, CmRemoveGrantMultiThreadTest007, TestSiz uint8_t uriData[] = "oh:t=ak;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -218,7 +218,7 @@ HWMTEST_F(CmRemoveGrantMultiThreadTest, CmRemoveGrantMultiThreadTest008, TestSiz uint8_t uriData[] = "oh:t=m;o=keyA;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -233,7 +233,7 @@ HWMTEST_F(CmRemoveGrantMultiThreadTest, CmRemoveGrantMultiThreadTest009, TestSiz uint8_t uriData[] = "oh:t=ak;o=keyA;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CM_SUCCESS); } diff --git a/test/unittest/src/cm_abort_test.cpp b/test/unittest/src/cm_abort_test.cpp index 8a2d76d4f43b31e8afe9acd10de7e5f5479999bf..0d9a6009b1c74965c381fc748922214c923f5a5e 100755 --- a/test/unittest/src/cm_abort_test.cpp +++ b/test/unittest/src/cm_abort_test.cpp @@ -129,8 +129,8 @@ HWTEST_F(CmAbortTest, CmAbortTest005, TestSize.Level0) ret = CmAbort(&handle); EXPECT_EQ(ret, CM_SUCCESS) << "CmAbort failed, retcode:" << ret; - ret = CmUninstallAppCert(&keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + ret = CmUninstallPublicCert(&keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; } /** diff --git a/test/unittest/src/cm_app_cert_test.cpp b/test/unittest/src/cm_app_cert_test.cpp index ec0a10d232c95b41dc3042000b9edab5706f4026..3e38631195853a6fcf1c5b851323ce6abf5344bb 100644 --- a/test/unittest/src/cm_app_cert_test.cpp +++ b/test/unittest/src/cm_app_cert_test.cpp @@ -136,10 +136,10 @@ HWTEST_F(CmAppCertTest, AppCertInstallBaseTest001, TestSize.Level0) uint8_t certAliasBuf[] = "keyA"; struct CmBlob certAlias = { sizeof(certAliasBuf), certAliasBuf }; - int32_t ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "AppCertInstallBaseTest001 credentail test failed, retcode:" << ret; - ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); + ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "AppCertInstallBaseTest001 pri_credentail test failed, retcode:" << ret; char uriBuf[] = "oh:t=ak;o=keyA;u=0;a=0"; @@ -163,10 +163,10 @@ HWTEST_F(CmAppCertTest, AppCertInstallBaseTest002, TestSize.Level0) uint8_t certAliasBuf[] = "keyA"; struct CmBlob certAlias = { sizeof(certAliasBuf), certAliasBuf }; - int32_t ret = CmInstallAppCert(&g_appCert, &appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&g_appCert, &appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_FAILURE) << "AppCertInstallBaseTest002 credentail test failed, retcode:" << ret; - ret = CmInstallAppCert(&g_appCert, &appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); + ret = CmInstallPublicCert(&g_appCert, &appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_FAILURE) << "AppCertInstallBaseTest002 pri_credentail test failed, retcode:" << ret; } @@ -186,10 +186,10 @@ HWTEST_F(CmAppCertTest, AppCertInstallTest003, TestSize.Level0) uint8_t keyUriBuf[MAX_LEN_URI] = {0}; struct CmBlob keyUri = { sizeof(keyUriBuf), keyUriBuf }; - int32_t ret = CmInstallAppCert(&appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_FAILURE) << "AppCertInstallTest003 credentail test failed, retcode:" << ret; - ret = CmInstallAppCert(&appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); + ret = CmInstallPublicCert(&appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_FAILURE) << "AppCertInstallTest003 pri_credentail test failed, retcode:" << ret; } @@ -207,10 +207,10 @@ HWTEST_F(CmAppCertTest, AppCertInstallAbnormalTest004, TestSize.Level0) uint8_t keyUriBuf[MAX_LEN_URI] = {0}; struct CmBlob keyUri = { sizeof(keyUriBuf), keyUriBuf }; - int32_t ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE + 1, &keyUri); + int32_t ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE + 1, &keyUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "AppCertInstallAbnormalTest004 test failed, retcode:" << ret; - ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE + 1, &keyUri); + ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE + 1, &keyUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "AppCertInstallAbnormalTest004 privite test failed, retcode:" << ret; } @@ -228,10 +228,10 @@ HWTEST_F(CmAppCertTest, AppCertInstallBaseEccTest005, TestSize.Level0) uint8_t certAliasBuf[] = "keyB"; struct CmBlob certAlias = { sizeof(certAliasBuf), certAliasBuf }; - int32_t ret = CmInstallAppCert(&g_eccAppCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&g_eccAppCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "AppCertInstallBaseEccTest005 test failed, retcode:" << ret; - ret = CmInstallAppCert(&g_eccAppCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); + ret = CmInstallPublicCert(&g_eccAppCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "AppCertInstallBaseEccTest005 privite test failed, retcode:" << ret; ret = CmUninstallAllAppCert(); @@ -252,7 +252,7 @@ HWTEST_F(CmAppCertTest, AppCertInstallAbnormalTest005, TestSize.Level0) uint8_t aliasBuf[] = "keyB"; struct CmBlob certAlias = { sizeof(aliasBuf) - 1, aliasBuf }; /* not include '\0' */ - int32_t ret = CmInstallAppCert(&g_eccAppCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&g_eccAppCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "AppCertInstallAbnormalTest005 test failed, retcode:" << ret; } @@ -273,7 +273,7 @@ HWTEST_F(CmAppCertTest, AppCertInstallAbnormalTest006, TestSize.Level0) uint8_t pwdBuf[] = "123"; struct CmBlob pwd = { sizeof(pwdBuf) - 1, pwdBuf }; /* not include '\0' */ - int32_t ret = CmInstallAppCert(&g_eccAppCert, &pwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&g_eccAppCert, &pwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "AppCertInstallAbnormalTest006 test failed, retcode:" << ret; } @@ -291,7 +291,7 @@ HWTEST_F(CmAppCertTest, CmGetAppCertBaseTest001, TestSize.Level0) uint8_t uriBuf[MAX_LEN_URI] = {0}; struct CmBlob retUri = { sizeof(uriBuf), uriBuf }; - int32_t ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &retUri); + int32_t ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &retUri); EXPECT_EQ(ret, CM_SUCCESS) << "CmGetAppCertBaseTest001 test failed, retcode:" << ret; struct Credential certificate; @@ -300,7 +300,7 @@ HWTEST_F(CmAppCertTest, CmGetAppCertBaseTest001, TestSize.Level0) ASSERT_TRUE(certificate.credData.data != nullptr); certificate.credData.size = MAX_LEN_CERTIFICATE_CHAIN; - ret = CmGetAppCert(&retUri, CM_CREDENTIAL_STORE, &certificate); + ret = CmGetPublicCert(&retUri, CM_CREDENTIAL_STORE, &certificate); EXPECT_EQ(ret, CM_SUCCESS) << "CmGetAppCertBaseTest001 test failed, retcode:" << ret; FreeCMBlobData(&certificate.credData); @@ -321,7 +321,7 @@ HWTEST_F(CmAppCertTest, CmGetAppCertPerformanceTest002, TestSize.Level0) uint8_t uriBuf[MAX_LEN_URI] = {0}; struct CmBlob retUri = { sizeof(uriBuf), uriBuf }; - int32_t ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &retUri); + int32_t ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &retUri); EXPECT_EQ(ret, CM_SUCCESS) << "CmGetAppCertPerformanceTest002 install failed, retcode:" << ret; struct Credential certificate; @@ -331,7 +331,7 @@ HWTEST_F(CmAppCertTest, CmGetAppCertPerformanceTest002, TestSize.Level0) ASSERT_TRUE(certificate.credData.data != nullptr); certificate.credData.size = MAX_LEN_CERTIFICATE_CHAIN; - ret = CmGetAppCert(&retUri, CM_CREDENTIAL_STORE, &certificate); + ret = CmGetPublicCert(&retUri, CM_CREDENTIAL_STORE, &certificate); EXPECT_EQ(ret, CM_SUCCESS) << "CmGetAppCertPerformanceTest002 get failed,retcode:" << ret; EXPECT_EQ(CompareCredential(&certificate, &(g_credentialexpectResult[0].certificate)), true); @@ -353,7 +353,7 @@ HWTEST_F(CmAppCertTest, CmGetAppBaseCertTest003, TestSize.Level0) uint8_t uriBuf[MAX_LEN_URI] = {0}; struct CmBlob retUri = { sizeof(uriBuf), uriBuf }; - int32_t ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &retUri); + int32_t ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &retUri); EXPECT_EQ(ret, CM_SUCCESS) << "CmGetAppBaseCertTest003 install failed, retcode:" << ret; struct Credential firstcertificate; @@ -362,8 +362,8 @@ HWTEST_F(CmAppCertTest, CmGetAppBaseCertTest003, TestSize.Level0) ASSERT_TRUE(firstcertificate.credData.data != nullptr); firstcertificate.credData.size = MAX_LEN_CERTIFICATE_CHAIN; - ret = CmGetAppCert(&retUri, CM_CREDENTIAL_STORE, &firstcertificate); - EXPECT_EQ(ret, CM_SUCCESS) << "first CmGetAppCert failed, retcode:" << ret; + ret = CmGetPublicCert(&retUri, CM_CREDENTIAL_STORE, &firstcertificate); + EXPECT_EQ(ret, CM_SUCCESS) << "first CmGetPublicCert failed, retcode:" << ret; struct Credential secondcertificate; (void)memset_s(&secondcertificate, sizeof(Credential), 0, sizeof(Credential)); @@ -371,8 +371,8 @@ HWTEST_F(CmAppCertTest, CmGetAppBaseCertTest003, TestSize.Level0) ASSERT_TRUE(secondcertificate.credData.data != nullptr); secondcertificate.credData.size = MAX_LEN_CERTIFICATE_CHAIN; - ret = CmGetAppCert(&retUri, CM_CREDENTIAL_STORE, &secondcertificate); - EXPECT_EQ(ret, CM_SUCCESS) << "second CmGetAppCert failed, retcode:" << ret; + ret = CmGetPublicCert(&retUri, CM_CREDENTIAL_STORE, &secondcertificate); + EXPECT_EQ(ret, CM_SUCCESS) << "second CmGetPublicCert failed, retcode:" << ret; EXPECT_EQ(CompareCredential(&firstcertificate, &secondcertificate), true); FreeCMBlobData(&(firstcertificate.credData)); @@ -396,13 +396,13 @@ HWTEST_F(CmAppCertTest, CmGetAppCertAbnormalTest004, TestSize.Level0) ASSERT_TRUE(certificate.credData.data != nullptr); certificate.credData.size = MAX_LEN_CERTIFICATE_CHAIN; - int32_t ret = CmGetAppCert(nullptr, CM_CREDENTIAL_STORE, &certificate); + int32_t ret = CmGetPublicCert(nullptr, CM_CREDENTIAL_STORE, &certificate); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "CmGetAppCertAbnormalTest004 01 failed, retcode:" << ret; - ret = CmGetAppCert(&keyUri, CM_CREDENTIAL_STORE, nullptr); + ret = CmGetPublicCert(&keyUri, CM_CREDENTIAL_STORE, nullptr); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "CmGetAppCertAbnormalTest004 02 failed, retcode:" << ret; - ret = CmGetAppCert(&keyUri, CM_PRI_CREDENTIAL_STORE + 1, &certificate); + ret = CmGetPublicCert(&keyUri, CM_PRI_CREDENTIAL_STORE + 1, &certificate); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "CmGetAppCertAbnormalTest004 03 failed, retcode:" << ret; ret = CmUninstallAllAppCert(); @@ -425,10 +425,10 @@ HWTEST_F(CmAppCertTest, CmGetAppCertListPerformanceTest001, TestSize.Level0) uint8_t uriBuf[MAX_LEN_URI] = {0}; struct CmBlob keyUri = { sizeof(uriBuf), uriBuf }; - int32_t ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "CmGetAppCertListPerformanceTest001 install failed, retcode:" << ret; - ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); + ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "CmGetAppCertListPerformanceTest001 private install failed, retcode:" << ret; struct CredentialList certificateList = { 0, nullptr }; @@ -440,7 +440,7 @@ HWTEST_F(CmAppCertTest, CmGetAppCertListPerformanceTest001, TestSize.Level0) for (uint32_t i = 0; i < times; i++) { certificateList.credentialCount = MAX_COUNT_CERTIFICATE; (void)memset_s(certificateList.credentialAbstract, buffSize, 0, buffSize); - ret = CmGetAppCertList(CM_PRI_CREDENTIAL_STORE, &certificateList); + ret = CmGetAllPublicCertList(CM_PRI_CREDENTIAL_STORE, &certificateList); EXPECT_EQ(ret, CM_SUCCESS) << "CmGetAppCertListTest test failed, retcode:" << ret; } @@ -463,7 +463,7 @@ HWTEST_F(CmAppCertTest, CmGetAppCertListBaseTest002, TestSize.Level0) uint8_t uriBuf[MAX_LEN_URI] = {0}; struct CmBlob keyUri = { sizeof(uriBuf), uriBuf }; - int32_t ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "CmGetAppCertListBaseTest002 install failed, retcode:" << ret; struct CredentialList certificateList = { 0, nullptr }; @@ -473,7 +473,7 @@ HWTEST_F(CmAppCertTest, CmGetAppCertListBaseTest002, TestSize.Level0) certificateList.credentialCount = MAX_COUNT_CERTIFICATE; (void)memset_s(certificateList.credentialAbstract, buffSize, 0, buffSize); - ret = CmGetAppCertList(CM_CREDENTIAL_STORE, &certificateList); + ret = CmGetAllPublicCertList(CM_CREDENTIAL_STORE, &certificateList); EXPECT_EQ(ret, CM_SUCCESS) << "CmGetAppCertListBaseTest002 test failed, retcode:" << ret; uint32_t length = sizeof(g_expectList) / sizeof(g_expectList[0]); @@ -495,7 +495,7 @@ HWTEST_F(CmAppCertTest, CmGetAppCertListBaseTest002, TestSize.Level0) */ HWTEST_F(CmAppCertTest, CmGetAppCertListBaseTest003, TestSize.Level0) { - int32_t ret = CmGetAppCertList(CM_CREDENTIAL_STORE, nullptr); + int32_t ret = CmGetAllPublicCertList(CM_CREDENTIAL_STORE, nullptr); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "Abnormal CmGetAppCertListBaseTest003 test failed, retcode:" << ret; } @@ -514,7 +514,7 @@ HWTEST_F(CmAppCertTest, CmGetAppCertListAbnormalTest004, TestSize.Level0) certificateList.credentialCount = MAX_COUNT_CERTIFICATE; (void)memset_s(certificateList.credentialAbstract, buffSize, 0, buffSize); - int32_t ret = CmGetAppCertList(CM_PRI_CREDENTIAL_STORE + 1, &certificateList); + int32_t ret = CmGetAllPublicCertList(CM_PRI_CREDENTIAL_STORE + 1, &certificateList); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "Abnormal AppCertInstallTest04 test failed, retcode:" << ret; if (certificateList.credentialAbstract != nullptr) { @@ -536,10 +536,10 @@ HWTEST_F(CmAppCertTest, AppCertUnInstallBaseTest001, TestSize.Level0) uint8_t uriBuf[MAX_LEN_URI] = {0}; struct CmBlob retUri = { sizeof(uriBuf), uriBuf }; - int32_t ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &retUri); + int32_t ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &retUri); EXPECT_EQ(ret, CM_SUCCESS) << "AppCertUnInstallBaseTest001 install failed, retcode:" << ret; - ret = CmUninstallAppCert(&retUri, CM_CREDENTIAL_STORE); + ret = CmUninstallPublicCert(&retUri, CM_CREDENTIAL_STORE); EXPECT_EQ(ret, CM_SUCCESS) << "AppCertUnInstallBaseTest001 uninstall failed, retcode:" << ret; } @@ -551,7 +551,7 @@ HWTEST_F(CmAppCertTest, AppCertUnInstallBaseTest001, TestSize.Level0) */ HWTEST_F(CmAppCertTest, AppCertUnInstallAbnormalTest002, TestSize.Level0) { - int32_t ret = CmUninstallAppCert(nullptr, CM_CREDENTIAL_STORE); + int32_t ret = CmUninstallPublicCert(nullptr, CM_CREDENTIAL_STORE); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "AppCertUnInstallAbnormalTest002 test failed, retcode:" << ret; } @@ -566,7 +566,7 @@ HWTEST_F(CmAppCertTest, AppCertUnInstallAbnormalTest003, TestSize.Level0) uint8_t keyUriBuf[] = "oh:t=ak;o=keyA;u=0;a=0"; struct CmBlob keyUri = { sizeof(keyUriBuf), keyUriBuf }; - int32_t ret = CmUninstallAppCert(&keyUri, CM_PRI_CREDENTIAL_STORE + 1); + int32_t ret = CmUninstallPublicCert(&keyUri, CM_PRI_CREDENTIAL_STORE + 1); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "AppCertUnInstallAbnormalTest003 test failed, retcode:" << ret; } @@ -584,10 +584,10 @@ HWTEST_F(CmAppCertTest, AppCertUnInstallAllAppCertBaseTest001, TestSize.Level0) uint8_t uriBuf[MAX_LEN_URI] = {0}; struct CmBlob keyUri = { sizeof(uriBuf), uriBuf }; - int32_t ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "AppCertUnInstallAllAppCertBaseTest001 1 failed, retcode:" << ret; - ret = CmInstallAppCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); + ret = CmInstallPublicCert(&g_appCert, &g_appCertPwd, &certAlias, CM_PRI_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "AppCertUnInstallAllAppCertBaseTest001 2 failed, retcode:" << ret; ret = CmUninstallAllAppCert(); @@ -625,10 +625,10 @@ HWTEST_F(CmAppCertTest, AppCertInstallPwdTest001, TestSize.Level0) uint8_t certAliasBuf[] = "keyA"; struct CmBlob certAlias = { sizeof(certAliasBuf), certAliasBuf }; - int32_t ret = CmInstallAppCert(&appCert, &appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&appCert, &appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "AppCertInstallPwdTest001 12 bytes sepcial pwd test failed, retcode:" << ret; - (void)CmUninstallAppCert(&keyUri, CM_CREDENTIAL_STORE); + (void)CmUninstallPublicCert(&keyUri, CM_CREDENTIAL_STORE); } /** @@ -650,10 +650,10 @@ HWTEST_F(CmAppCertTest, AppCertInstallPwdTest002, TestSize.Level0) uint8_t certAliasBuf[] = "keyA"; struct CmBlob certAlias = { sizeof(certAliasBuf), certAliasBuf }; - int32_t ret = CmInstallAppCert(&appCert, &appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&appCert, &appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CM_SUCCESS) << "AppCertInstallPwdTest002 32 bytes sepcial pwd test failed, retcode:" << ret; - (void)CmUninstallAppCert(&keyUri, CM_CREDENTIAL_STORE); + (void)CmUninstallPublicCert(&keyUri, CM_CREDENTIAL_STORE); } /** @@ -675,7 +675,7 @@ HWTEST_F(CmAppCertTest, AppCertInstallPwdTest003, TestSize.Level0) uint8_t certAliasBuf[] = "keyA"; struct CmBlob certAlias = { sizeof(certAliasBuf), certAliasBuf }; - int32_t ret = CmInstallAppCert(&appCert, &appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); + int32_t ret = CmInstallPublicCert(&appCert, &appCertPwd, &certAlias, CM_CREDENTIAL_STORE, &keyUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << \ "AppCertInstallPwdTest003 33 bytes sepcial pwd test failed, retcode:" << ret; } diff --git a/test/unittest/src/cm_finish_test.cpp b/test/unittest/src/cm_finish_test.cpp index 049e251ef2089a68fd28afb8021ecaafeb8f9710..f21f28b32623ae959cabb8bdbaa162b255f2dadb 100755 --- a/test/unittest/src/cm_finish_test.cpp +++ b/test/unittest/src/cm_finish_test.cpp @@ -72,8 +72,8 @@ static void TestInstallAppCert(uint32_t alg) static void TestUninstallAppCert(void) { - int32_t ret = CmUninstallAppCert(&g_keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + int32_t ret = CmUninstallPublicCert(&g_keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; } static void TestSign(const struct CmBlob *keyUri, const struct CmSignatureSpec *spec, diff --git a/test/unittest/src/cm_get_auth_list_test.cpp b/test/unittest/src/cm_get_auth_list_test.cpp index fe0e5299804a0daad1622934a0a1c39f14ecc13e..c223f129d132d37722e0d4472bb78203242d600e 100755 --- a/test/unittest/src/cm_get_auth_list_test.cpp +++ b/test/unittest/src/cm_get_auth_list_test.cpp @@ -64,14 +64,14 @@ void CmGetAuthListTest::SetUp() uint8_t authUriData[DEFAULT_AUTH_URI_LEN] = {0}; struct CmBlob authUri = { DEFAULT_AUTH_URI_LEN, authUriData }; - ret = CmGrantAppCertificate(&g_keyUri, appId, &authUri); - EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantAppCertificate failed, retcode:" << ret; + ret = CmGrantPublicCertificate(&g_keyUri, appId, &authUri); + EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantPublicCertificate failed, retcode:" << ret; } void CmGetAuthListTest::TearDown() { - int32_t ret = CmUninstallAppCert(&g_keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + int32_t ret = CmUninstallPublicCert(&g_keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; uint32_t appUid[DEFAULT_APP_UID_COUNT] = {0}; struct CmAppUidList appUidList = { DEFAULT_APP_UID_COUNT, appUid }; @@ -88,8 +88,8 @@ static void TestRemoveGrant(uint32_t count, uint32_t baseAppId) uint32_t appId; for (uint32_t i = 0; i < count; ++i) { appId = baseAppId + i; - ret = CmRemoveGrantedApp(&g_keyUri, appId); - EXPECT_EQ(ret, CM_SUCCESS) << "CmRemoveGrantedApp failed, retcode:" << ret; + ret = CmRemoveGrantedPublic(&g_keyUri, appId); + EXPECT_EQ(ret, CM_SUCCESS) << "CmRemoveGrantedPublic failed, retcode:" << ret; } } @@ -103,8 +103,8 @@ static void TestGrant(uint32_t count, uint32_t baseAppId) for (uint32_t i = 0; i < count; ++i) { appId = baseAppId + i; authUri.size = DEFAULT_AUTH_URI_LEN; - ret = CmGrantAppCertificate(&g_keyUri, appId, &authUri); - EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantAppCertificate failed, retcode:" << ret; + ret = CmGrantPublicCertificate(&g_keyUri, appId, &authUri); + EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantPublicCertificate failed, retcode:" << ret; ret = CmIsAuthorizedApp(&authUri); EXPECT_EQ(ret, CM_SUCCESS) << "CmIsAuthorizedApp failed, retcode:" << ret; } diff --git a/test/unittest/src/cm_grant_test.cpp b/test/unittest/src/cm_grant_test.cpp index 818f36c2691a56dd20f10dee0ce55fdf9fb807b6..6b246d5f24e59ffec2d557d84d9e2631b958e237 100755 --- a/test/unittest/src/cm_grant_test.cpp +++ b/test/unittest/src/cm_grant_test.cpp @@ -74,12 +74,12 @@ static void TestNormalGrant(uint32_t count, bool isSameUid) appId += i; } authUri.size = DEFAULT_AUTH_URI_LEN; /* clear authUri size */ - ret = CmGrantAppCertificate(&keyUri, appId, &authUri); - EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantAppCertificate failed, retcode:" << ret; + ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); + EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantPublicCertificate failed, retcode:" << ret; } - ret = CmUninstallAppCert(&keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + ret = CmUninstallPublicCert(&keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; } /** @@ -97,7 +97,7 @@ HWTEST_F(CmGrantTest, CmGrantTest001, TestSize.Level0) uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -117,7 +117,7 @@ HWTEST_F(CmGrantTest, CmGrantTest002, TestSize.Level0) uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -137,7 +137,7 @@ HWTEST_F(CmGrantTest, CmGrantTest003, TestSize.Level0) uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -157,7 +157,7 @@ HWTEST_F(CmGrantTest, CmGrantTest004, TestSize.Level0) uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -178,7 +178,7 @@ HWTEST_F(CmGrantTest, CmGrantTest005, TestSize.Level0) uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_NOT_EXIST); } @@ -199,7 +199,7 @@ HWTEST_F(CmGrantTest, CmGrantTest006, TestSize.Level0) uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_NOT_EXIST); } @@ -220,7 +220,7 @@ HWTEST_F(CmGrantTest, CmGrantTest007, TestSize.Level0) uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_NOT_EXIST); } @@ -241,7 +241,7 @@ HWTEST_F(CmGrantTest, CmGrantTest008, TestSize.Level0) uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_NOT_EXIST); } @@ -258,7 +258,7 @@ HWTEST_F(CmGrantTest, CmGrantTest009, TestSize.Level0) uint32_t appId = DEFAULT_APP_ID; struct CmBlob *authUri = nullptr; /* authUri nullptr */ - int32_t ret = CmGrantAppCertificate(&keyUri, appId, authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -278,7 +278,7 @@ HWTEST_F(CmGrantTest, CmGrantTest010, TestSize.Level0) uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -295,7 +295,7 @@ HWTEST_F(CmGrantTest, CmGrantTest011, TestSize.Level0) struct CmBlob authUri = { DEFAULT_AUTH_URI_LEN, nullptr }; /* authUri data is NULL */ uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, &authUri); + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -351,11 +351,11 @@ HWTEST_F(CmGrantTest, CmGrantTest015, TestSize.Level0) struct CmBlob authUri = { INVALID_AUTH_URI_LEN, authUriData }; uint32_t appId = DEFAULT_APP_ID; - ret = CmGrantAppCertificate(&keyUri, appId, &authUri); - EXPECT_EQ(ret, CMR_ERROR_BUFFER_TOO_SMALL) << "CmGrantAppCertificate failed, retcode:" << ret; + ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); + EXPECT_EQ(ret, CMR_ERROR_BUFFER_TOO_SMALL) << "CmGrantPublicCertificate failed, retcode:" << ret; - ret = CmUninstallAppCert(&keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + ret = CmUninstallPublicCert(&keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; } /** @@ -378,15 +378,15 @@ HWTEST_F(CmGrantTest, CmGrantTestPerformance016, TestSize.Level1) uint32_t appId = DEFAULT_APP_ID; for (uint32_t i = 0; i < PERFORMACE_COUNT; ++i) { - ret = CmGrantAppCertificate(&keyUri, appId, &authUri); - EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantAppCertificate failed, retcode:" << ret; + ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); + EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantPublicCertificate failed, retcode:" << ret; - ret = CmRemoveGrantedApp(&keyUri, appId); - EXPECT_EQ(ret, CM_SUCCESS) << "CmRemoveGrantedApp failed, retcode:" << ret; + ret = CmRemoveGrantedPublic(&keyUri, appId); + EXPECT_EQ(ret, CM_SUCCESS) << "CmRemoveGrantedPublic failed, retcode:" << ret; } - ret = CmUninstallAppCert(&keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + ret = CmUninstallPublicCert(&keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; } } // end of namespace diff --git a/test/unittest/src/cm_init_test.cpp b/test/unittest/src/cm_init_test.cpp index 3b8e4e498d79e6b0d14ff968d18b0b0fa039b5ea..5fc0bcaa92e1107098f7fe551c4e4a51b789dfb6 100755 --- a/test/unittest/src/cm_init_test.cpp +++ b/test/unittest/src/cm_init_test.cpp @@ -67,10 +67,10 @@ void CmInitTest::SetUp() void CmInitTest::TearDown() { - int32_t ret = CmUninstallAppCert(&g_rsaKeyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert rsa failed, retcode:" << ret; - ret = CmUninstallAppCert(&g_eccKeyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert ecc failed, retcode:" << ret; + int32_t ret = CmUninstallPublicCert(&g_rsaKeyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert rsa failed, retcode:" << ret; + ret = CmUninstallPublicCert(&g_eccKeyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert ecc failed, retcode:" << ret; } /** diff --git a/test/unittest/src/cm_is_authed_test.cpp b/test/unittest/src/cm_is_authed_test.cpp index ccff21164b86864645e3cbe30281376286618ec9..5e802a5d03bda7eddba85cc27299a3946388a797 100755 --- a/test/unittest/src/cm_is_authed_test.cpp +++ b/test/unittest/src/cm_is_authed_test.cpp @@ -58,8 +58,8 @@ void CmIsAuthedTest::TearDown() uint8_t uriData[] = "oh:t=ak;o=TestNormalGrant;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; - int32_t ret = CmUninstallAppCert(&keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + int32_t ret = CmUninstallPublicCert(&keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; } static void TestGrantApp(struct CmBlob *authUri) @@ -68,8 +68,8 @@ static void TestGrantApp(struct CmBlob *authUri) uint8_t uriData[] = "oh:t=ak;o=TestNormalGrant;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; - int32_t ret = CmGrantAppCertificate(&keyUri, appId, authUri); - EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantAppCertificate failed, retcode:" << ret; + int32_t ret = CmGrantPublicCertificate(&keyUri, appId, authUri); + EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantPublicCertificate failed, retcode:" << ret; } /** diff --git a/test/unittest/src/cm_remove_grant_test.cpp b/test/unittest/src/cm_remove_grant_test.cpp index d8fcd542b48f0b4d914abdabe7ed4c6c2d9b88c5..e2ad46b6be1863471d85de65e7add2964a6af369 100755 --- a/test/unittest/src/cm_remove_grant_test.cpp +++ b/test/unittest/src/cm_remove_grant_test.cpp @@ -69,16 +69,16 @@ static void TestRemoveGrant(uint32_t removeAppUid, uint32_t removeCount) struct CmBlob authUri = { DEFAULT_AUTH_URI_LEN, authUriData }; uint32_t appId = DEFAULT_APP_ID; - ret = CmGrantAppCertificate(&keyUri, appId, &authUri); - EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantAppCertificate failed, retcode:" << ret; + ret = CmGrantPublicCertificate(&keyUri, appId, &authUri); + EXPECT_EQ(ret, CM_SUCCESS) << "CmGrantPublicCertificate failed, retcode:" << ret; for (uint32_t i = 0; i < removeCount; ++i) { - ret = CmRemoveGrantedApp(&keyUri, removeAppUid); - EXPECT_EQ(ret, CM_SUCCESS) << "CmRemoveGrantedApp failed, index:" << i << ", retcode:" << ret; + ret = CmRemoveGrantedPublic(&keyUri, removeAppUid); + EXPECT_EQ(ret, CM_SUCCESS) << "CmRemoveGrantedPublic failed, index:" << i << ", retcode:" << ret; } - ret = CmUninstallAppCert(&keyUri, CM_CREDENTIAL_STORE); - EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallAppCert failed, retcode:" << ret; + ret = CmUninstallPublicCert(&keyUri, CM_CREDENTIAL_STORE); + EXPECT_EQ(ret, CM_SUCCESS) << "CmUninstallPublicCert failed, retcode:" << ret; } /** @@ -91,7 +91,7 @@ HWTEST_F(CmRemoveGrantTest, CmRemoveGrantTest001, TestSize.Level0) { struct CmBlob *keyUri = nullptr; /* keyUri is NULL */ uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -106,7 +106,7 @@ HWTEST_F(CmRemoveGrantTest, CmRemoveGrantTest002, TestSize.Level0) uint8_t uriData[] = "oh:t=ak;o=keyA;u=0;a=0"; struct CmBlob keyUri = { 0, uriData }; /* keyUri size is 0 */ uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -121,7 +121,7 @@ HWTEST_F(CmRemoveGrantTest, CmRemoveGrantTest003, TestSize.Level0) uint8_t uriData[] = "oh:t=ak;o=keyA;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), nullptr }; /* keyUri data is null */ uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -136,7 +136,7 @@ HWTEST_F(CmRemoveGrantTest, CmRemoveGrantTest004, TestSize.Level0) uint8_t uriData[] = "oh:t=ak;o=keyA;u=0;a=0"; struct CmBlob keyUri = { strlen((char *)uriData), uriData }; /* keyUri data not end of '\0' */ uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -152,7 +152,7 @@ HWTEST_F(CmRemoveGrantTest, CmRemoveGrantTest005, TestSize.Level0) uint8_t uriData[] = "oh:t=ak;o=keyA;u=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -168,7 +168,7 @@ HWTEST_F(CmRemoveGrantTest, CmRemoveGrantTest006, TestSize.Level0) uint8_t uriData[] = "oh:t=ak;o=keyA;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -184,7 +184,7 @@ HWTEST_F(CmRemoveGrantTest, CmRemoveGrantTest007, TestSize.Level0) uint8_t uriData[] = "oh:t=ak;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -200,7 +200,7 @@ HWTEST_F(CmRemoveGrantTest, CmRemoveGrantTest008, TestSize.Level0) uint8_t uriData[] = "oh:t=m;o=keyA;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -216,7 +216,7 @@ HWTEST_F(CmRemoveGrantTest, CmRemoveGrantTest0081, TestSize.Level0) uint8_t uriData[] = "oh:t=%;o=%1;u=%22;a=%3"; struct CmBlob keyUri = { sizeof(uriData), uriData }; uint32_t appId = 0; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT); } @@ -231,7 +231,7 @@ HWTEST_F(CmRemoveGrantTest, CmRemoveGrantTest009, TestSize.Level0) uint8_t uriData[] = "oh:t=ak;o=keyA;u=0;a=0"; struct CmBlob keyUri = { sizeof(uriData), uriData }; uint32_t appId = DEFAULT_APP_ID; - int32_t ret = CmRemoveGrantedApp(&keyUri, appId); + int32_t ret = CmRemoveGrantedPublic(&keyUri, appId); EXPECT_EQ(ret, CM_SUCCESS); } diff --git a/test/unittest/src/cm_test_common.cpp b/test/unittest/src/cm_test_common.cpp index 66dcbc6505376822ab5ae15da39dd505c5698d43..3071754556f272778f00c33fa258a7564e0b2f18 100644 --- a/test/unittest/src/cm_test_common.cpp +++ b/test/unittest/src/cm_test_common.cpp @@ -308,7 +308,7 @@ int32_t TestGenerateAppCert(const struct CmBlob *alias, uint32_t alg, uint32_t s struct CmBlob appCertPwd = { sizeof(g_certPwd), const_cast(g_certPwd) }; uint8_t uriData[MAX_LEN_URI] = {0}; struct CmBlob keyUri = { sizeof(uriData), uriData }; - return CmInstallAppCert(&appCert, &appCertPwd, alias, store, &keyUri); + return CmInstallPublicCert(&appCert, &appCertPwd, alias, store, &keyUri); } bool FindCertAbstract(const struct CertAbstract *abstract, const struct CertList *cList) diff --git a/test/unittest/src/cm_user_cert_test.cpp b/test/unittest/src/cm_user_cert_test.cpp index 5835fb8e0feaddb5b5f13d88dfc27bef9019b922..948672c288d0bb471cc82b5fdd914b9b650b11c5 100755 --- a/test/unittest/src/cm_user_cert_test.cpp +++ b/test/unittest/src/cm_user_cert_test.cpp @@ -683,7 +683,7 @@ HWTEST_F(CmUserCertTest, InstallUserCertTest007, TestSize.Level0) struct CmBlob certUri257 = { sizeof(certUriBuf257), certUriBuf257 }; ret = CmInstallUserTrustedCert(&userCertTest, &certAlias257, &certUri257); - EXPECT_EQ(ret, CM_FAILURE) << "Normal user cert Install test failed, recode:" << ret; + EXPECT_EQ(ret, CMR_ERROR_MAX_QUANTITY_REACHED) << "Normal user cert Install test failed, recode:" << ret; uint8_t certAliasBuf000[] = "alias0"; /* update 001th user cert */ uint8_t certUriBuf000[MAX_URI_LEN] = {0}; @@ -735,7 +735,7 @@ HWTEST_F(CmUserCertTest, InstallUserCertTest009, TestSize.Level0) struct CmBlob certUriTemp = { sizeof(certUriBuf), certUriBuf }; ret = CmInstallUserTrustedCert(&userCertTemp, &largeAlias, &certUriTemp); - EXPECT_EQ(ret, CM_FAILURE) << "Normal user cert Install test failed, recode:" << ret; + EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "Normal user cert Install test failed, recode:" << ret; } /** @@ -775,7 +775,7 @@ HWTEST_F(CmUserCertTest, InstallUserCertTest011, TestSize.Level0) struct CmBlob largeUri = { sizeof(largeUriBuf), largeUriBuf }; ret = CmInstallUserTrustedCert(&userCertTemp, &edgeAlias, &largeUri); - EXPECT_EQ(ret, CM_FAILURE) << "Normal user cert Install test failed, recode:" << ret; + EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "Normal user cert Install test failed, recode:" << ret; } /** @@ -957,7 +957,7 @@ HWTEST_F(CmUserCertTest, GetUserCertListTest001, TestSize.Level0) struct CertList *certList001 = nullptr; InitCertList(&certList001); - ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList001); + ret = CmGetAllUserCertList(CM_USER_TRUSTED_STORE, certList001); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; FreeCertList(certList001); @@ -984,7 +984,7 @@ HWTEST_F(CmUserCertTest, GetUserCertListTest002, TestSize.Level0) struct CertList *certList002 = nullptr; InitCertList(&certList002); - ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList002); + ret = CmGetAllUserCertList(CM_USER_TRUSTED_STORE, certList002); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; uint32_t len = sizeof(g_certListExpectResult) / sizeof(g_certListExpectResult[0]); @@ -1017,12 +1017,12 @@ HWTEST_F(CmUserCertTest, GetUserCertListTest003, TestSize.Level0) EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; } - ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, nullptr); /* cList is nullptr */ + ret = CmGetAllUserCertList(CM_USER_TRUSTED_STORE, nullptr); /* cList is nullptr */ EXPECT_EQ(ret, CMR_ERROR_NULL_POINTER); struct CertList *certList003 = nullptr; InitCertList(&certList003); - ret = CmGetUserCertList(100, certList003); /* invalid store 100 */ + ret = CmGetAllUserCertList(100, certList003); /* invalid store 100 */ EXPECT_EQ(ret, CM_FAILURE); FreeCertList(certList003); @@ -1051,7 +1051,7 @@ HWTEST_F(CmUserCertTest, GetUserCertListTest004, TestSize.Level0) for (uint32_t times = 0; times < PERFORMACE_COUNT; ++times) { struct CertList *certList004 = nullptr; InitCertList(&certList004); - ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList004); + ret = CmGetAllUserCertList(CM_USER_TRUSTED_STORE, certList004); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; FreeCertList(certList004); } @@ -1070,7 +1070,7 @@ HWTEST_F(CmUserCertTest, GetUserCertListTest005, TestSize.Level0) { struct CertList *certList005 = nullptr; InitCertList(&certList005); - int32_t ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList005); /* empty dir */ + int32_t ret = CmGetAllUserCertList(CM_USER_TRUSTED_STORE, certList005); /* empty dir */ EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; FreeCertList(certList005); } @@ -1127,7 +1127,7 @@ HWTEST_F(CmUserCertTest, GetUserCertInfoTest002, TestSize.Level0) struct CertList *certList006 = nullptr; InitCertList(&certList006); - ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList006); + ret = CmGetAllUserCertList(CM_USER_TRUSTED_STORE, certList006); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; uint32_t certCnt = sizeof(g_certInfoExpectResult) / sizeof(g_certInfoExpectResult[0]); @@ -1334,7 +1334,7 @@ HWTEST_F(CmUserCertTest, SetUserCertStatusTest003, TestSize.Level0) struct CertList *certList007 = nullptr; InitCertList(&certList007); - ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList007); + ret = CmGetAllUserCertList(CM_USER_TRUSTED_STORE, certList007); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; for (uint32_t i = 0; i < certList007->certsCount; ++i) {