# @ohos.security.certManagerDialog (Certificate Management Dialog Box) The **certificateManagerDialog** module provides APIs for opening the certificate management pages, on which the certificates are installed, stored, used, and destroyed. > **NOTE** > > The initial APIs of this module are supported since API version 13. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import ```ts import certificateManagerDialog from '@ohos.security.certManagerDialog'; ``` ## CertificateDialogPageType Enumerates the page types of the certificate management dialog box. **System capability**: SystemCapability.Security.CertificateManagerDialog **Model restriction**: This API can be used only in the stage model. | Name | Value | Description | | ---------- | ------ | --------- | | PAGE_MAIN | 1 | Main page of the Certificate Manager application. | | PAGE_CA_CERTIFICATE | 2 | CA certificate list page. | | PAGE_CREDENTIAL | 3 | Credential list page. | | PAGE_INSTALL_CERTIFICATE | 4 | Certificate installation page. | ## CertificateDialogErrorCode Enumerates the error codes reported when the certificate management dialog box APIs are called. **System capability**: SystemCapability.Security.CertificateManagerDialog **Model restriction**: This API can be used only in the stage model. | Name | Value | Description | | ---------- | ------ | --------- | | ERROR_GENERIC | 29700001 | Internal error. | ## certificateManagerDialog.openCertificateManagerDialog openCertificateManagerDialog(context: common.Context, pageType: CertificateDialogPageType): Promise\ Opens the certificate management dialog box and displays the page of the specified type. This API uses a promise to return the result. **Required permissions**: ohos.permission.ACCESS_CERT_MANAGER **System capability**: SystemCapability.Security.CertificateManagerDialog **Model restriction**: This API can be used only in the stage model. **Parameters** | Name | Type | Mandatory | Description | | -------- | ------------------------------------------------- | ---- | -------------------------- | | context | [common.Context](../apis-ability-kit/js-apis-app-ability-common.md) | Yes | Context of the application. | | pageType | [CertificateDialogPageType](#certificatedialogpagetype) | Yes | Type of the page to display. | **Return value** | Type | Description | | ------------------------------------------- | -------------------- | | Promise\ | Promise that returns no value. | **Error codes** For details about the error codes, see [Certificate Management Dialog Box Error Codes](errorcode-certManagerDialog.md). | ID | Error Message | | -------- | ------------------------------------------------------------ | | 201 | Permission verification failed. The application does not have the permission required to call the API. | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | | 29700001 | Internal error. | **Example** ```ts import certificateManagerDialog from '@ohos.security.certManagerDialog'; import { BusinessError } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; /* context is application context information, which is obtained by the caller. The context here is only an example. */ let context: common.Context = getContext(this); /* pageType specifies the type of the page to display. In this example, pageType is PAGE_MAIN, which indicates the main page of the Certificate Management application. */ let pageType: certificateManagerDialog.CertificateDialogPageType = certificateManagerDialog.CertificateDialogPageType.PAGE_MAIN; try { certificateManagerDialog.openCertificateManagerDialog(context, pageType).then(() => { console.info('Succeeded in opening certificate manager dialog.'); }).catch((err: BusinessError) => { console.error(`Failed to open certificate manager dialog. Code: ${err.code}, message: ${err.message}`); }) } catch (error) { console.error(`Failed to open certificate manager dialog. Code: ${error.code}, message: ${error.message}`); } ```