mirror of
https://gitee.com/openharmony/security_privacy_center
synced 2024-11-23 07:39: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> {
|
private async getSystemTrustedCertificateList(callback: Function): Promise<void> {
|
||||||
console.info(TAG + 'getSystemTrustedCertificateList start');
|
console.info(TAG + 'getSystemTrustedCertificateList start');
|
||||||
try {
|
try {
|
||||||
|
@ -138,23 +138,14 @@ struct CertPwdInput {
|
|||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
let fileInfo: RouterFileVo = router.getParams() as RouterFileVo;
|
let fileInfo: RouterFileVo = router.getParams() as RouterFileVo;
|
||||||
this.isPasswordError = false;
|
this.isPasswordError = false;
|
||||||
this.mAppCredAuthPresenter.AuthenticationPassword(fileInfo.uri, fileInfo.suffix, this.certPwd)
|
GlobalContext.getContext().getPwdStore().setCertPwd(this.certPwd);
|
||||||
.then((result: number) => {
|
router.replaceUrl({
|
||||||
this.passWordWarn = result;
|
url: 'pages/certInstallAliasInput',
|
||||||
if (this.passWordWarn !== CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION) {
|
params: {
|
||||||
GlobalContext.getContext().getPwdStore().setCertPwd(this.certPwd);
|
fileInfo: fileInfo,
|
||||||
let fileInfo: RouterFileVo = router.getParams() as RouterFileVo;
|
pwd: this.certPwd
|
||||||
router.replaceUrl({
|
}
|
||||||
url: 'pages/certInstallAliasInput',
|
})
|
||||||
params: {
|
|
||||||
fileInfo: fileInfo,
|
|
||||||
pwd: this.certPwd
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.isPasswordError = true;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
.margin({ bottom: $r('app.float.wh_value_24') })
|
.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> {
|
checkCertNameLength(uri: string, alias: string, suffix: string, pwd: string): Promise<number> {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
this.updateCertFileType(suffix);
|
this.updateCertFileType(suffix);
|
||||||
|
Loading…
Reference in New Issue
Block a user