diff --git a/CertManager/src/main/ets/model/CertMangerModel.ets b/CertManager/src/main/ets/model/CertMangerModel.ets index 300d79f..63a5a6e 100644 --- a/CertManager/src/main/ets/model/CertMangerModel.ets +++ b/CertManager/src/main/ets/model/CertMangerModel.ets @@ -280,22 +280,6 @@ export class CertMangerModel { } } - checkPassword(data: Uint8Array, pwd: string, callback: Function): void { - console.info(TAG + 'checkPassword start'); - try { - cert.createTrustAnchorsWithKeyStore(data, pwd).then((data) => { - console.info(TAG + 'checkPassword success'); - callback(0) - }).catch((err: BusinessError) => { - console.info(TAG + 'checkPassword failed:' + JSON.stringify(err)); - callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION) - }) - } catch (err) { - console.error(TAG + 'call create failed:' + JSON.stringify(err)); - callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION); - } - } - private async getSystemTrustedCertificateList(callback: Function): Promise { console.info(TAG + 'getSystemTrustedCertificateList start'); try { diff --git a/CertManager/src/main/ets/pages/certPwdInput.ets b/CertManager/src/main/ets/pages/certPwdInput.ets index 3ccf469..afc0952 100644 --- a/CertManager/src/main/ets/pages/certPwdInput.ets +++ b/CertManager/src/main/ets/pages/certPwdInput.ets @@ -138,23 +138,14 @@ struct CertPwdInput { .onClick(() => { let fileInfo: RouterFileVo = router.getParams() as RouterFileVo; this.isPasswordError = false; - this.mAppCredAuthPresenter.AuthenticationPassword(fileInfo.uri, fileInfo.suffix, this.certPwd) - .then((result: number) => { - this.passWordWarn = result; - if (this.passWordWarn !== CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION) { - GlobalContext.getContext().getPwdStore().setCertPwd(this.certPwd); - let fileInfo: RouterFileVo = router.getParams() as RouterFileVo; - router.replaceUrl({ - url: 'pages/certInstallAliasInput', - params: { - fileInfo: fileInfo, - pwd: this.certPwd - } - }) - } else { - this.isPasswordError = true; - } - }) + GlobalContext.getContext().getPwdStore().setCertPwd(this.certPwd); + router.replaceUrl({ + url: 'pages/certInstallAliasInput', + params: { + fileInfo: fileInfo, + pwd: this.certPwd + } + }) }) } .margin({ bottom: $r('app.float.wh_value_24') }) diff --git a/CertManager/src/main/ets/presenter/CmInstallPresenter.ets b/CertManager/src/main/ets/presenter/CmInstallPresenter.ets index 57f054e..a84e915 100644 --- a/CertManager/src/main/ets/presenter/CmInstallPresenter.ets +++ b/CertManager/src/main/ets/presenter/CmInstallPresenter.ets @@ -68,21 +68,6 @@ export default class CmInstallPresenter { }); } - AuthenticationPassword(uri: string, suffix: string, pwd: string): Promise { - return new Promise((resolve) => { - this.updateCertFileType(suffix); - this.getFileDataFromUri(uri, (data: Uint8Array) => { - certManagerModel.checkPassword(data, pwd, (err: CMModelErrorCode) => { - if (err === CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION) { - resolve(err) - } else { - resolve(0) - } - }) - }) - }) - } - checkCertNameLength(uri: string, alias: string, suffix: string, pwd: string): Promise { return new Promise((resolve) => { this.updateCertFileType(suffix);