openharmony 鸿蒙 capi-cm-native-api-h

2026-08-25 浏览 (1)

cm_native_api.h

Overview

Declares the APIs used to obtain details of specific certificates.

File to include: <device_certificate/certmanager/cm_native_api.h>

Library: libohcert_manager.so

System capability: SystemCapability.Security.CertificateManager

Since: 22

Related module: CertManager

Summary

Functions

NameDescription
int32_t OH_CertManager_GetUkeyCertificate(const OH_CM_Blob *keyUri, const OH_CM_UkeyInfo *ukeyInfo, OH_CM_CredentialDetailList *certificateList)Obtains the detail list of USB certificate credentials.
int32_t OH_CertManager_GetPrivateCertificate(const OH_CM_Blob *keyUri, OH_CM_Credential *certificate)Obtains the details of a private certificate credential of a specific application.
int32_t OH_CertManager_GetPublicCertificate(const OH_CM_Blob *keyUri, OH_CM_Credential *certificate)Obtains the details of a public certificate credential of a specific user.
void OH_CertManager_FreeUkeyCertificate(OH_CM_CredentialDetailList *certificateList)Destroys the certificate detail list.
void OH_CertManager_FreeCredential(OH_CM_Credential *certificate)Destroys the certificate details.

Function Description

OH_CertManager_GetUkeyCertificate()

int32_t OH_CertManager_GetUkeyCertificate(const OH_CM_Blob *keyUri, const OH_CM_UkeyInfo *ukeyInfo, OH_CM_CredentialDetailList *certificateList)

Description

Obtains the detail list of USB certificate credentials.

Required permissions: ohos.permission.ACCESS_CERT_MANAGER

Since: 22

Parameters

ParameterDescription
const OH_CM_Blob *keyUriPointer to the URI that stores the USB certificate credentials, in string format.
const OH_CM_UkeyInfo *ukeyInfoPointer to the property information of the USB certificate credential.
OH_CM_CredentialDetailList *certificateListPointer to the USB certificate credential detail list obtained.

Returns

TypeDescription
int32_tOH_CM_ErrorCode:
OH_CM_SUCCESS = 0: Operation successful.
OH_CM_HAS_NO_PERMISSION = 201: Permission verification failed.
OH_CM_CAPABILITY_NOT_SUPPORTED = 801: The device is not supported.
OH_CM_PARAMETER_VALIDATION_FAILED = 17500011: Input parameter verification failed. Possible causes:
1. Incorrect parameter format.
2. Invalid parameter value range.
OH_CM_INNER_FAILURE = 17500001: Internal error. Possible causes:
1. IPC failure.
2. Memory operation error.
3. File operation error.
OH_CM_NOT_FOUND = 17500002: The certificate does not exist.
OH_CM_ACCESS_UKEY_SERVICE_FAILED = 17500010: Failed to access the USB certificate credential.

OH_CertManager_GetPrivateCertificate()

int32_t OH_CertManager_GetPrivateCertificate(const OH_CM_Blob *keyUri, OH_CM_Credential *certificate)

Description

Obtains the details of a private certificate credential of a specific application.

Required permissions: ohos.permission.ACCESS_CERT_MANAGER

Since: 22

Parameters

ParameterDescription
const OH_CM_Blob *keyUriPointer to the URI that stores the application's private certificate credentials, in string format.
OH_CM_Credential *certificatePointer to the details of the application's private credentials obtained.

Returns

TypeDescription
int32_tOH_CM_ErrorCode:
OH_CM_SUCCESS = 0: Operation successful.
OH_CM_HAS_NO_PERMISSION = 201: Permission verification failed.
OH_CM_PARAMETER_VALIDATION_FAILED = 17500011: Input parameter verification failed. Possible causes:
1. Incorrect parameter format.
2. Invalid parameter value range.
OH_CM_INNER_FAILURE = 17500001: Internal error. Possible causes:
1. IPC failure.
2. Memory operation error.
3. File operation error.
OH_CM_NOT_FOUND = 17500002: The certificate does not exist.

OH_CertManager_GetPublicCertificate()

int32_t OH_CertManager_GetPublicCertificate(const OH_CM_Blob *keyUri, OH_CM_Credential *certificate)

Description

Obtains the details of a public certificate credential of a specific user.

Required permissions: ohos.permission.ACCESS_CERT_MANAGER

Since: 22

Parameters

ParameterDescription
const OH_CM_Blob *keyUriPointer to the URI that stores the user's public certificate credentials, in string format.
OH_CM_Credential *certificatePointer to the details of the user's public certificate credential obtained.

Returns

TypeDescription
int32_tOH_CM_ErrorCode:
OH_CM_SUCCESS = 0: Operation successful.
OH_CM_HAS_NO_PERMISSION = 201: Permission verification failed.
OH_CM_PARAMETER_VALIDATION_FAILED = 17500011: Input parameter verification failed. Possible causes:
1. Incorrect parameter format.
2. Invalid parameter value range.
OH_CM_INNER_FAILURE = 17500001: Internal error. Possible causes:
1. IPC failure.
2. Memory operation error.
3. File operation error.
OH_CM_NOT_FOUND = 17500002: The certificate does not exist.
OH_CM_NO_AUTHORIZATION = 17500005: The application is not authorized.

OH_CertManager_FreeUkeyCertificate()

void OH_CertManager_FreeUkeyCertificate(OH_CM_CredentialDetailList *certificateList)

Description

Destroys the certificate detail list.

Since: 22

Parameters

ParameterDescription
OH_CM_CredentialDetailList *certificateListPointer to the certificate credential detail list to be destroyed.

OH_CertManager_FreeCredential()

void OH_CertManager_FreeCredential(OH_CM_Credential *certificate)

Description

Destroys the certificate details.

Since: 22

Parameters

ParameterDescription
OH_CM_Credential *certificatePointer to the certificate credential details to be destroyed.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-certmanagertype

openharmony 鸿蒙 js-apis-certManagerDialog

openharmony 鸿蒙 errorcode-certManager

openharmony 鸿蒙 capi-certmanagertype-oh-cm-credentialdetaillist

openharmony 鸿蒙 errorcode-cert

openharmony 鸿蒙 Readme-EN

openharmony 鸿蒙 capi-certmanagertype-oh-cm-blob

openharmony 鸿蒙 js-apis-certManager

openharmony 鸿蒙 capi-certmanagertype-oh-cm-credential

openharmony 鸿蒙 js-apis-cert

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/xZSpuXwx