mirror of
https://gitee.com/openharmony/security_privacy_center
synced 2024-11-22 23:29:58 +00:00
improve code for suporting no cacert
Signed-off-by: huyiqi <huyiqi3@huawei.com>
This commit is contained in:
parent
0340da5361
commit
d839a06588
@ -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<void> {
|
||||
console.info(TAG + 'getSystemTrustedCertificateList start');
|
||||
try {
|
||||
|
@ -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') })
|
||||
|
@ -68,21 +68,6 @@ export default class CmInstallPresenter {
|
||||
});
|
||||
}
|
||||
|
||||
AuthenticationPassword(uri: string, suffix: string, pwd: string): Promise<number> {
|
||||
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<number> {
|
||||
return new Promise((resolve) => {
|
||||
this.updateCertFileType(suffix);
|
||||
|
Loading…
Reference in New Issue
Block a user