init code
Signed-off-by: zhanzeyi <zhanzeyi@huawei.com>
25
CertificateManager/AppScope/app.json5
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.example.applications_certmanager",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:app_name",
|
||||
"distributedNotificationEnabled": true
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "CertManager"
|
||||
}
|
||||
]
|
||||
}
|
BIN
CertificateManager/AppScope/resources/base/media/app_icon.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
67
CertificateManager/README.md
Normal file
@ -0,0 +1,67 @@
|
||||
# 证书管理应用
|
||||
|
||||
## 简介
|
||||
|
||||
### 内容介绍
|
||||
|
||||
证书管理应用是OpenHarmony中预置的系统应用,主要的功能包含系统根证书查看与启用禁用,用户根证书的安装、查看、启用禁用与卸载,公共业务证书的安装、查看、授权管理与卸载,私有业务证书的查看等功能。
|
||||
|
||||
### 架构图
|
||||
|
||||
![](doc/image/image-20220727141455437.png)
|
||||
|
||||
该应用架构主要结合MVP和领域驱动设计思路。
|
||||
|
||||
### 目录
|
||||
|
||||
```
|
||||
/CertManagerFa/
|
||||
├── AppScope # 应用配置
|
||||
├── common # 公共工具类
|
||||
└── product
|
||||
└── phone
|
||||
└── src
|
||||
└── main
|
||||
├── ets # 代码目录
|
||||
│ ├── Application # AbilityStage类实现
|
||||
│ ├── MainAbility # Ability类实现
|
||||
│ ├── model # model层功能类实现
|
||||
│ ├── pages # 页面展示实现
|
||||
│ ├── presenter # 页面presenter层功能类实现
|
||||
│ └── stub # certManager打桩代码
|
||||
└── resources # 资源文件目录
|
||||
```
|
||||
|
||||
### 使用方法
|
||||
|
||||
其他应用拉起证书管理FA并执行证书安装,使用方法如下:
|
||||
|
||||
```
|
||||
globalThis.context.startAbility(
|
||||
{
|
||||
bundleName: "com.example.applications_certmanager",
|
||||
abilityName: "MainAbility",
|
||||
uri: "certInstall",
|
||||
})
|
||||
```
|
||||
|
||||
其他应用拉起证书管理FA并执行申请应用授权,使用方法如下:
|
||||
|
||||
```
|
||||
//拉起应用申请应用授权
|
||||
globalThis.context.startAbilityForResult(
|
||||
{
|
||||
bundleName: "com.example.applications_certmanager",
|
||||
abilityName: "MainAbility",
|
||||
uri: "requestAuthorize",
|
||||
parameters: {
|
||||
appUid: appUid, //传入申请应用的appUid
|
||||
}
|
||||
})
|
||||
.then((data) => {
|
||||
if (!data.resultCode) {
|
||||
this.authUri = data.want.parameters.authUri; //授权成功后获取返回的authUri
|
||||
}
|
||||
})
|
||||
```
|
||||
|
54
CertificateManager/build-profile.json5
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
{
|
||||
"app": {
|
||||
"signingConfigs": [
|
||||
{
|
||||
"name": "default",
|
||||
"material": {
|
||||
"storePassword": "000000161B64D26AFDA336B9D4E45469670FC05C21ACB86E817B3A0EBBEF557AEC2E73906C73",
|
||||
"certpath": "signature/OpenHarmonyApplication.cer",
|
||||
"keyAlias": "openharmony application release",
|
||||
"keyPassword": "0000001669F0585B86DCE64A21563F2E7BA5320E86297F85E75F6EA4844BFB920AD864794581",
|
||||
"profile": "signature/certmanager.p7b",
|
||||
"signAlg": "SHA256withECDSA",
|
||||
"storeFile": "signature/OpenHarmony.p12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"compileSdkVersion": 9,
|
||||
"compatibleSdkVersion": 9,
|
||||
"products": [
|
||||
{
|
||||
"name": "default",
|
||||
"signingConfig": "default",
|
||||
}
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"name": "phone",
|
||||
"srcPath": "./product/phone",
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"applyToProducts": [
|
||||
"default"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
37
CertificateManager/common/component/ComponentConfig.ets
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class ComponentConfig {
|
||||
WH_100_100 = '100%';
|
||||
WH_30_100 = '30%';
|
||||
WH_33_100 = '33%';
|
||||
WH_35_100 = '35%';
|
||||
WH_40_100 = '40%';
|
||||
WH_45_100 = '45%';
|
||||
WH_50_100 = '50%';
|
||||
WH_55_100 = '55%';
|
||||
WH_83_100 = '83%';
|
||||
WH_90_100 = '90%';
|
||||
value_20 = 20;
|
||||
font_20 = 20;
|
||||
MAX_LINES_1 = 1;
|
||||
MAX_LINES_2 = 2;
|
||||
MAX_LINES_3 = 3;
|
||||
DURATION_TIME = 200;
|
||||
}
|
||||
|
||||
let componentConfig = new ComponentConfig();
|
||||
|
||||
export default componentConfig as ComponentConfig;
|
143
CertificateManager/common/component/entryComponent.ets
Normal file
@ -0,0 +1,143 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import ComponentConfig from './ComponentConfig';
|
||||
|
||||
/**
|
||||
* item custom component
|
||||
*/
|
||||
@Component
|
||||
export default struct EntryComponent {
|
||||
@State isShow: Boolean = true;
|
||||
@Prop settingIcon: string;
|
||||
@State endTextIsShow: Boolean= true;
|
||||
private settingTitle: string | Resource;
|
||||
@State settingSummary: string | Resource = '';
|
||||
private settingValue: string;
|
||||
@State settingArrow: string | PixelMap | Resource = '';
|
||||
@Prop settingArrowStyle: string;
|
||||
private settingUri: string;
|
||||
@State titleFontColor: Color | number | string | Resource = $r('sys.color.ohos_id_color_text_primary');
|
||||
private enabled: boolean = true;
|
||||
private onArrowClick?: () => void;
|
||||
@State isTouched: boolean = false;
|
||||
private height ?= $r('app.float.wh_value_70');
|
||||
private image_wh ?= $r('app.float.wh_value_50');
|
||||
private fontSize ?= $r('sys.float.ohos_id_text_size_body1');
|
||||
private valueFontSize ?= $r('sys.float.ohos_id_text_size_body2');
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Row() {
|
||||
Image(this.settingIcon)
|
||||
.width(this.image_wh)
|
||||
.height(this.image_wh)
|
||||
.margin({ right: $r('app.float.wh_10') })
|
||||
.visibility('' === this.settingIcon ? Visibility.None : Visibility.Visible)
|
||||
.objectFit(ImageFit.Contain)
|
||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
||||
Column() {
|
||||
Text(this.settingTitle)
|
||||
.fontColor(this.enabled ? this.titleFontColor : $r("sys.color.ohos_id_color_primary"))
|
||||
.fontSize(this.fontSize)
|
||||
.textAlign(TextAlign.Start)
|
||||
.maxLines(ComponentConfig.MAX_LINES_3)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.fontWeight(500)
|
||||
Row() {
|
||||
Text($r('app.string.version'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.maxLines(ComponentConfig.MAX_LINES_1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.visibility('pages/applicationInfo' === this.settingUri ? Visibility.Visible : Visibility.None)
|
||||
.margin({ top: $r('sys.float.ohos_id_text_margin_vertical') });
|
||||
|
||||
Text(this.settingSummary)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
||||
.fontWeight('sans-serif')
|
||||
.textAlign(TextAlign.Start)
|
||||
.maxLines(ComponentConfig.MAX_LINES_1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.visibility('' === this.settingSummary || undefined === this.settingSummary ? Visibility.None : Visibility.Visible)
|
||||
.margin({ top: $r('sys.float.ohos_id_text_margin_vertical') });
|
||||
}
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start);
|
||||
}
|
||||
.flexShrink(0)
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.align(Alignment.Start)
|
||||
.layoutWeight(1)
|
||||
|
||||
Row() {
|
||||
Text(this.settingValue)
|
||||
.fontSize(this.valueFontSize)
|
||||
.fontColor($r("sys.color.ohos_id_color_primary"))
|
||||
.opacity($r('sys.float.ohos_id_alpha_content_secondary'))
|
||||
.fontWeight('HwChinese-medium')
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.margin({ left: $r('sys.float.ohos_id_elements_margin_horizontal_l'), right: $r('app.float.wh_value_4') })
|
||||
.align(Alignment.End);
|
||||
|
||||
if (!this.settingArrowStyle && this.settingArrow) {
|
||||
Image(this.settingArrow)
|
||||
.visibility('' === this.settingArrow ? Visibility.None : Visibility.Visible)
|
||||
.width($r("app.float.wh_value_12"))
|
||||
.height($r("app.float.wh_value_24"))
|
||||
.margin({ right: $r('app.float.wh_24') })
|
||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
} else if (this.settingArrow) {
|
||||
Image(this.settingArrow)
|
||||
.visibility('' === this.settingArrow ? Visibility.None : Visibility.Visible)
|
||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
||||
.width($r('app.float.wh_value_24'))
|
||||
.height($r('app.float.wh_value_24'))
|
||||
.margin({ right: $r('app.float.wh_24') })
|
||||
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
|
||||
.onClick(this.onArrowClick)
|
||||
|
||||
}
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.align(Alignment.End);
|
||||
}
|
||||
.opacity(this.enabled?1:$r('sys.float.ohos_id_alpha_disabled'))
|
||||
.height(this.height)
|
||||
.width(ComponentConfig.WH_100_100)
|
||||
.padding({ left: $r('sys.float.ohos_id_default_padding_start') })
|
||||
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
|
||||
.linearGradient((this.enabled && this.isTouched) ? {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("app.color.DCEAF9"), 0.0], [$r("app.color.FAFAFA"), 1.0]]
|
||||
} : {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_foreground_contrary"), 1], [$r("sys.color.ohos_id_color_foreground_contrary"), 1]]
|
||||
})
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouched = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouched = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
67
CertificateManager/common/component/headComponent.ets
Normal file
@ -0,0 +1,67 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import ComponentConfig from './ComponentConfig';
|
||||
import Router from '@system.router';
|
||||
|
||||
/**
|
||||
* head custom component
|
||||
*/
|
||||
@Component
|
||||
export default struct HeadComponent {
|
||||
private icBackIsVisibility: boolean= true;
|
||||
private headName: string | Resource = '';
|
||||
@State isTouch: boolean= false;
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Stack({ alignContent: Alignment.Center }) {
|
||||
Image($r('app.media.ic_back'))
|
||||
.width($r('app.float.wh_value_24'))
|
||||
.height($r('app.float.wh_value_24'))
|
||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
||||
}
|
||||
.margin({ right: $r('app.float.wh_value_16') })
|
||||
.backgroundColor(this.isTouch ? $r('app.color.color_E3E3E3_grey') : $r('app.color.color_00000000_transparent'))
|
||||
.visibility(this.icBackIsVisibility ? Visibility.Visible : Visibility.None)
|
||||
.onClick(() => {
|
||||
Router.back();
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouch = false;
|
||||
}
|
||||
});
|
||||
|
||||
Text(this.headName)
|
||||
.fontSize($r('app.float.head_font_20'))
|
||||
.lineHeight($r('app.float.wh_value_33'))
|
||||
.fontFamily('HarmonyHeiTi-Bold')
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor($r('app.color.font_color_182431'))
|
||||
.maxLines(ComponentConfig.MAX_LINES_1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({ top: $r('app.float.wh_value_13'), bottom: $r('app.float.wh_value_15') });
|
||||
}
|
||||
.width(ComponentConfig.WH_100_100)
|
||||
.padding({ left: $r('app.float.wh_value_24') })
|
||||
.height($r('app.float.wh_value_56'))
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.align(Alignment.Start)
|
||||
}
|
||||
}
|
140
CertificateManager/common/component/subEntryComponent.ets
Normal file
@ -0,0 +1,140 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import ComponentConfig from './ComponentConfig';
|
||||
|
||||
/**
|
||||
* Sub-Page Entry Component
|
||||
*/
|
||||
@Component
|
||||
export struct SubEntryComponent {
|
||||
private targetPage: string;
|
||||
private title: string | Resource;
|
||||
@State isTouched: boolean = false;
|
||||
|
||||
build() {
|
||||
Navigator({ target: this.targetPage }) {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
Text(this.title)
|
||||
.fontSize($r('app.float.font_16'))
|
||||
.lineHeight($r('app.float.wh_value_22'))
|
||||
.fontColor($r('app.color.font_color_182431'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: $r('app.float.distance_8') })
|
||||
.textAlign(TextAlign.Start);
|
||||
}
|
||||
|
||||
Image('/res/image/ic_settings_arrow.svg')
|
||||
.width($r('app.float.wh_value_12'))
|
||||
.height($r('app.float.wh_value_24'))
|
||||
.margin({ right: $r('app.float.distance_8') })
|
||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
}
|
||||
.height(ComponentConfig.WH_100_100)
|
||||
.width(ComponentConfig.WH_100_100)
|
||||
.borderRadius($r('app.float.radius_20'))
|
||||
.linearGradient(this.isTouched ? {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("app.color.DCEAF9"), 0.0], [$r("app.color.FAFAFA"), 1.0]]
|
||||
} : {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_foreground_contrary"), 1], [$r("sys.color.ohos_id_color_foreground_contrary"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouched = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouched = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
.padding($r('app.float.distance_4'))
|
||||
.height($r('app.float.wh_value_56'))
|
||||
.borderRadius($r('app.float.radius_24'))
|
||||
.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sub-Page Entry Component with EndText
|
||||
*/
|
||||
@Component
|
||||
export struct SubEntryComponentWithEndText {
|
||||
@State isTouched: boolean = false;
|
||||
@Prop endText: string;
|
||||
private targetPage: string;
|
||||
private title: string | Resource;
|
||||
|
||||
build() {
|
||||
Navigator({ target: this.targetPage }) {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
Text(this.title)
|
||||
.fontSize($r('app.float.font_16'))
|
||||
.lineHeight($r('app.float.wh_value_22'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('app.color.font_color_182431'))
|
||||
.margin({ left: $r('app.float.distance_8') })
|
||||
.textAlign(TextAlign.Start);
|
||||
}
|
||||
|
||||
Row() {
|
||||
Text(this.endText)
|
||||
.fontSize($r('app.float.font_14'))
|
||||
.lineHeight($r('app.float.wh_value_19'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.margin({ right: $r('app.float.distance_4') })
|
||||
.textAlign(TextAlign.End);
|
||||
Image('/res/image/ic_settings_arrow.svg')
|
||||
.width($r('app.float.wh_value_12'))
|
||||
.height($r('app.float.wh_value_24'))
|
||||
.margin({ right: $r('app.float.distance_8') })
|
||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
}
|
||||
}
|
||||
.height(ComponentConfig.WH_100_100)
|
||||
.width(ComponentConfig.WH_100_100)
|
||||
.borderRadius($r('app.float.radius_20'))
|
||||
.linearGradient(this.isTouched ? {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("app.color.DCEAF9"), 0.0], [$r("app.color.FAFAFA"), 1.0]]
|
||||
} : {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_foreground_contrary"), 1], [$r("sys.color.ohos_id_color_foreground_contrary"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouched = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouched = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
.padding($r('app.float.distance_4'))
|
||||
.height($r('app.float.wh_value_56'))
|
||||
.borderRadius($r('app.float.radius_24'))
|
||||
.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"));
|
||||
}
|
||||
}
|
65
CertificateManager/common/util/ConfigData.ts
Normal file
@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class ConfigData {
|
||||
|
||||
WH_100_100 = '100%';
|
||||
WH_3_100 = '3%';
|
||||
WH_4_100 = '4%';
|
||||
WH_20_100 = '20%';
|
||||
WH_25_100 = '25%';
|
||||
WH_30_100 = '30%';
|
||||
WH_33_100 = '33%';
|
||||
WH_35_100 = '35%';
|
||||
WH_40_100 = '40%';
|
||||
WH_43_100 = '43%';
|
||||
WH_45_100 = '45%';
|
||||
WH_50_100 = '50%';
|
||||
WH_53_100 = '53%';
|
||||
WH_55_100 = '55%';
|
||||
WH_60_100 = '60%';
|
||||
WH_65_100 = '65%';
|
||||
WH_70_100 = '70%';
|
||||
WH_75_100 = '75%';
|
||||
WH_80_100 = '80%';
|
||||
WH_85_100 = '85%';
|
||||
WH_88_100 = '88%';
|
||||
WH_90_100 = '90%';
|
||||
WH_92_100 = '92%';
|
||||
WH_93_100 = '93%';
|
||||
WH_94_100 = '94%';
|
||||
|
||||
value_20 = 20;
|
||||
font_20 = 20;
|
||||
|
||||
TAG = 'CertManager Fa '
|
||||
SWITCH_BUTTON_X_OFFSET = '-4vp'
|
||||
DIALOG_DY_OFFSET = '-16vp'
|
||||
|
||||
PWD_MAX_LENGTH = 64;
|
||||
ALIAS_MAX_LENGTH = 64;
|
||||
MAX_LINES_1 = 1;
|
||||
MAX_LINES_2 = 2;
|
||||
MAX_LINES_3 = 3;
|
||||
DURATION_TIME = 200;
|
||||
FUNCTION_TYPE_HDC = 4;
|
||||
APP_AUTH_MAX_LENGTH = 4;
|
||||
REQUEST_AUTH_MAX_LENGTH = 5;
|
||||
VERTICAL_DIVIDER_WIDTH = 1;
|
||||
|
||||
}
|
||||
|
||||
let configData = new ConfigData();
|
||||
export default configData as ConfigData;
|
63
CertificateManager/common/util/LogDecorator.ts
Normal file
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import LogUtil from './LogUtil';
|
||||
import ConfigData from './ConfigData';
|
||||
|
||||
/**
|
||||
* Method log decorator
|
||||
*/
|
||||
const LogMethod = (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor): PropertyDescriptor => {
|
||||
const method = propertyDescriptor.value;
|
||||
|
||||
propertyDescriptor.value = function (...args: any[]) {
|
||||
const params = args.map(a => JSON.stringify(a)).join();
|
||||
LogUtil.info(ConfigData.TAG + `${target.constructor.name}#${methodName}(${params}) in `);
|
||||
|
||||
const result = method.apply(this, args);
|
||||
const r = JSON.stringify(result);
|
||||
|
||||
LogUtil.info(ConfigData.TAG + `${target.constructor.name}#${methodName}(${params}) out => ${r}`);
|
||||
return result;
|
||||
}
|
||||
|
||||
return propertyDescriptor;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class decorator to log all methods
|
||||
*/
|
||||
export const LogAll = (target: any) => {
|
||||
Reflect.ownKeys(target.prototype).forEach(propertyKey => {
|
||||
let propertyDescriptor: PropertyDescriptor = Object.getOwnPropertyDescriptor(target.prototype, propertyKey);
|
||||
const method = propertyDescriptor.value;
|
||||
|
||||
if (method) {
|
||||
propertyDescriptor.value = function (...args: any[]) {
|
||||
const params = args.map(a => JSON.stringify(a)).join();
|
||||
LogUtil.info(ConfigData.TAG + `${target.name}#${propertyKey.toString()}(${params}) in `);
|
||||
|
||||
const result = method.apply(this, args);
|
||||
const r = JSON.stringify(result);
|
||||
|
||||
LogUtil.info(ConfigData.TAG + `${target.name}#${propertyKey.toString()}(${params}) out => ${r}`);
|
||||
return result;
|
||||
}
|
||||
|
||||
Object.defineProperty(target.prototype, propertyKey, propertyDescriptor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default LogMethod;
|
85
CertificateManager/common/util/LogUtil.ts
Normal file
@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Log level
|
||||
*/
|
||||
let LogLevel = {
|
||||
/**
|
||||
* debug
|
||||
*/
|
||||
DEBUG: 3,
|
||||
|
||||
/**
|
||||
* info
|
||||
*/
|
||||
INFO: 4,
|
||||
|
||||
/**
|
||||
* warn
|
||||
*/
|
||||
WARN: 5,
|
||||
|
||||
/**
|
||||
* error
|
||||
*/
|
||||
ERROR: 6,
|
||||
|
||||
/**
|
||||
* fatal
|
||||
*/
|
||||
FATAL: 7,
|
||||
};
|
||||
|
||||
const LOG_LEVEL = LogLevel.INFO
|
||||
|
||||
/**
|
||||
* log package tool class
|
||||
*/
|
||||
export class LogUtil {
|
||||
debug(msg): void {
|
||||
if (LogLevel.DEBUG >= LOG_LEVEL) {
|
||||
console.info(msg);
|
||||
}
|
||||
}
|
||||
|
||||
log(msg): void {
|
||||
if (LogLevel.INFO >= LOG_LEVEL) {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
|
||||
info(msg): void {
|
||||
if (LogLevel.INFO >= LOG_LEVEL) {
|
||||
console.info(msg);
|
||||
}
|
||||
}
|
||||
|
||||
warn(msg): void {
|
||||
if (LogLevel.WARN >= LOG_LEVEL) {
|
||||
console.warn(msg);
|
||||
}
|
||||
}
|
||||
|
||||
error(msg): void {
|
||||
if (LogLevel.ERROR >= LOG_LEVEL) {
|
||||
console.error(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mLogUtil = new LogUtil();
|
||||
export default mLogUtil as LogUtil
|
||||
;
|
47
CertificateManager/common/util/ResourceUtil.ts
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import Log from './logdecorator';
|
||||
|
||||
/**
|
||||
* Resource util
|
||||
*/
|
||||
export class ResourceUtil {
|
||||
private resMgr: any;
|
||||
|
||||
/**
|
||||
* Initialize ResourceManager
|
||||
*/
|
||||
@Log
|
||||
async initResourceManager(): Promise<void> {
|
||||
if (!this.resMgr) {
|
||||
this.resMgr = await globalThis.certManagerAbilityContext.resourceManager;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get string value from NormalResource instance
|
||||
*
|
||||
* @param resource - NormalResource instance
|
||||
*/
|
||||
@Log
|
||||
async getString(resource): Promise<string> {
|
||||
await this.initResourceManager();
|
||||
return await this.resMgr.getString(resource.id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let resourceUtil = new ResourceUtil();
|
||||
export default resourceUtil as ResourceUtil;
|
BIN
CertificateManager/doc/image/image-20220727141455437.png
Normal file
After Width: | Height: | Size: 41 KiB |
37
CertificateManager/gradlew
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
#
|
||||
# Copyright (c) 2022-2022 Huawei Device Co., Ltd.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
function npm_install {
|
||||
cd $1
|
||||
npm install
|
||||
}
|
||||
|
||||
npm config set registry http://mirrors.tools.huawei.com/npm/
|
||||
npm config set @ohos:registry https://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/product_npm/
|
||||
npm config set strict-ssl false
|
||||
npm config set sslVerify false
|
||||
|
||||
APP_HOME="`pwd -P`"
|
||||
npm_install "$APP_HOME"
|
||||
npm_install "$APP_HOME/product"
|
||||
cd $APP_HOME
|
||||
node ./node_modules/@ohos/hvigor/bin/hvigor.js --mode module assembleHap
|
17
CertificateManager/hvigorfile.js
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
|
||||
module.exports = require('@ohos/hvigor-ohos-plugin').appTasks
|
1652
CertificateManager/package-lock.json
generated
Normal file
18
CertificateManager/package.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"license": "ISC",
|
||||
"devDependencies": {},
|
||||
"name": "applications_certmanager",
|
||||
"ohos": {
|
||||
"org": "huawei",
|
||||
"directoryLevel": "project",
|
||||
"buildTool": "hvigor"
|
||||
},
|
||||
"description": "example description",
|
||||
"repository": {},
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@ohos/hvigor-ohos-plugin": "1.0.6",
|
||||
"hypium": "^1.0.0",
|
||||
"@ohos/hvigor": "1.0.6"
|
||||
}
|
||||
}
|
3
CertificateManager/product/phone/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/node_modules
|
||||
/.preview
|
||||
/build
|
27
CertificateManager/product/phone/build-profile.json5
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
{
|
||||
"apiType": 'stageMode',
|
||||
"buildOption": {
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
},
|
||||
{
|
||||
"name": "ohosTest",
|
||||
}
|
||||
]
|
||||
}
|
17
CertificateManager/product/phone/hvigorfile.js
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
|
||||
module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks
|
5
CertificateManager/product/phone/package-lock.json
generated
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "phone",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1
|
||||
}
|
14
CertificateManager/product/phone/package.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"license": "ISC",
|
||||
"devDependencies": {},
|
||||
"name": "phone",
|
||||
"ohos": {
|
||||
"org": "huawei",
|
||||
"directoryLevel": "module",
|
||||
"buildTool": "hvigor"
|
||||
},
|
||||
"description": "example description",
|
||||
"repository": {},
|
||||
"version": "1.0.0",
|
||||
"dependencies": {}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import AbilityStage from "@ohos.application.AbilityStage"
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
console.log("[Demo] MyAbilityStage onCreate")
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Ability from '@ohos.application.Ability';
|
||||
import certManager from '../stub/certStubPromise'
|
||||
|
||||
class PwdStore {
|
||||
private certPwd: string = '';
|
||||
setCertPwd(pwd) {
|
||||
this.certPwd = pwd;
|
||||
}
|
||||
|
||||
getCertPwd() {
|
||||
return this.certPwd;
|
||||
}
|
||||
|
||||
clearCertPwd() {
|
||||
this.certPwd = '';
|
||||
}
|
||||
}
|
||||
|
||||
export default class MainAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.log("[Demo] MainAbility onCreate")
|
||||
globalThis.certManagerAbilityContext = this.context
|
||||
globalThis.PwdStore = new PwdStore();
|
||||
globalThis.abilityWant = want;
|
||||
globalThis.certStub = certManager;
|
||||
globalThis.certStub.restoreAllMaps();
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log("[Demo] MainAbility onDestroy")
|
||||
globalThis.certStub.saveAllMaps();
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
console.log("[Demo] MainAbility onWindowStageCreate")
|
||||
windowStage.setUIContent(this.context, "pages/certManagerFa", null)
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
// Main window is destroyed, release UI related resources
|
||||
console.log("[Demo] MainAbility onWindowStageDestroy")
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
// Ability has brought to foreground
|
||||
console.log("[Demo] MainAbility onForeground")
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
console.log("[Demo] MainAbility onBackground")
|
||||
}
|
||||
|
||||
onNewWant(want) {
|
||||
console.log("[Demo] MainAbility onNewWant")
|
||||
globalThis.abilityWant = want;
|
||||
}
|
||||
};
|
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import bundle from '@ohos.bundle'
|
||||
import { CMModelErrorCode } from '../model/CertMangerModel'
|
||||
|
||||
export class BundleNameModel {
|
||||
async getAppInfoList(AppUid, callback) {
|
||||
try {
|
||||
let AppInfo = {
|
||||
AppImage: "",
|
||||
AppName: "",
|
||||
}
|
||||
let AppBundleName = await bundle.getNameForUid(AppUid)
|
||||
var bundleContext = await globalThis.certManagerAbilityContext.createBundleContext(AppBundleName)
|
||||
|
||||
let labelId = Number(bundleContext.applicationInfo.labelId)
|
||||
let iconId = Number(bundleContext.applicationInfo.iconId)
|
||||
|
||||
AppInfo.AppImage = await bundleContext.resourceManager.getMediaBase64(iconId)
|
||||
|
||||
AppInfo.AppName = await bundleContext.resourceManager.getString(labelId)
|
||||
|
||||
console.log("AppName1111111111", JSON.stringify(AppInfo));
|
||||
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS, AppInfo)
|
||||
} catch (err) {
|
||||
console.log("getAppNameListErr", JSON.stringify(err.code));
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let bundleNameModel = new BundleNameModel();
|
||||
|
||||
export default bundleNameModel as BundleNameModel;
|
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class AppAuthorVo {
|
||||
appImage: string;
|
||||
uid: string;
|
||||
appName: string;
|
||||
status: boolean;
|
||||
|
||||
constructor(
|
||||
appImage: string,
|
||||
uid: string,
|
||||
appName: string,
|
||||
status: boolean) {
|
||||
this.appImage = appImage;
|
||||
this.uid = uid;
|
||||
this.appName = appName;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class CertAbstractVo {
|
||||
uri: string;
|
||||
certAlias: string;
|
||||
status: boolean;
|
||||
subjectName: string;
|
||||
SubjectNameCN : string;
|
||||
|
||||
constructor(uri: string,
|
||||
certAlias: string,
|
||||
status: boolean,
|
||||
subjectName: string,
|
||||
SubjectNameCN : string) {
|
||||
this.uri = uri;
|
||||
this.certAlias = certAlias;
|
||||
this.status = status;
|
||||
this.subjectName = subjectName;
|
||||
this.SubjectNameCN = SubjectNameCN;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class CertInfoVo {
|
||||
uri: string;
|
||||
certAlias: string;
|
||||
status: boolean;
|
||||
issuerName: string;
|
||||
subjectName: string;
|
||||
serial: string;
|
||||
notBefore: string;
|
||||
notAfter: string;
|
||||
fingerprintSha256: string;
|
||||
cert: Uint8Array;
|
||||
subjectNameMap :Map<string, string>;
|
||||
issuerNameMap :Map<string, string>;
|
||||
dateMap :Map<string, string>;
|
||||
|
||||
constructor(uri: string,
|
||||
certAlias: string,
|
||||
status: boolean,
|
||||
issuerName: string,
|
||||
subjectName: string,
|
||||
serial: string,
|
||||
notBefore: string,
|
||||
notAfter: string,
|
||||
fingerprintSha256: string,
|
||||
cert: Uint8Array,
|
||||
subjectNameMap: Map<string, string>,
|
||||
issuerNameMap :Map<string, string>,
|
||||
dateMap :Map<string, string>) {
|
||||
this.uri = uri;
|
||||
this.certAlias = certAlias;
|
||||
this.status = status;
|
||||
this.issuerName = issuerName;
|
||||
this.subjectName = subjectName;
|
||||
this.serial = serial;
|
||||
this.notBefore = notBefore;
|
||||
this.notAfter = notAfter;
|
||||
this.fingerprintSha256 = fingerprintSha256;
|
||||
this.cert = cert;
|
||||
this.subjectNameMap = subjectNameMap
|
||||
this.issuerNameMap = issuerNameMap
|
||||
this.dateMap = dateMap
|
||||
}
|
||||
|
||||
clearCertInfoVo() {
|
||||
this.uri = "";
|
||||
this.certAlias = "";
|
||||
this.status = false;
|
||||
this.issuerName = "";
|
||||
this.subjectName = "";
|
||||
this.serial = "";
|
||||
this.notBefore = "";
|
||||
this.notAfter = "";
|
||||
this.fingerprintSha256 = "";
|
||||
this.cert = null;
|
||||
this.subjectNameMap = null;
|
||||
this.issuerNameMap = null;
|
||||
this.dateMap = null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class CredentialAbstractVo {
|
||||
credType: string;
|
||||
alias: string;
|
||||
keyUri: string;
|
||||
|
||||
constructor(credType: string,
|
||||
alias: string,
|
||||
keyUri: string) {
|
||||
this.credType = credType;
|
||||
this.alias = alias;
|
||||
this.keyUri = keyUri;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class CredentialVo {
|
||||
credType: string;
|
||||
alias: string;
|
||||
keyUri: string;
|
||||
certNum: number;
|
||||
keyNum: number;
|
||||
credData: Uint8Array;
|
||||
|
||||
constructor(credType: string,
|
||||
alias: string,
|
||||
keyUri: string,
|
||||
certNum: number,
|
||||
keyNum: number,
|
||||
credData: Uint8Array) {
|
||||
this.credType = credType;
|
||||
this.alias = alias;
|
||||
this.keyUri = keyUri;
|
||||
this.certNum = certNum;
|
||||
this.keyNum = keyNum;
|
||||
this.credData = credData;
|
||||
}
|
||||
|
||||
clearCredentialVo() {
|
||||
this.credType = "";
|
||||
this.alias = "";
|
||||
this.keyUri = "";
|
||||
this.certNum = 0;
|
||||
this.keyNum = 0;
|
||||
this.credData = null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,566 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CertManagerStore } from '../stub/certStubStruct'
|
||||
import { CertAbstractVo } from './CertManagerVo/CertAbstractVo'
|
||||
import { CertInfoVo } from './CertManagerVo/CertInfoVo'
|
||||
import { CredentialAbstractVo } from './CertManagerVo/CredentialAbstractVo'
|
||||
import { CredentialVo } from './CertManagerVo/CredentialVo'
|
||||
|
||||
const TAG = "CertManager Model: ";
|
||||
var certManager = globalThis.certStub;
|
||||
|
||||
export enum CMModelErrorCode {
|
||||
CM_MODEL_ERROR_SUCCESS = 0,
|
||||
CM_MODEL_ERROR_FAILED = -1,
|
||||
CM_MODEL_ERROR_EXCEPTION = -2,
|
||||
CM_MODEL_ERROR_UNKNOWN_OPT = -3,
|
||||
CM_MODEL_ERROR_NOT_SUPPORT = -4,
|
||||
}
|
||||
|
||||
export enum CMModelOptType {
|
||||
CM_MODEL_OPT_UNKNOWN = 0,
|
||||
CM_MODEL_OPT_SYSTEM_CA = 1,
|
||||
CM_MODEL_OPT_USER_CA = 2,
|
||||
CM_MODEL_OPT_APP_CRED = 3,
|
||||
CM_MODEL_OPT_PRIVATE_CRED = 4,
|
||||
}
|
||||
|
||||
export class CertMangerModel {
|
||||
getCertOrCredList(optType, callback) {
|
||||
console.log(TAG + "getCertOrCredList start");
|
||||
|
||||
switch (optType) {
|
||||
case CMModelOptType.CM_MODEL_OPT_SYSTEM_CA:
|
||||
this.getSystemTrustedCertificateList((errCode, certList) => {
|
||||
callback(errCode, certList)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_USER_CA:
|
||||
this.getUserTrustedCertificateList((errCode, certList) => {
|
||||
callback(errCode, certList)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_APP_CRED:
|
||||
this.getAppCredList((errCode, credList) => {
|
||||
callback(errCode, credList)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_PRIVATE_CRED:
|
||||
this.getPrivateCredList((errCode, credList) => {
|
||||
callback(errCode, credList)
|
||||
});
|
||||
break;
|
||||
default:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_UNKNOWN_OPT, null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
getCertOrCred(optType, uri, callback) {
|
||||
console.log(TAG + "getCertOrCred start");
|
||||
|
||||
switch (optType) {
|
||||
case CMModelOptType.CM_MODEL_OPT_SYSTEM_CA:
|
||||
this.getSystemTrustedCertificate(uri, (errCode, certInfo) => {
|
||||
console.info('getSystemTrustedCertificate certInfo is' + JSON.stringify(certInfo))
|
||||
callback(errCode, certInfo)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_USER_CA:
|
||||
this.getUserTrustedCertificate(uri, (errCode, certInfo) => {
|
||||
callback(errCode, certInfo)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_APP_CRED:
|
||||
this.getAppCredential(uri, (errCode, credInfo) => {
|
||||
callback(errCode, credInfo)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_PRIVATE_CRED:
|
||||
this.getPrivateCred(uri, (errCode, credInfo) => {
|
||||
callback(errCode, credInfo)
|
||||
});
|
||||
break;
|
||||
default:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_UNKNOWN_OPT, null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
deleteCertOrCred(optType, uri, callback) {
|
||||
console.log(TAG + "deleteCertOrCred start");
|
||||
|
||||
switch (optType) {
|
||||
case CMModelOptType.CM_MODEL_OPT_USER_CA:
|
||||
this.deleteUserTrustedCertificate(uri, (errCode) => {
|
||||
callback(errCode)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_APP_CRED:
|
||||
this.deleteAppCredential(uri, (errCode) => {
|
||||
callback(errCode)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_SYSTEM_CA:
|
||||
case CMModelOptType.CM_MODEL_OPT_PRIVATE_CRED:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_NOT_SUPPORT)
|
||||
break;
|
||||
default:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_UNKNOWN_OPT)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setCertStatus(optType, uri, status, callback) {
|
||||
console.log(TAG + "setCertStatus start");
|
||||
|
||||
switch (optType) {
|
||||
case CMModelOptType.CM_MODEL_OPT_USER_CA:
|
||||
this.setCertificateStatus(uri, CertManagerStore.CERT_MANAGER_USER_TRUSTED_STORE, status, (errCode) => {
|
||||
callback(errCode)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_SYSTEM_CA:
|
||||
this.setCertificateStatus(uri, CertManagerStore.CERT_MANAGER_SYSTEM_TRUSTED_STORE, status, (errCode) => {
|
||||
callback(errCode)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_APP_CRED:
|
||||
case CMModelOptType.CM_MODEL_OPT_PRIVATE_CRED:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_NOT_SUPPORT)
|
||||
break;
|
||||
default:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_UNKNOWN_OPT)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
delAllCertOrCred(optType, callback) {
|
||||
console.log(TAG + "delAllCertOrCred start");
|
||||
|
||||
switch (optType) {
|
||||
case CMModelOptType.CM_MODEL_OPT_USER_CA:
|
||||
this.delAllUserCertificate((errCode) => {
|
||||
callback(errCode)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_APP_CRED:
|
||||
this.delAllAppCredential((errCode) => {
|
||||
callback(errCode)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_SYSTEM_CA:
|
||||
case CMModelOptType.CM_MODEL_OPT_PRIVATE_CRED:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_NOT_SUPPORT)
|
||||
break;
|
||||
default:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_UNKNOWN_OPT)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
getAuthAppList(optType, uri, callback) {
|
||||
console.log(TAG + "getAuthAppList start");
|
||||
|
||||
switch (optType) {
|
||||
case CMModelOptType.CM_MODEL_OPT_APP_CRED:
|
||||
this.getAuthorizedAppList(uri, (errCode, appUidList) => {
|
||||
callback(errCode, appUidList)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_USER_CA:
|
||||
case CMModelOptType.CM_MODEL_OPT_SYSTEM_CA:
|
||||
case CMModelOptType.CM_MODEL_OPT_PRIVATE_CRED:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_NOT_SUPPORT)
|
||||
break;
|
||||
default:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_UNKNOWN_OPT)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setAppAuth(optType, uri, appUid, status, callback) {
|
||||
console.log(TAG + "setAppAuth start");
|
||||
|
||||
switch (optType) {
|
||||
case CMModelOptType.CM_MODEL_OPT_APP_CRED:
|
||||
this.setAuthorizedAppStatus(uri, appUid, status, (errCode, data) => {
|
||||
callback(errCode, data)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_USER_CA:
|
||||
case CMModelOptType.CM_MODEL_OPT_SYSTEM_CA:
|
||||
case CMModelOptType.CM_MODEL_OPT_PRIVATE_CRED:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_NOT_SUPPORT)
|
||||
break;
|
||||
default:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_UNKNOWN_OPT)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
installCertOrCred(optType, alias, data, pwd, callback) {
|
||||
console.log(TAG + "installCertOrCred start");
|
||||
console.info(TAG + 'installCert optType: ' + optType + 'alias: ' + alias + ' pwd: ' + pwd)
|
||||
switch (optType) {
|
||||
case CMModelOptType.CM_MODEL_OPT_USER_CA:
|
||||
this.installUserCertificate(data, alias, (errCode) => {
|
||||
callback(errCode)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_APP_CRED:
|
||||
this.installAppCertificate(data, alias, pwd, (errCode) => {
|
||||
callback(errCode)
|
||||
});
|
||||
break;
|
||||
case CMModelOptType.CM_MODEL_OPT_PRIVATE_CRED:
|
||||
case CMModelOptType.CM_MODEL_OPT_SYSTEM_CA:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_NOT_SUPPORT)
|
||||
break;
|
||||
default:
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_UNKNOWN_OPT)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async getSystemTrustedCertificateList(callback) {
|
||||
console.log(TAG + "getSystemTrustedCertificateList start");
|
||||
try {
|
||||
let SubjectNameCN;
|
||||
let result = await certManager.getSystemTrustedCertificateList();
|
||||
let certList = new Array();
|
||||
console.log(TAG + "certManager::getSystemTrustedCertificateList result: " + JSON.stringify(result));
|
||||
for (let i = 0; i < result.certList.length; i++) {
|
||||
if (result.certList[i].subjectName.length != 0) {
|
||||
SubjectNameCN = result.certList[i].subjectName.match(/(?<=CN=).*?(?=,)/g).toString()
|
||||
console.info('SubjectNameCN is:' + SubjectNameCN)
|
||||
}
|
||||
certList.push(new CertAbstractVo(result.certList[i].uri, result.certList[i].certAlias,
|
||||
result.certList[i].status, result.certList[i].subjectName, SubjectNameCN))
|
||||
}
|
||||
console.log(TAG + "getSystemTrustedCertificateList end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS, certList)
|
||||
|
||||
} catch (err) {
|
||||
console.log(TAG + "getSystemTrustedCertificateList err: " + JSON.stringify(err));
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION, null)
|
||||
}
|
||||
}
|
||||
|
||||
private async getSystemTrustedCertificate(certUri, callback) {
|
||||
console.log(TAG + "getSystemTrustedCertificate start");
|
||||
try {
|
||||
let result = await certManager.getSystemTrustedCertificate(certUri);
|
||||
let subjectNameMap: Map<string, string> = new Map()
|
||||
let issuerNameMap: Map<string, string> = new Map()
|
||||
let dateMap: Map<string, string> = new Map()
|
||||
if (result.certInfo.subjectName.length != 0) {
|
||||
let SubjectNameCN = result.certInfo.subjectName.match(/(?<=CN=).*?(?=,)/g)
|
||||
console.info('SubjectNameCN is:' + SubjectNameCN)
|
||||
let SubjectNameOU = result.certInfo.subjectName.match(/(?<=OU=).*?(?=,)/g)
|
||||
console.info('SubjectNameOU is:' + SubjectNameOU)
|
||||
let SubjectNameO = result.certInfo.subjectName.match(/(?<=O=).*/g)
|
||||
console.info('SubjectNameO is:' + SubjectNameO)
|
||||
subjectNameMap.set('常用名称:', String(SubjectNameCN))
|
||||
subjectNameMap.set('组织:', String(SubjectNameO))
|
||||
subjectNameMap.set('组织单位:', String(SubjectNameOU))
|
||||
subjectNameMap.set('序列号:', result.certInfo.serial)
|
||||
}
|
||||
if (result.certInfo.issuerName.length != 0) {
|
||||
let IssuerNameCN = result.certInfo.subjectName.match(/(?<=CN=).*?(?=,)/g)
|
||||
console.info('SubjectNameCN is:' + IssuerNameCN)
|
||||
let IssuerNameOU = result.certInfo.subjectName.match(/(?<=OU=).*?(?=,)/g)
|
||||
console.info('SubjectNameOU is:' + IssuerNameOU)
|
||||
let IssuerNameO = result.certInfo.subjectName.match(/(?<=O=).*/g)
|
||||
console.info('SubjectNameO is:' + IssuerNameO)
|
||||
issuerNameMap.set('常用名称:', String(IssuerNameCN))
|
||||
issuerNameMap.set('组织:', String(IssuerNameO))
|
||||
issuerNameMap.set('组织单位:', String(IssuerNameOU))
|
||||
}
|
||||
dateMap.set('颁发时间:', result.certInfo.notBefore)
|
||||
dateMap.set('有效期至:', result.certInfo.notAfter)
|
||||
|
||||
let certInfo = new CertInfoVo(result.certInfo.uri, result.certInfo.certAlias,
|
||||
result.certInfo.status, result.certInfo.issuerName, result.certInfo.subjectName,
|
||||
result.certInfo.serial, result.certInfo.notBefore,
|
||||
result.certInfo.notAfter, result.certInfo.fingerprintSha256, result.certInfo.cert,
|
||||
subjectNameMap, issuerNameMap, dateMap);
|
||||
|
||||
console.log(TAG + "getSystemTrustedCertificate end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS, certInfo)
|
||||
|
||||
} catch (err) {
|
||||
console.log(TAG + "getSystemTrustedCertificate err: " + JSON.stringify(err));
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION, null)
|
||||
}
|
||||
}
|
||||
|
||||
private async getUserTrustedCertificateList(callback) {
|
||||
console.log(TAG + "getUserTrustedCertificateList start");
|
||||
try {
|
||||
let SubjectNameCN
|
||||
let result = await certManager.getUserTrustedCertificateList();
|
||||
let certList = new Array();
|
||||
console.log(TAG + "getUserTrustedCertificateList result: " + JSON.stringify(result));
|
||||
for (let i = 0; i < result.certList.length; i++) {
|
||||
if (result.certList[i].subjectName.length != 0) {
|
||||
SubjectNameCN = result.certList[i].subjectName.match(/(?<=CN=).*?(?=,)/g).toString()
|
||||
console.info('SubjectNameCN is:' + SubjectNameCN)
|
||||
}
|
||||
certList.push(new CertAbstractVo(result.certList[i].uri, result.certList[i].certAlias,
|
||||
result.certList[i].status, result.certList[i].subjectName, SubjectNameCN))
|
||||
}
|
||||
console.log(TAG + "getUserTrustedCertificateList end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS, certList)
|
||||
} catch (err) {
|
||||
console.log(TAG + "getUserTrustedCertificateList err: " + JSON.stringify(err));
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
private async getUserTrustedCertificate(certUri, callback) {
|
||||
console.log(TAG + "getUserTrustedCertificate start");
|
||||
try {
|
||||
let result = await certManager.getUserTrustedCertificate(certUri);
|
||||
let subjectNameMap: Map<string, string> = new Map()
|
||||
let issuerNameMap: Map<string, string> = new Map()
|
||||
let dateMap: Map<string, string> = new Map()
|
||||
|
||||
if (result.certInfo.subjectName.length != 0) {
|
||||
let SubjectNameCN = result.certInfo.subjectName.match(/(?<=CN=).*?(?=,)/g)
|
||||
console.info('SubjectNameCN is:' + SubjectNameCN)
|
||||
let SubjectNameOU = result.certInfo.subjectName.match(/(?<=OU=).*?(?=,)/g)
|
||||
console.info('SubjectNameOU is:' + SubjectNameOU)
|
||||
let SubjectNameO = result.certInfo.subjectName.match(/(?<=O=).*/g)
|
||||
console.info('SubjectNameO is:' + SubjectNameO)
|
||||
subjectNameMap.set('常用名称:', String(SubjectNameCN))
|
||||
subjectNameMap.set('组织:', String(SubjectNameO))
|
||||
subjectNameMap.set('组织单位:', String(SubjectNameOU))
|
||||
subjectNameMap.set('序列号:', result.certInfo.serial)
|
||||
}
|
||||
if (result.certInfo.issuerName.length != 0) {
|
||||
let IssuerNameCN = result.certInfo.subjectName.match(/(?<=CN=).*?(?=,)/g)
|
||||
console.info('SubjectNameCN is:' + IssuerNameCN)
|
||||
let IssuerNameOU = result.certInfo.subjectName.match(/(?<=OU=).*?(?=,)/g)
|
||||
console.info('SubjectNameOU is:' + IssuerNameOU)
|
||||
let IssuerNameO = result.certInfo.subjectName.match(/(?<=O=).*/g)
|
||||
console.info('SubjectNameO is:' + IssuerNameO)
|
||||
issuerNameMap.set('常用名称:', String(IssuerNameCN))
|
||||
issuerNameMap.set('组织:', String(IssuerNameO))
|
||||
issuerNameMap.set('组织单位:', String(IssuerNameOU))
|
||||
}
|
||||
dateMap.set('颁发时间:', result.certInfo.notBefore)
|
||||
dateMap.set('有效期至:', result.certInfo.notAfter)
|
||||
let certInfo = new CertInfoVo(result.certInfo.uri, result.certInfo.certAlias,
|
||||
result.certInfo.status, result.certInfo.issuerName, result.certInfo.subjectName,
|
||||
result.certInfo.serial, result.certInfo.notBefore,
|
||||
result.certInfo.notAfter, result.certInfo.fingerprintSha256, result.certInfo.cert,
|
||||
subjectNameMap, issuerNameMap, dateMap);
|
||||
console.log(TAG + "getUserTrustedCertificate end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS, certInfo)
|
||||
} catch (err) {
|
||||
console.log(TAG + "getUserTrustedCertificate err: " + JSON.stringify(err));
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION, null)
|
||||
}
|
||||
}
|
||||
|
||||
private async deleteUserTrustedCertificate(certUri, callback) {
|
||||
console.log(TAG + "deleteUserTrustedCertificate start");
|
||||
try {
|
||||
await certManager.uninstallUserTrustedCertificate(certUri);
|
||||
console.log(TAG + "deleteUserTrustedCertificate end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS)
|
||||
} catch (err) {
|
||||
console.log(TAG + "deleteUserTrustedCertificate err: " + JSON.stringify(err));
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
private async setCertificateStatus(certUri, store, status, callback) {
|
||||
console.log(TAG + "setCertificateStatus start");
|
||||
try {
|
||||
await certManager.setCertificateStatus(certUri, store, status);
|
||||
console.log(TAG + "setCertificateStatus end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS)
|
||||
} catch (err) {
|
||||
console.info(TAG + 'setCertificateStatus fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
private async getAppCredList(callback) {
|
||||
console.log(TAG + "getAppCredList start");
|
||||
|
||||
try {
|
||||
let result = await certManager.getAppCertificateList();
|
||||
let credList = new Array();
|
||||
for (let i = 0; i < result.credentialList.length; i++) {
|
||||
credList.push(new CredentialAbstractVo(result.credentialList[i].type, result.credentialList[i].alias,
|
||||
result.credentialList[i].keyUri))
|
||||
}
|
||||
console.log(TAG + "getAppCredList end credList: " + JSON.stringify(credList));
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS, credList)
|
||||
} catch (err) {
|
||||
console.info(TAG + 'getAppCredList fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
private async getAppCredential(certUri, callback) {
|
||||
console.log(TAG + "getAppCredential start");
|
||||
try {
|
||||
let result = await certManager.getAppCertificate(certUri);
|
||||
let credInfo = new CredentialVo(result.credential.type, result.credential.alias,
|
||||
result.credential.keyUri, result.credential.certNum, result.credential.keyNum, result.credential.credData);
|
||||
console.log(TAG + "getAppCredential end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS, credInfo)
|
||||
} catch (err) {
|
||||
console.info(TAG + 'getAppCredential fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION, null)
|
||||
}
|
||||
}
|
||||
|
||||
private async deleteAppCredential(certUri, callback) {
|
||||
console.log(TAG + "deleteAppCredential start");
|
||||
try {
|
||||
await certManager.uninstallAppCertificate(certUri);
|
||||
console.log(TAG + "deleteAppCredential end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS)
|
||||
} catch (err) {
|
||||
console.info(TAG + 'deleteAppCredential fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
private async getPrivateCredList(callback) {
|
||||
console.log(TAG + "getPrivateCredList start");
|
||||
|
||||
try {
|
||||
let result = await certManager.getPrivateCertificateList();
|
||||
let credList = new Array();
|
||||
for (let i = 0; i < result.credentialList.length; i++) {
|
||||
credList.push(new CredentialAbstractVo(result.credentialList[i].type, result.credentialList[i].alias,
|
||||
result.credentialList[i].keyUri))
|
||||
}
|
||||
console.log(TAG + "getPrivateCredList end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS, credList)
|
||||
} catch (err) {
|
||||
console.info(TAG + 'getPrivateCredList fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
private async getPrivateCred(certUri, callback) {
|
||||
console.log(TAG + "getPrivateCred start");
|
||||
try {
|
||||
let result = await certManager.getPrivateCertificate(certUri);
|
||||
let credInfo = new CredentialVo(result.credential.type, result.credential.alias,
|
||||
result.credential.keyUri, result.credential.certNum, result.credential.keyNum, result.credential.credData);
|
||||
console.log(TAG + "getPrivateCred end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS, credInfo)
|
||||
} catch (err) {
|
||||
console.info(TAG + 'getPrivateCred fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION, null)
|
||||
}
|
||||
}
|
||||
|
||||
private async delAllUserCertificate(callback) {
|
||||
console.log(TAG + "delAllUserCertificate start");
|
||||
try {
|
||||
await certManager.uninstallAllUserTrustedCertificate();
|
||||
console.log(TAG + "delAllUserCertificate end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS)
|
||||
} catch (err) {
|
||||
console.info(TAG + 'delAllUserCertificate fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
private async delAllAppCredential(callback) {
|
||||
console.log(TAG + "delAllAppCredential start");
|
||||
try {
|
||||
await certManager.uninstallAllAppCertificate();
|
||||
console.log(TAG + "delAllAppCredential end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS)
|
||||
} catch (err) {
|
||||
console.info(TAG + 'delAllAppCredential fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
private async getAuthorizedAppList(uri, callback) {
|
||||
console.log(TAG + "getAuthorizedAppList start");
|
||||
try {
|
||||
let result = await certManager.getAuthorizedAppList(uri);
|
||||
console.log(TAG + "getAuthorizedAppList end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS, result.appUidList)
|
||||
} catch (err) {
|
||||
console.info(TAG + 'getAuthorizedAppList fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION, null)
|
||||
}
|
||||
}
|
||||
|
||||
private async setAuthorizedAppStatus(uri, appUid, status, callback) {
|
||||
console.log(TAG + "setAuthorizedAppStatus start");
|
||||
try {
|
||||
if (status) {
|
||||
let result = await certManager.grantAppCertificate(uri, appUid);
|
||||
console.log(TAG + "setAuthorizedAppStatus true end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS, result.authUri)
|
||||
} else {
|
||||
await certManager.removeGrantedAppCertificate(uri, appUid);
|
||||
console.log(TAG + "setAuthorizedAppStatus false end");
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS)
|
||||
}
|
||||
} catch (err) {
|
||||
console.info(TAG + 'setAuthorizedAppStatus fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
private async installUserCertificate(data, alias, callback) {
|
||||
console.info(TAG + 'installUserCertificate start alias: ' + alias + 'data' + JSON.stringify(data))
|
||||
try {
|
||||
await certManager.installUserTrustedCertificate({
|
||||
inData: data,
|
||||
alias: alias
|
||||
});
|
||||
|
||||
console.info(TAG + 'installUserCertificate end')
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS)
|
||||
} catch (err) {
|
||||
console.info(TAG + 'installUserCertificate fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
private async installAppCertificate(data, alias, pwd, callback) {
|
||||
console.info(TAG + 'installAppCertificate start')
|
||||
try {
|
||||
await certManager.installAppCertificate(data, pwd, alias);
|
||||
console.info(TAG + 'installAppCertificate end')
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_SUCCESS)
|
||||
} catch (err) {
|
||||
console.info(TAG + 'installAppCertificate fail, err is' + err)
|
||||
callback(CMModelErrorCode.CM_MODEL_ERROR_EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let certMangerModel = new CertMangerModel();
|
||||
|
||||
export default certMangerModel as CertMangerModel;
|
@ -0,0 +1,102 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import fileio from '@ohos.fileio';
|
||||
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
|
||||
|
||||
export class FileIoModel {
|
||||
media;
|
||||
constructor() {
|
||||
this.media = mediaLibrary.getMediaLibrary(globalThis.certManagerAbilityContext);
|
||||
}
|
||||
|
||||
getFileIdFromMediaUri(mediaUri) {
|
||||
console.log("getMediaFileSuffix getFileIdFromMediaUri uri: " + mediaUri);
|
||||
|
||||
let elemList = mediaUri.split("/");
|
||||
let fileIdString = elemList[elemList.length - 1];
|
||||
let fileIdNum = fileIdString.match(/\d+/g);
|
||||
|
||||
return fileIdNum;
|
||||
}
|
||||
|
||||
getMediaFileSuffix(mediaUri, callback) {
|
||||
console.log("getMediaFileSuffix start uri: " + mediaUri);
|
||||
let fileKeyObj = mediaLibrary.FileKey
|
||||
let fileId = this.getFileIdFromMediaUri(mediaUri);
|
||||
console.log("getMediaFileSuffix start fileId: " + fileId);
|
||||
let imagesFetchOp = {
|
||||
selections: fileKeyObj.ID + '= ?',
|
||||
selectionArgs: [fileId.toString()],
|
||||
};
|
||||
let suffix;
|
||||
|
||||
this.media.getFileAssets(imagesFetchOp, (error, fetchFileResult) => {
|
||||
console.log("getMediaFile getFileAssets callback in fetchFileResult: ");
|
||||
if (fetchFileResult != undefined) {
|
||||
fetchFileResult.getFirstObject(async (error, fileAsset) => {
|
||||
console.log("getMediaFile getFileAssets callback getFirstObject: ");
|
||||
if (fileAsset) {
|
||||
console.log("getMediaFile getFileAssets fileAsset: " + fileAsset.displayName);
|
||||
suffix = fileAsset.displayName.substring(fileAsset.displayName.lastIndexOf(".") + 1);
|
||||
callback(suffix);
|
||||
} else {
|
||||
console.log("getMediaFile getFileAssets callback getFirstObject else");
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log("getMediaFile getFileAssets callback in else: ");
|
||||
callback(undefined);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getMediaFileData(mediaUri, callback) {
|
||||
console.log("getMediaFile start");
|
||||
|
||||
let fileKeyObj = mediaLibrary.FileKey;
|
||||
let fileId = this.getFileIdFromMediaUri(mediaUri);
|
||||
let imagesFetchOp = {
|
||||
selections: fileKeyObj.ID + '= ?',
|
||||
selectionArgs: [fileId.toString()],
|
||||
};
|
||||
let fd;
|
||||
|
||||
this.media.getFileAssets(imagesFetchOp, (error, fetchFileResult) => {
|
||||
if (fetchFileResult != undefined) {
|
||||
fetchFileResult.getFirstObject(async (error, fileAsset) => {
|
||||
console.log("getMediaFile getFileAssets fileAsset: " + fileAsset.displayName);
|
||||
|
||||
if (fileAsset) {
|
||||
let buf = new ArrayBuffer(fileAsset.size);
|
||||
fd = await fileAsset.open("r");
|
||||
fileio.read(fd, buf, (err, data) => {
|
||||
if (data) {
|
||||
console.info("getMediaFile read file data exist ");
|
||||
callback(new Uint8Array(data.buffer));
|
||||
} else {
|
||||
console.info("getMediaFile read file data: null");
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
let fileIoModel = new FileIoModel();
|
||||
|
||||
export default fileIoModel as FileIoModel;
|
@ -0,0 +1,747 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import LogUtil from '../../../../../../common/util/LogUtil';
|
||||
import ConfigData from '../../../../../../common/util/ConfigData';
|
||||
import HeadComponent from '../../../../../../common/component/headComponent';
|
||||
import CMShowAppCredPresenter from '../presenter/CMShowAppCredPresenter';
|
||||
import CMShowPrivateCredPresenter from '../presenter/CMShowPrivateCredPresenter';
|
||||
import CMFaPresenter from '../presenter/CMFaPresenter';
|
||||
|
||||
@Component
|
||||
export struct DialogComponent {
|
||||
@Link uidItem: CMShowAppCredPresenter;
|
||||
private AppName: string;
|
||||
private AppImage: string;
|
||||
private Index: number;
|
||||
|
||||
build() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
Image(this.AppImage)
|
||||
.width($r("app.float.credentials_app_image_wh"))
|
||||
.height($r("app.float.credentials_app_image_hg"))
|
||||
|
||||
Text(this.AppName)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: $r("app.float.credentials_app_name_margin") })
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
|
||||
Toggle({ type: ToggleType.Switch, isOn: true })
|
||||
.width($r("app.float.credentials_app_Toggle_wh"))
|
||||
.height($r("app.float.credentials_app_Toggle_hg"))
|
||||
.selectedColor($r("app.color.credentials_app_Toggle_selectColor"))
|
||||
.onChange((isOn: boolean) => {
|
||||
this.uidItem.appInfoList[this.Index].status = isOn
|
||||
})
|
||||
.offset({ x: 7, y:0 })
|
||||
|
||||
}.height($r("app.float.wh_value_72"))
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
@Component
|
||||
struct CustomDialogExampleAuthor {
|
||||
controller: CustomDialogController;
|
||||
@Link isShowAuthDialog: boolean;
|
||||
@Link AuthorInfo: CMShowAppCredPresenter;
|
||||
@State updateStatusList: boolean[] = [];
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.managerAuthApp"))
|
||||
.height($r("app.float.wh_value_56"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_dialog_tittle"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start);
|
||||
if (this.AuthorInfo.appInfoList.length > ConfigData.APP_AUTH_MAX_LENGTH) {
|
||||
List() {
|
||||
ForEach(this.AuthorInfo.appInfoList, (item, index) => {
|
||||
ListItem() {
|
||||
DialogComponent({ AppImage: item.appImage, AppName: item.appName, Index: index, uidItem: $AuthorInfo })
|
||||
}
|
||||
})
|
||||
}
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.height(ConfigData.WH_50_100)
|
||||
.divider({
|
||||
strokeWidth: $r("app.float.Evidence_strokeWidth"),
|
||||
color: $r("app.color.Evidence_color")})
|
||||
.borderRadius($r("app.float.Evidence_borderRadius"))
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.visibility(this.AuthorInfo.appInfoList.length > 0 ? Visibility.Visible : Visibility.None)
|
||||
} else {
|
||||
List() {
|
||||
ForEach(this.AuthorInfo.appInfoList, (item, index) => {
|
||||
ListItem() {
|
||||
DialogComponent({ AppImage: item.appImage, AppName: item.appName, Index: index, uidItem: $AuthorInfo })
|
||||
}
|
||||
})
|
||||
}
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.divider({
|
||||
strokeWidth: $r("app.float.Evidence_strokeWidth"),
|
||||
color: $r("app.color.Evidence_color")})
|
||||
.borderRadius($r("app.float.Evidence_borderRadius"))
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.visibility(this.AuthorInfo.appInfoList.length > 0 ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
|
||||
Button($r("app.string.cancelAuthApp"))
|
||||
.onClick(() => {
|
||||
this.isShowAuthDialog = false;
|
||||
this.controller.close()
|
||||
})
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_hyperlink"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
Divider()
|
||||
.strokeWidth(ConfigData.VERTICAL_DIVIDER_WIDTH)
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.vertical(true)
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
Button($r("app.string.finishAuthApp"))
|
||||
.onClick(() => {
|
||||
this.AuthorInfo.removeGrantedAppList(this.AuthorInfo.credInfo.keyUri)
|
||||
this.isShowAuthDialog = false;
|
||||
this.controller.close()
|
||||
})
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_hyperlink"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
}
|
||||
.height($r('app.float.wh_value_64'))
|
||||
.padding({
|
||||
bottom: $r('app.float.wh_value_16')
|
||||
})
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_6'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
@Component
|
||||
struct CustomDialogExamplePrivate {
|
||||
controller: CustomDialogController;
|
||||
@State PriCerInfoPresenter: CMShowPrivateCredPresenter = CMShowPrivateCredPresenter.getInstance();
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.evidenceDetails"))
|
||||
.height($r("app.float.wh_value_56"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_dialog_tittle"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Text(this.PriCerInfoPresenter.credInfo.alias)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Text($r("app.string.entryContains"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_24'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Text($r("app.string.keyNum", String(this.PriCerInfoPresenter.credInfo.keyNum)))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.opacity($r('app.float.opacity_100_60'))
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Text($r("app.string.userCerNum", String(this.PriCerInfoPresenter.credInfo.certNum)))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.opacity($r('app.float.opacity_100_60'))
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
|
||||
Button($r("app.string.privateDetailsClose"))
|
||||
.onClick(() => {
|
||||
this.controller.close()
|
||||
})
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_hyperlink"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
}
|
||||
.height($r('app.float.wh_value_64'))
|
||||
.padding({
|
||||
bottom: $r('app.float.wh_value_16')
|
||||
})
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_16'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
@Component
|
||||
struct CustomDialogDeleteWarning {
|
||||
controller: CustomDialogController;
|
||||
@Link deleteWarn: CMShowAppCredPresenter;
|
||||
@Link isShowWarnDialog: boolean;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.warning_title"))
|
||||
.height($r("app.float.wh_value_56"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_dialog_tittle"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
Text($r("app.string.warning_message"))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor($r("sys.color.ohos_id_color_primary"))
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_16"),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
|
||||
Button($r("app.string.deleteAllCredCancel"))
|
||||
.onClick(() => {
|
||||
this.isShowWarnDialog = false;
|
||||
this.controller.close()
|
||||
})
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_hyperlink"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
Divider()
|
||||
.strokeWidth(ConfigData.VERTICAL_DIVIDER_WIDTH)
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.vertical(true)
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
Button($r("app.string.deleteAllCredDelete"))
|
||||
.onClick(() => {
|
||||
this.deleteWarn.deleteAppCred(this.deleteWarn.credInfo.keyUri);
|
||||
this.isShowWarnDialog = false;
|
||||
this.controller.close()
|
||||
})
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_warning"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
}
|
||||
.height($r('app.float.wh_value_64'))
|
||||
.padding({
|
||||
bottom: $r('app.float.wh_value_16')
|
||||
})
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_16'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
@Component
|
||||
struct CustomDialogExampleApp {
|
||||
controller: CustomDialogController;
|
||||
@Link mShowAppCaPresenter: CMShowAppCredPresenter;
|
||||
@Link isShowAuthDialog: boolean;
|
||||
@Link isShowWarnDialog: boolean;
|
||||
|
||||
aboutToAppear() {
|
||||
this.mShowAppCaPresenter.getAuthorizedAppList(this.mShowAppCaPresenter.credInfo.keyUri)
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.evidenceDetails"))
|
||||
.height($r("app.float.wh_value_56"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_dialog_tittle"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Text(this.mShowAppCaPresenter.credInfo.alias)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Text($r("app.string.entryContains"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_24'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Text($r("app.string.keyNum", String(this.mShowAppCaPresenter.credInfo.keyNum)))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.opacity($r('app.float.opacity_100_60'))
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Text($r("app.string.userCerNum", String(this.mShowAppCaPresenter.credInfo.certNum)))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.opacity($r('app.float.opacity_100_60'))
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text($r("app.string.managerAuthApp"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
}
|
||||
|
||||
Row() {
|
||||
Image($r('app.media.ic_settings_arrow'))
|
||||
.width($r("app.float.managerAuthApp_image_wh"))
|
||||
.height($r("app.float.managerAuthApp_image_hg"))
|
||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
||||
.opacity($r("app.float.managerAuthApp_image_opacity"))
|
||||
}
|
||||
}
|
||||
.onClick(() => {
|
||||
this.isShowAuthDialog = true;
|
||||
})
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_12'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.height('48vp')
|
||||
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
|
||||
Button($r("app.string.publicDetailsCancel"))
|
||||
.onClick(() => {
|
||||
this.isShowAuthDialog = false;
|
||||
this.isShowWarnDialog = false;
|
||||
this.controller.close();
|
||||
})
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_hyperlink"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
Divider()
|
||||
.strokeWidth(ConfigData.VERTICAL_DIVIDER_WIDTH)
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.vertical(true)
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
Button($r("app.string.publicDetailsDelete"))
|
||||
.onClick(() => {
|
||||
this.isShowWarnDialog = true;
|
||||
this.isShowAuthDialog = false;
|
||||
this.controller.close()
|
||||
})
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_warning"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
}
|
||||
.height($r('app.float.wh_value_64'))
|
||||
.padding({
|
||||
bottom: $r('app.float.wh_value_16')
|
||||
})
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_16'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
export struct componentPublic {
|
||||
private Alias: string;
|
||||
private KeyUri: string;
|
||||
@Link mShowAppCaPresenter: CMShowAppCredPresenter;
|
||||
@State @Watch("onShowAuthMngChange") isShowAuthMng: boolean = false;
|
||||
@State @Watch("onShowDeleteWarnDialog") isShowWarning: boolean = false;
|
||||
detailsDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomDialogExampleApp({
|
||||
isShowAuthDialog: $isShowAuthMng,
|
||||
isShowWarnDialog: $isShowWarning,
|
||||
mShowAppCaPresenter: $mShowAppCaPresenter
|
||||
}),
|
||||
autoCancel: true,
|
||||
alignment: DialogAlignment.Bottom,
|
||||
offset: { dx: 0, dy: ConfigData.DIALOG_DY_OFFSET }
|
||||
})
|
||||
appDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomDialogExampleAuthor({ isShowAuthDialog: $isShowAuthMng, AuthorInfo: $mShowAppCaPresenter }),
|
||||
autoCancel: false,
|
||||
alignment: DialogAlignment.Bottom,
|
||||
offset: { dx: 0, dy: ConfigData.DIALOG_DY_OFFSET }
|
||||
})
|
||||
deleteWarnDialog: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomDialogDeleteWarning({ isShowWarnDialog: $isShowWarning, deleteWarn: $mShowAppCaPresenter }),
|
||||
autoCancel: false,
|
||||
alignment: DialogAlignment.Bottom,
|
||||
offset: { dx: 0, dy: ConfigData.DIALOG_DY_OFFSET }
|
||||
})
|
||||
|
||||
onShowAuthMngChange() {
|
||||
if (this.isShowAuthMng == true) {
|
||||
this.appDialogController.open();
|
||||
} else {
|
||||
this.detailsDialogController.close();
|
||||
this.detailsDialogController.open();
|
||||
this.appDialogController.close();
|
||||
}
|
||||
}
|
||||
|
||||
onShowDeleteWarnDialog() {
|
||||
if (this.isShowWarning == true) {
|
||||
this.deleteWarnDialog.open();
|
||||
} else {
|
||||
this.detailsDialogController.close();
|
||||
this.deleteWarnDialog.close();
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text(this.Alias)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
}
|
||||
.margin({
|
||||
left: $r("app.float.publicList_margin")
|
||||
})
|
||||
|
||||
Row() {
|
||||
Image($r('app.media.ic_settings_arrow'))
|
||||
.width($r("app.float.publicList_image_wh"))
|
||||
.height($r("app.float.publicList_image_hg"))
|
||||
}
|
||||
.margin({
|
||||
left: $r("app.float.publicList_margin"),
|
||||
right: $r("app.float.publicList_image_margin")
|
||||
})
|
||||
}
|
||||
.height($r("app.float.wh_value_48"))
|
||||
.borderRadius($r("app.float.publicList_borderRadius"))
|
||||
.onClick(() => {
|
||||
this.mShowAppCaPresenter.getAppCred(this.KeyUri)
|
||||
this.detailsDialogController.open()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
export struct componentPrivate {
|
||||
private Alias: string;
|
||||
private KeyUri: string;
|
||||
@State PrivateCerPresenter: CMShowPrivateCredPresenter = CMShowPrivateCredPresenter.getInstance();
|
||||
privateDetailDialog: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomDialogExamplePrivate(),
|
||||
autoCancel: true,
|
||||
alignment: DialogAlignment.Bottom,
|
||||
offset: { dx: 0, dy: ConfigData.DIALOG_DY_OFFSET }
|
||||
})
|
||||
|
||||
build() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text(this.Alias)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
}
|
||||
.margin({
|
||||
left: $r("app.float.publicList_margin")
|
||||
})
|
||||
|
||||
Row() {
|
||||
Image($r('app.media.ic_settings_arrow'))
|
||||
.width($r("app.float.publicList_image_wh"))
|
||||
.height($r("app.float.publicList_image_hg"))
|
||||
}
|
||||
.margin({
|
||||
left: $r("app.float.publicList_margin"),
|
||||
right: $r("app.float.publicList_image_margin")
|
||||
})
|
||||
}
|
||||
.height($r("app.float.wh_value_48"))
|
||||
.borderRadius($r("app.float.publicList_borderRadius"))
|
||||
.onClick(() => {
|
||||
this.PrivateCerPresenter.getPrivateCred(this.KeyUri)
|
||||
this.privateDetailDialog.open()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct evidenceList {
|
||||
@State mShowAppCaPresenter: CMShowAppCredPresenter = CMShowAppCredPresenter.getInstance();
|
||||
@State mShowPrivateCaPresenter: CMShowPrivateCredPresenter = CMShowPrivateCredPresenter.getInstance();
|
||||
@State mFaPresenter: CMFaPresenter = CMFaPresenter.getInstance();
|
||||
@State isTouched: boolean = false;
|
||||
@State currentIndex: number = 0
|
||||
@State fontColor: Resource = $r("app.color.evidenceList_TabBuilder_fontColor_182431")
|
||||
private controller: TabsController = new TabsController();
|
||||
|
||||
@Builder TabBuilder(index: number) {
|
||||
Column() {
|
||||
Text(index == 0 ? $r('app.string.tabName_public') : $r('app.string.tabName_private'))
|
||||
.fontColor(this.currentIndex === index ? $r("sys.color.ohos_id_color_bottom_tab_icon") : this.fontColor)
|
||||
.fontSize($r('app.float.font_16'))
|
||||
.fontWeight(this.currentIndex === index ? FontWeight.Medium : FontWeight.Regular)
|
||||
.alignSelf(ItemAlign.Center)
|
||||
.margin({
|
||||
top: $r('app.float.TrustedEvidence_TabBuilder_Text_padding_top_value') })
|
||||
if (this.currentIndex === index) {
|
||||
Divider()
|
||||
.width($r('app.float.TrustedEvidence_TabBuilder_Divider_width_value'))
|
||||
.margin({ top: $r('app.float.TrustedEvidence_TabBuilder_Divider_padding_top_value') })
|
||||
.strokeWidth(2)
|
||||
.color($r("sys.color.ohos_id_color_bottom_tab_icon"))
|
||||
.alignSelf(ItemAlign.Center)
|
||||
}
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
LogUtil.info('in aboutToAppear');
|
||||
this.mShowAppCaPresenter.updateAppCredList();
|
||||
this.mShowPrivateCaPresenter.updatePrivateCredList();
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
let uri = globalThis.abilityWant.uri;
|
||||
globalThis.abilityWant.uri = "";
|
||||
|
||||
if (uri === "certInstall") {
|
||||
this.mFaPresenter.startInstall();
|
||||
} else if (uri === "requestAuthorize") {
|
||||
this.mFaPresenter.startRequestAuth(globalThis.abilityWant.parameters.appUid);
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
GridContainer({
|
||||
columns: 12,
|
||||
sizeType: SizeType.Auto,
|
||||
gutter: vp2px(1) === 2 ? '12vp' : '0vp',
|
||||
margin: vp2px(1) === 2 ? '24vp' : '0vp'
|
||||
}) {
|
||||
Row() {
|
||||
Column() {
|
||||
HeadComponent({ headName: $r('app.string.userEvidence') })
|
||||
Column() {
|
||||
Tabs({ barPosition: BarPosition.Start, index: 0, controller: this.controller }) {
|
||||
TabContent() {
|
||||
List() {
|
||||
ForEach(this.mShowAppCaPresenter.credList, (item) => {
|
||||
ListItem() {
|
||||
componentPublic({
|
||||
Alias: item.alias,
|
||||
KeyUri: item.keyUri,
|
||||
mShowAppCaPresenter: $mShowAppCaPresenter
|
||||
})
|
||||
}
|
||||
}, item => JSON.stringify(item))
|
||||
}
|
||||
.width(ConfigData.WH_92_100)
|
||||
.margin({
|
||||
left: ConfigData.WH_4_100
|
||||
})
|
||||
.divider({
|
||||
strokeWidth: $r("app.float.Evidence_strokeWidth"),
|
||||
color: $r("app.color.Evidence_color"),
|
||||
startMargin: $r("app.float.Evidence_startMargin"),
|
||||
endMargin: $r("app.float.Evidence_endMargin")
|
||||
})
|
||||
.borderRadius($r("app.float.Evidence_borderRadius"))
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.visibility(this.mShowAppCaPresenter.credList.length > 0 ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
.tabBar(this.TabBuilder(0))
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouched = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouched = false;
|
||||
}
|
||||
})
|
||||
|
||||
TabContent() {
|
||||
List() {
|
||||
ForEach(this.mShowPrivateCaPresenter.credList, (item) => {
|
||||
ListItem() {
|
||||
componentPrivate({ Alias: item.alias, KeyUri: item.keyUri })
|
||||
}
|
||||
}, item => JSON.stringify(item))
|
||||
}
|
||||
.width(ConfigData.WH_92_100)
|
||||
.margin({
|
||||
left: ConfigData.WH_4_100
|
||||
})
|
||||
.divider({
|
||||
strokeWidth: $r("app.float.Evidence_strokeWidth"),
|
||||
color: $r("app.color.Evidence_color"),
|
||||
startMargin: $r("app.float.Evidence_startMargin"),
|
||||
endMargin: $r("app.float.Evidence_endMargin") })
|
||||
.borderRadius($r("app.float.Evidence_borderRadius"))
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.visibility(this.mShowPrivateCaPresenter.credList.length > 0 ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
.tabBar(this.TabBuilder(1))
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouched = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouched = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
.vertical(false)
|
||||
.scrollable(true)
|
||||
.barMode(BarMode.Fixed)
|
||||
.barWidth('192vp')
|
||||
.barHeight($r("app.float.Evidence_barHeight"))
|
||||
.animationDuration(400)
|
||||
.width(ConfigData.WH_100_100)
|
||||
.backgroundColor($r("app.color.TrustedEvidence_tabs_backgroundColor_F1F3F5"))
|
||||
.onChange((index: number) => {
|
||||
this.currentIndex = index
|
||||
});
|
||||
}
|
||||
.height(ConfigData.WH_94_100)
|
||||
.width(ConfigData.WH_100_100)
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100)
|
||||
.useSizeType({
|
||||
xs: { span: 12, offset: 0 }, sm: { span: 12, offset: 0 },
|
||||
md: { span: 12, offset: 0 }, lg: { span: 8, offset: 2 }
|
||||
});
|
||||
|
||||
Column() {
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100)
|
||||
.useSizeType({
|
||||
xs: { span: 0, offset: 12 }, sm: { span: 0, offset: 12 },
|
||||
md: { span: 0, offset: 12 }, lg: { span: 2, offset: 10 }
|
||||
})
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100);
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100);
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100);
|
||||
}
|
||||
}
|
@ -0,0 +1,159 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import HeadComponent from '../../../../../../common/component/headComponent';
|
||||
import LogUtil from '../../../../../../common/util/LogUtil';
|
||||
import ConfigData from '../../../../../../common/util/ConfigData';
|
||||
import router from '@system.router';
|
||||
import CMInstallPresenter from '../presenter/CMInstallPresenter';
|
||||
import CMFaPresenter from '../presenter/CMFaPresenter';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct CertInstallAliasInput {
|
||||
@State mAppCredAuthPresenter: CMInstallPresenter = CMInstallPresenter.getInstance();
|
||||
@State mFaPresenter: CMFaPresenter = CMFaPresenter.getInstance();
|
||||
@State certAlias: string = "";
|
||||
|
||||
onPageShow() {
|
||||
let uri = globalThis.abilityWant.uri;
|
||||
globalThis.abilityWant.uri = "";
|
||||
|
||||
if (uri === "certInstall") {
|
||||
this.mFaPresenter.startInstall();
|
||||
} else if (uri === "requestAuthorize") {
|
||||
this.mFaPresenter.startRequestAuth(globalThis.abilityWant.parameters.appUid);
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Column() {
|
||||
HeadComponent({ headName: $r('app.string.certificateAliasTab') });
|
||||
Text($r('app.string.certificateAliasInfo'))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
top: $r('app.float.distance_24'),
|
||||
left: $r('app.float.distance_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
TextInput()
|
||||
.type(InputType.Normal)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.enterKeyType(EnterKeyType.Done)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.onChange((value: string) => {
|
||||
this.certAlias = value;
|
||||
})
|
||||
.maxLength(ConfigData.ALIAS_MAX_LENGTH)
|
||||
.margin({
|
||||
left: $r('app.float.distance_24'),
|
||||
right: $r('app.float.distance_24')
|
||||
})
|
||||
.height($r('app.float.distance_48'))
|
||||
|
||||
Row() {
|
||||
Divider().color($r('app.color.CertManager_Divider_Color_182431'))
|
||||
}
|
||||
.margin({
|
||||
left: $r('app.float.distance_24'),
|
||||
right: $r('app.float.distance_24'),
|
||||
})
|
||||
|
||||
Text($r('app.string.installAliasInputInfo'))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.margin({
|
||||
left: $r('app.float.distance_24'),
|
||||
top: $r('app.float.distance_16')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
.opacity($r('app.float.opacity_100_60'))
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_75_100);
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Button() {
|
||||
Text($r('app.string.installAliasInputCancel'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_hyperlink'))
|
||||
}
|
||||
.type(ButtonType.Capsule)
|
||||
.backgroundColor($r('app.color.install_cancel_bt_bg_color'))
|
||||
.width($r('app.float.component_button_width_phone'))
|
||||
.height($r('app.float.application_button_height'))
|
||||
.margin({
|
||||
left: $r('app.float.distance_24'),
|
||||
})
|
||||
.onClick(() => {
|
||||
router.back();
|
||||
})
|
||||
|
||||
if ((this.certAlias.length > 0) && (this.certAlias[0] != ' ')) {
|
||||
Button() {
|
||||
Text($r('app.string.installAliasInputConfirm'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('app.color.install_confirm_bt_font_color'))
|
||||
}
|
||||
.type(ButtonType.Capsule)
|
||||
.backgroundColor($r('app.color.install_confirm_bt_bg_color'))
|
||||
.width($r('app.float.component_button_width_phone'))
|
||||
.height($r('app.float.application_button_height'))
|
||||
.margin({
|
||||
left: $r('app.float.distance_16'),
|
||||
right: $r('app.float.distance_24'),
|
||||
})
|
||||
.onClick(() => {
|
||||
this.mAppCredAuthPresenter.installCert(router.getParams().uri,
|
||||
this.certAlias,
|
||||
router.getParams().suffix);
|
||||
})
|
||||
} else {
|
||||
Button() {
|
||||
Text($r('app.string.installAliasInputConfirm'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('app.color.install_confirm_bt_font_color'))
|
||||
}
|
||||
.type(ButtonType.Capsule)
|
||||
.backgroundColor($r('app.color.install_confirm_bt_bg_disable_color'))
|
||||
.width($r('app.float.component_button_width_phone'))
|
||||
.height($r('app.float.application_button_height'))
|
||||
.margin({
|
||||
left: $r('app.float.distance_16'),
|
||||
right: $r('app.float.distance_24'),
|
||||
})
|
||||
}
|
||||
}
|
||||
.margin({ bottom: $r('app.float.wh_value_24') })
|
||||
}
|
||||
.justifyContent(FlexAlign.End)
|
||||
.height(ConfigData.WH_25_100);
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100);
|
||||
}
|
||||
}
|
@ -0,0 +1,277 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import ConfigData from '../../../../../../common/util/ConfigData';
|
||||
import HeadComponent from '../../../../../../common/component/headComponent';
|
||||
import { SubEntryComponent } from '../../../../../../common/component/subEntryComponent';
|
||||
import CMFaPresenter from '../presenter/CMFaPresenter';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct CertificateComponent {
|
||||
@State touchedItem: boolean = false;
|
||||
@State columnMargin: string = '12vp';
|
||||
@State mFaPresenter: CMFaPresenter = CMFaPresenter.getInstance();
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
|
||||
GridContainer({
|
||||
columns: 12,
|
||||
sizeType: SizeType.Auto,
|
||||
gutter: vp2px(1) === 2 ? '12vp' : '0vp',
|
||||
margin: vp2px(1) === 2 ? '24vp' : '0vp'
|
||||
}) {
|
||||
Row({}) {
|
||||
Column() {
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100)
|
||||
.useSizeType({
|
||||
xs: { span: 0, offset: 0 }, sm: { span: 0, offset: 0 },
|
||||
md: { span: 0, offset: 0 }, lg: { span: 2, offset: 0 }
|
||||
});
|
||||
|
||||
Column() {
|
||||
HeadComponent({ headName: $r('app.string.certificateTab') })
|
||||
Column({ space: this.columnMargin }) {
|
||||
|
||||
SubEntryComponent({ targetPage: "pages/trustedCa", title: $r("app.string.trustedEvidence") })
|
||||
|
||||
SubEntryComponent({ targetPage: 'pages/cerEvidenceFa', title: $r("app.string.userEvidence") })
|
||||
|
||||
CertInstallComponent({ mFaPresenter: $mFaPresenter })
|
||||
|
||||
DeleteAll({ mFaPresenter: $mFaPresenter })
|
||||
}
|
||||
.margin({ top: $r("app.float.distance_8") })
|
||||
.width(ConfigData.WH_100_100)
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.padding({ left: $r('app.float.wh_24'), right: $r('app.float.wh_24') })
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100)
|
||||
.useSizeType({
|
||||
xs: { span: 12, offset: 0 }, sm: { span: 12, offset: 0 },
|
||||
md: { span: 12, offset: 0 }, lg: { span: 8, offset: 2 }
|
||||
});
|
||||
|
||||
Column() {
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100)
|
||||
.useSizeType({
|
||||
xs: { span: 0, offset: 12 }, sm: { span: 0, offset: 12 },
|
||||
md: { span: 0, offset: 12 }, lg: { span: 2, offset: 10 }
|
||||
})
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100);
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100);
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100);
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
let uri = globalThis.abilityWant.uri;
|
||||
globalThis.abilityWant.uri = "";
|
||||
|
||||
if (uri === "certInstall") {
|
||||
this.mFaPresenter.startInstall();
|
||||
} else if (uri === "requestAuthorize") {
|
||||
this.mFaPresenter.startRequestAuth(globalThis.abilityWant.parameters.appUid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
@Component
|
||||
struct CustomDialogExampleDeleteAll {
|
||||
controller: CustomDialogController;
|
||||
@Link deleteAll: CMFaPresenter;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.deleteAllCredDialogTitle"))
|
||||
.height($r("app.float.wh_value_56"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_dialog_tittle"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
Text($r("app.string.deleteAllCredDialogMessage"))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_16"),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
|
||||
Button($r("app.string.deleteAllCredCancel"))
|
||||
.onClick(() => {
|
||||
this.controller.close()
|
||||
})
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_hyperlink"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
Divider()
|
||||
.strokeWidth(ConfigData.VERTICAL_DIVIDER_WIDTH)
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.vertical(true)
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
Button($r("app.string.deleteAllCredDelete"))
|
||||
.onClick(() => {
|
||||
this.deleteAll.uninstallAllCert();
|
||||
this.controller.close()
|
||||
})
|
||||
.backgroundColor($r("app.color.credentials_app_finish_backgroundColor"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_warning"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
}
|
||||
.height($r('app.float.wh_value_64'))
|
||||
.padding({
|
||||
bottom: $r('app.float.wh_value_16')
|
||||
})
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_16'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct DeleteAll {
|
||||
@State isTouched: boolean = false;
|
||||
@Link mFaPresenter: CMFaPresenter;
|
||||
|
||||
deleteWarnDialog: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomDialogExampleDeleteAll({ deleteAll: $mFaPresenter }),
|
||||
autoCancel: true,
|
||||
alignment:DialogAlignment.Bottom,
|
||||
offset :{ dx:0, dy:ConfigData.DIALOG_DY_OFFSET }
|
||||
})
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Text($r("app.string.deleteAllCred"))
|
||||
.fontSize($r('app.float.font_16'))
|
||||
.lineHeight($r('app.float.wh_value_22'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('app.color.cm_del_all_font_color'))
|
||||
.margin({ left: $r('app.float.distance_8') })
|
||||
.textAlign(TextAlign.Start);
|
||||
}
|
||||
.padding($r('app.float.distance_4'))
|
||||
.height($r('app.float.wh_value_56'))
|
||||
.width(ConfigData.WH_100_100)
|
||||
.borderRadius($r('app.float.radius_24'))
|
||||
.linearGradient(this.isTouched ? {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("app.color.DCEAF9"), 0.0], [$r("app.color.FAFAFA"), 1.0]]
|
||||
} : {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_foreground_contrary"), 1],
|
||||
[$r("sys.color.ohos_id_color_foreground_contrary"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouched = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouched = false;
|
||||
}
|
||||
})
|
||||
.onClick(() => {
|
||||
this.deleteWarnDialog.open();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
export struct CertInstallComponent {
|
||||
@State isTouched: boolean = false;
|
||||
@Link mFaPresenter: CMFaPresenter;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
Text($r('app.string.installInStorageDevice'))
|
||||
.fontSize($r('app.float.font_16'))
|
||||
.lineHeight($r('app.float.wh_value_22'))
|
||||
.fontColor($r('app.color.font_color_182431'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: $r('app.float.distance_8') })
|
||||
.textAlign(TextAlign.Start);
|
||||
}
|
||||
|
||||
Image('/res/image/ic_settings_arrow.svg')
|
||||
.width($r('app.float.wh_value_12'))
|
||||
.height($r('app.float.wh_value_24'))
|
||||
.margin({ right: $r('app.float.distance_8') })
|
||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
}
|
||||
.height(ConfigData.WH_100_100)
|
||||
.width(ConfigData.WH_100_100)
|
||||
.borderRadius($r('app.float.radius_20'))
|
||||
.linearGradient(this.isTouched ? {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("app.color.DCEAF9"), 0.0], [$r("app.color.FAFAFA"), 1.0]]
|
||||
} : {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_foreground_contrary"), 1],
|
||||
[$r("sys.color.ohos_id_color_foreground_contrary"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouched = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouched = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
.padding($r('app.float.distance_4'))
|
||||
.backgroundColor($r('app.color.white_bg_color'))
|
||||
.height($r('app.float.wh_value_56'))
|
||||
.borderRadius($r('app.float.radius_24'))
|
||||
.onClick(() => {
|
||||
this.mFaPresenter.requestPermissions()
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import HeadComponent from '../../../../../../common/component/headComponent';
|
||||
import ConfigData from '../../../../../../common/util/ConfigData';
|
||||
import router from '@system.router';
|
||||
import CMFaPresenter from '../presenter/CMFaPresenter';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct CertPwdInput {
|
||||
certPwd: string = "";
|
||||
@State mFaPresenter: CMFaPresenter = CMFaPresenter.getInstance();
|
||||
|
||||
onPageShow() {
|
||||
let uri = globalThis.abilityWant.uri;
|
||||
globalThis.abilityWant.uri = "";
|
||||
|
||||
if (uri === "certInstall") {
|
||||
this.mFaPresenter.startInstall();
|
||||
} else if (uri === "requestAuthorize") {
|
||||
this.mFaPresenter.startRequestAuth(globalThis.abilityWant.parameters.appUid);
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Column() {
|
||||
HeadComponent({ headName: $r('app.string.certificatePwdTab') });
|
||||
Text($r('app.string.certificatePwdInfo'))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
top: $r('app.float.distance_24'),
|
||||
left: $r('app.float.distance_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start);
|
||||
|
||||
TextInput()
|
||||
.type(InputType.Password)
|
||||
.onChange((value: string) => {
|
||||
this.certPwd = value;
|
||||
})
|
||||
.maxLength(ConfigData.PWD_MAX_LENGTH)
|
||||
.margin({
|
||||
top: $r('app.float.distance_16'),
|
||||
left: $r('app.float.distance_24'),
|
||||
right: $r('app.float.distance_24')
|
||||
})
|
||||
.height('40vp')
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_75_100);
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Button() {
|
||||
Text($r('app.string.installPwdInputCancel'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_hyperlink'))
|
||||
}
|
||||
.type(ButtonType.Capsule)
|
||||
.backgroundColor($r('app.color.install_cancel_bt_bg_color'))
|
||||
.width($r('app.float.component_button_width_phone'))
|
||||
.height($r('app.float.application_button_height'))
|
||||
.margin({
|
||||
left: $r('app.float.distance_24'),
|
||||
})
|
||||
.onClick(() => {
|
||||
router.back();
|
||||
})
|
||||
|
||||
Button() {
|
||||
Text($r('app.string.installPwdInputConfirm'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('app.color.install_confirm_bt_font_color'))
|
||||
}
|
||||
.type(ButtonType.Capsule)
|
||||
.backgroundColor($r('app.color.install_confirm_bt_bg_color'))
|
||||
.width($r('app.float.component_button_width_phone'))
|
||||
.height($r('app.float.application_button_height'))
|
||||
.margin({
|
||||
left: $r('app.float.distance_16'),
|
||||
right: $r('app.float.distance_24'),
|
||||
})
|
||||
.onClick(() => {
|
||||
globalThis.PwdStore.setCertPwd(this.certPwd)
|
||||
router.push({
|
||||
uri: 'pages/certInstallAliasInput',
|
||||
params: {
|
||||
uri: router.getParams().uri,
|
||||
suffix: router.getParams().suffix
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
.margin({ bottom: $r('app.float.wh_value_24') })
|
||||
}
|
||||
.justifyContent(FlexAlign.End)
|
||||
.height(ConfigData.WH_25_100);
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100);
|
||||
}
|
||||
}
|
@ -0,0 +1,218 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import LogUtil from '../../../../../../common/util/LogUtil';
|
||||
import CMAppCredAuthPresenter from '../presenter/CMAppCredAuthPresenter';
|
||||
import router from '@system.router';
|
||||
import ConfigData from '../../../../../../common/util/ConfigData';
|
||||
|
||||
@CustomDialog
|
||||
@Component
|
||||
struct CustomDialogAuthForApp {
|
||||
controller: CustomDialogController
|
||||
@State mAppCredAuthPresenter: CMAppCredAuthPresenter = CMAppCredAuthPresenter.getInstance();
|
||||
selectUri: string = "";
|
||||
|
||||
aboutToAppear(): void {
|
||||
LogUtil.info('certPwdInput about to appear');
|
||||
this.mAppCredAuthPresenter.UpdateAppNameFromUid(router.getParams().appUid);
|
||||
this.mAppCredAuthPresenter.updateAppCredList();
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r('app.string.pickCredToAuth'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_dialog_tittle'))
|
||||
.height($r("app.float.wh_value_56"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Text($r('app.string.requestAuthMsg', this.mAppCredAuthPresenter.appName))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_8'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
if (this.mAppCredAuthPresenter.credList.length > ConfigData.REQUEST_AUTH_MAX_LENGTH) {
|
||||
List() {
|
||||
ForEach(this.mAppCredAuthPresenter.credList, (item) => {
|
||||
ListItem() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
|
||||
Column() {
|
||||
Text(item.alias)
|
||||
.fontSize($r('app.float.font_18'))
|
||||
.fontColor($r('app.color.request_auth_font_color'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.textAlign(TextAlign.Start);
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
|
||||
Column() {
|
||||
Radio({ value: item.alias, group: 'appCredGroup' })
|
||||
.checked(false)
|
||||
.onChange((value: boolean) => {
|
||||
console.log(item.alias + ' status is ' + value)
|
||||
if (value) {
|
||||
this.selectUri = item.keyUri;
|
||||
console.log('selectUri is ' + this.selectUri)
|
||||
}
|
||||
})
|
||||
}
|
||||
.alignItems(HorizontalAlign.End)
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
}
|
||||
.height($r('app.float.wh_value_64'))
|
||||
}, item => JSON.stringify(item))
|
||||
}
|
||||
.height(ConfigData.WH_50_100)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.divider({
|
||||
strokeWidth: $r("app.float.request_auth_strokeWidth"),
|
||||
color: $r("app.color.request_auth_color"),
|
||||
endMargin: $r("app.float.request_auth_divider_endMargin")})
|
||||
.borderRadius($r("app.float.request_auth_borderRadius"))
|
||||
.backgroundColor($r("app.color.request_auth_background_color"))
|
||||
.visibility(this.mAppCredAuthPresenter.credList.length > 0 ? Visibility.Visible : Visibility.None)
|
||||
} else {
|
||||
List() {
|
||||
ForEach(this.mAppCredAuthPresenter.credList, (item) => {
|
||||
ListItem() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text(item.alias)
|
||||
.fontSize($r('app.float.font_18'))
|
||||
.fontColor($r('app.color.request_auth_font_color'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.textAlign(TextAlign.Start);
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
|
||||
Column() {
|
||||
Radio({ value: item.alias, group: 'appCredGroup' })
|
||||
.checked(false)
|
||||
.onChange((value: boolean) => {
|
||||
console.log(item.alias + ' status is ' + value)
|
||||
if (value) {
|
||||
this.selectUri = item.keyUri;
|
||||
console.log('selectUri is ' + this.selectUri)
|
||||
}
|
||||
})
|
||||
}
|
||||
.alignItems(HorizontalAlign.End)
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
}
|
||||
.height($r('app.float.wh_value_64'))
|
||||
}, item => JSON.stringify(item))
|
||||
}
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.divider({
|
||||
strokeWidth: $r("app.float.request_auth_strokeWidth"),
|
||||
color: $r("app.color.request_auth_color"),
|
||||
endMargin: $r("app.float.request_auth_divider_endMargin") })
|
||||
.borderRadius($r("app.float.request_auth_borderRadius"))
|
||||
.backgroundColor($r("app.color.request_auth_background_color"))
|
||||
.visibility(this.mAppCredAuthPresenter.credList.length > 0 ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
|
||||
Button($r('app.string.requestAuthCancel'))
|
||||
.onClick(() => {
|
||||
this.mAppCredAuthPresenter.cancelProcess();
|
||||
this.controller.close();
|
||||
})
|
||||
.backgroundColor($r('app.color.request_auth_background_color'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_hyperlink'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_button1'))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
|
||||
Divider()
|
||||
.strokeWidth(ConfigData.VERTICAL_DIVIDER_WIDTH)
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.vertical(true)
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
|
||||
Button($r('app.string.requestAuthFinish'))
|
||||
.onClick(() => {
|
||||
LogUtil.info('requestAuthorize uri: ' + this.selectUri);
|
||||
if (router.getParams() && router.getParams().appUid) {
|
||||
LogUtil.info('requestAuthorize appUid: ' + router.getParams().appUid);
|
||||
this.mAppCredAuthPresenter.requestAuthorize(this.selectUri, router.getParams().appUid);
|
||||
this.controller.close();
|
||||
} else {
|
||||
LogUtil.info('requestAuthorize fail');
|
||||
}
|
||||
})
|
||||
.backgroundColor($r('app.color.request_auth_background_color'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_hyperlink'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_button1'))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
}
|
||||
.height($r('app.float.wh_value_64'))
|
||||
.padding({
|
||||
bottom: $r('app.float.wh_value_16')
|
||||
})
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct RadioAuth {
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomDialogAuthForApp(),
|
||||
autoCancel: false,
|
||||
alignment: DialogAlignment.Bottom,
|
||||
offset: { dx: 0, dy: ConfigData.DIALOG_DY_OFFSET }
|
||||
})
|
||||
|
||||
aboutToAppear() {
|
||||
LogUtil.info('RadioAuth aboutToAppear');
|
||||
|
||||
if (router.getParams() && router.getParams().appUid) {
|
||||
this.dialogController.open();
|
||||
} else {
|
||||
router.replace({ uri: "pages/certManagerFa" });
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
}
|
||||
}
|
@ -0,0 +1,930 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import LogUtil from '../../../../../../common/util/LogUtil';
|
||||
import ConfigData from '../../../../../../common/util/ConfigData';
|
||||
import HeadComponent from '../../../../../../common/component/headComponent';
|
||||
import CMShowSysCaPresenter from '../presenter/CMShowSysCaPresenter';
|
||||
import CMShowUserCaPresenter from '../presenter/CMShowUserCaPresenter';
|
||||
import CMFaPresenter from '../presenter/CMFaPresenter';
|
||||
|
||||
@Component
|
||||
struct DialogSubjectComponent {
|
||||
private map: Map<string, string>;
|
||||
private subjectNameCN: string = ''
|
||||
private subjectNameO: string = ''
|
||||
private subjectNameOU: string = ''
|
||||
private serial: string = ''
|
||||
aboutToAppear() {
|
||||
if (this.map != null) {
|
||||
this.subjectNameCN = this.map.get('常用名称:')
|
||||
this.subjectNameO = this.map.get('组织:')
|
||||
this.subjectNameOU = this.map.get('组织单位:')
|
||||
this.serial = this.map.get('序列号:')
|
||||
}
|
||||
}
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.DialogSubjectComponent_firText"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.DialogSubjectComponent_Text_margin_top_value")
|
||||
})
|
||||
Text(this.subjectNameCN)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
Text($r("app.string.DialogSubjectComponent_secText"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.CustomDialogExample_Button_margin_top_value")
|
||||
})
|
||||
Text(this.subjectNameO)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
Text($r("app.string.DialogSubjectComponent_thdText"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.CustomDialogExample_Button_margin_top_value")
|
||||
})
|
||||
Text(this.subjectNameOU)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
Text($r("app.string.DialogSubjectComponent_fouText"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_12")
|
||||
})
|
||||
Text(this.serial)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
}.alignItems(HorizontalAlign.Start);
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct DialogIssuerComponent {
|
||||
private map: Map<string, string>;
|
||||
private issuerNameCN: string = ''
|
||||
private issuerNameO: string = ''
|
||||
private issuerNameOU: string = ''
|
||||
aboutToAppear() {
|
||||
if (this.map != null) {
|
||||
this.issuerNameCN = this.map.get('常用名称:')
|
||||
this.issuerNameO = this.map.get('组织:')
|
||||
this.issuerNameOU = this.map.get('组织单位:')
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.DialogSubjectComponent_firText"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_10")
|
||||
})
|
||||
Text(this.issuerNameCN)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
Text($r("app.string.DialogSubjectComponent_secText"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.CustomDialogExample_Button_margin_top_value")
|
||||
})
|
||||
Text(this.issuerNameO)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
Text($r("app.string.DialogSubjectComponent_thdText"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.CustomDialogExample_Button_margin_top_value")
|
||||
})
|
||||
Text(this.issuerNameOU)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
}.alignItems(HorizontalAlign.Start);
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct DialogDateComponent {
|
||||
private map: Map<string, string>;
|
||||
private notBefore: string = ''
|
||||
private notAfter: string = ''
|
||||
aboutToAppear() {
|
||||
if (this.map != null) {
|
||||
this.notBefore = this.map.get('颁发时间:')
|
||||
this.notAfter = this.map.get('有效期至:')
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.DialogSubjectComponent_fifText"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_10")
|
||||
})
|
||||
Text(this.notBefore)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
Text($r("app.string.DialogSubjectComponent_sixText"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.CustomDialogExample_Button_margin_top_value")
|
||||
})
|
||||
Text(this.notAfter)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
}.alignItems(HorizontalAlign.Start);
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct DialogFingerPrintComponent {
|
||||
private fingerprintSha256: string;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.CustomDialogExample_FingerPrint_text"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_10")
|
||||
})
|
||||
Text(this.fingerprintSha256)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
right: $r("app.float.wh_value_24")
|
||||
})
|
||||
}.alignItems(HorizontalAlign.Start);
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
@Component
|
||||
struct CustomDialogDeleteWarning {
|
||||
controller: CustomDialogController;
|
||||
@Link deleteWarn: CMShowUserCaPresenter;
|
||||
@Link mShowUserListPresenter: CMShowUserCaPresenter;
|
||||
@Link isShowWarnDialog: boolean;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.CustomDialogExampleUser_warning_Button_title_text"))
|
||||
.height($r("app.float.wh_value_56"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_dialog_tittle"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
Text($r("app.string.CustomDialogExampleUser_warning_Button_message_text"))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor($r("sys.color.ohos_id_color_primary"))
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_16"),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
|
||||
Button($r("app.string.deleteAllCredCancel"))
|
||||
.onClick(() => {
|
||||
this.isShowWarnDialog = false;
|
||||
this.controller.close()
|
||||
})
|
||||
.backgroundColor($r("app.color.CustomDialogExample_Button_backgroundColor_FFFFFF"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_hyperlink"))
|
||||
Divider()
|
||||
.strokeWidth(1)
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.vertical(true)
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
Button($r("app.string.deleteAllCredDelete"))
|
||||
.onClick(() => {
|
||||
this.deleteWarn.deleteUserCertificate(this.deleteWarn.certInfo.uri);
|
||||
this.mShowUserListPresenter.updateUserTrustedCertificateList();
|
||||
this.isShowWarnDialog = false;
|
||||
this.controller.close()
|
||||
})
|
||||
.backgroundColor($r("app.color.CustomDialogExample_Button_backgroundColor_FFFFFF"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.fontColor($r("sys.color.ohos_id_color_warning"))
|
||||
}
|
||||
.height($r('app.float.wh_value_64'))
|
||||
.padding({
|
||||
bottom: $r('app.float.wh_value_16')
|
||||
})
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_16'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
@Component
|
||||
struct CustomDialogExampleUser {
|
||||
controller: CustomDialogController;
|
||||
@Link userInfoPresenter: CMShowUserCaPresenter;
|
||||
@Link userInfoPresenterForAbstractList: CMShowUserCaPresenter;
|
||||
@Link isShowWarnDialog: boolean;
|
||||
@State IsOn: boolean = false;
|
||||
|
||||
aboutToAppear() {
|
||||
this.IsOn = this.userInfoPresenter.certInfo.status;
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.CustomDialogExample_firText"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_dialog_tittle"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r("app.float.CustomDialogExample_firText_margin_left_value"),
|
||||
top: $r("app.float.CustomDialogExample_firText_margin_top_value")
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text(this.userInfoPresenter.certInfo.certAlias)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r("app.float.wh_value_26")
|
||||
})
|
||||
if (this.IsOn) {
|
||||
Text($r("app.string.CustomDialogExampleUser_Status_true"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_secondary"))
|
||||
.margin({
|
||||
left: $r("app.float.wh_value_26")
|
||||
})
|
||||
} else {
|
||||
Text($r("app.string.CustomDialogExampleUser_Status_false"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_secondary"))
|
||||
.margin({
|
||||
left: $r("app.float.wh_value_26")
|
||||
})
|
||||
}
|
||||
}.alignItems(HorizontalAlign.Start);
|
||||
Toggle({ type: ToggleType.Switch, isOn: this.IsOn })
|
||||
.margin({
|
||||
right: $r("app.float.CustomDialogExampleUser_Flex_Toggle_margin_right_value")
|
||||
})
|
||||
.width($r("app.float.CustomDialogExampleUser_Flex_Toggle_width_value"))
|
||||
.height($r("app.float.CustomDialogExampleUser_Flex_Toggle_height_value"))
|
||||
.selectedColor($r("app.color.CustomDialogExampleUser_Flex_Toggle_selectedColor_007DFF"))
|
||||
.onChange((isOn: boolean) => {
|
||||
if (isOn) {
|
||||
this.IsOn = true;
|
||||
this.userInfoPresenter.setUserCertificateStatus(this.userInfoPresenter.certInfo.uri, true);
|
||||
} else {
|
||||
this.IsOn = false;
|
||||
this.userInfoPresenter.setUserCertificateStatus(this.userInfoPresenter.certInfo.uri, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
.height($r("app.float.CustomDialogExampleUser_Flex_height_value"))
|
||||
.margin({});
|
||||
List() {
|
||||
ListItem() {
|
||||
Text($r("app.string.CustomDialogExample_firListItem_text"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_12")
|
||||
})
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
DialogSubjectComponent({ map: this.userInfoPresenter.certInfo.subjectNameMap });
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
Text($r("app.string.CustomDialogExample_secListItem_text"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_12")
|
||||
})
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
DialogIssuerComponent({ map: this.userInfoPresenter.certInfo.issuerNameMap });
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
Text($r("app.string.CustomDialogExample_thdListItem_text"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_12")
|
||||
})
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
DialogDateComponent({ map: this.userInfoPresenter.certInfo.dateMap });
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
Text($r("app.string.CustomDialogExample_fouListItem_text"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_12")
|
||||
})
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
DialogFingerPrintComponent({ fingerprintSha256: this.userInfoPresenter.certInfo.fingerprintSha256 });
|
||||
}.width('100%').align(Alignment.Start)
|
||||
}
|
||||
.height($r("app.float.CustomDialogExample_list_height_value"))
|
||||
.margin({
|
||||
bottom: $r("app.float.CustomDialogExample_secListItem_Text_margin_left_value"),
|
||||
left: $r("app.float.wh_value_24"),
|
||||
right: $r("app.float.wh_value_24")
|
||||
})
|
||||
.borderRadius($r("app.float.CustomDialogExample_list_borderRadius_value"))
|
||||
.scrollBar(BarState.Auto);
|
||||
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
|
||||
Button($r("app.string.CustomDialogExampleUser_Flex_firButton_text"))
|
||||
.onClick(() => {
|
||||
this.userInfoPresenterForAbstractList.updateUserTrustedCertificateList();
|
||||
this.isShowWarnDialog = false;
|
||||
this.controller.close();
|
||||
})
|
||||
.backgroundColor($r("app.color.CustomDialogExample_Button_backgroundColor_FFFFFF"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_hyperlink"))
|
||||
Divider()
|
||||
.strokeWidth(ConfigData.VERTICAL_DIVIDER_WIDTH)
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.vertical(true)
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
Button($r("app.string.CustomDialogExampleUser_Flex_secButton_text"))
|
||||
.onClick(() => {
|
||||
this.isShowWarnDialog = true;
|
||||
this.controller.close();
|
||||
})
|
||||
.backgroundColor($r("app.color.CustomDialogExample_Button_backgroundColor_FFFFFF"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.fontColor($r("sys.color.ohos_id_color_warning"))
|
||||
}
|
||||
.height($r('app.float.wh_value_64'))
|
||||
.padding({
|
||||
bottom: $r('app.float.wh_value_16')
|
||||
})
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_16'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
@Component
|
||||
struct CustomDialogExampleSystem {
|
||||
controller: CustomDialogController;
|
||||
@Link sysInfoPresenter: CMShowSysCaPresenter;
|
||||
private isTrueButton: string = '';
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r("app.string.CustomDialogExample_firText"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_dialog_tittle"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
left: $r("app.float.CustomDialogExample_firText_margin_left_value"),
|
||||
top: $r("app.float.CustomDialogExample_firText_margin_top_value")
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
Text(this.sysInfoPresenter.certInfo.certAlias)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_16"),
|
||||
left: $r("app.float.CustomDialogExample_secText_margin_left_value")
|
||||
})
|
||||
.alignSelf(ItemAlign.Start)
|
||||
List() {
|
||||
ListItem() {
|
||||
Text($r("app.string.CustomDialogExample_firListItem_text"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
DialogSubjectComponent({ map: this.sysInfoPresenter.certInfo.subjectNameMap });
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
Text($r("app.string.CustomDialogExample_secListItem_text"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_12")
|
||||
})
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
DialogIssuerComponent({ map: this.sysInfoPresenter.certInfo.issuerNameMap });
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
Text($r("app.string.CustomDialogExample_thdListItem_text"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_12")
|
||||
})
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
DialogDateComponent({ map: this.sysInfoPresenter.certInfo.dateMap });
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
Text($r("app.string.CustomDialogExample_fouListItem_text"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({
|
||||
top: $r("app.float.wh_value_12")
|
||||
})
|
||||
}.width('100%').align(Alignment.Start)
|
||||
|
||||
ListItem() {
|
||||
DialogFingerPrintComponent({ fingerprintSha256: this.sysInfoPresenter.certInfo.fingerprintSha256 });
|
||||
}.width('100%').align(Alignment.Start)
|
||||
}
|
||||
.height($r("app.float.CustomDialogExample_list_height_value"))
|
||||
.margin({
|
||||
left: $r("app.float.wh_value_24"),
|
||||
top: $r("app.float.CustomDialogExample_list_margin_top_value"),
|
||||
bottom: $r("app.float.CustomDialogExample_secListItem_Text_margin_left_value"),
|
||||
right: $r("app.float.wh_value_24")
|
||||
})
|
||||
.borderRadius($r("app.float.CustomDialogExample_list_borderRadius_value"))
|
||||
.backgroundColor($r("app.color.CustomDialogExample_list_backgroundColor_FFFFFF"))
|
||||
.scrollBar(BarState.Auto);
|
||||
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
|
||||
Button($r("app.string.CustomDialogExample_Button_text"))
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
})
|
||||
.backgroundColor($r("app.color.CustomDialogExample_Button_backgroundColor_FFFFFF"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_hyperlink"))
|
||||
Divider()
|
||||
.strokeWidth(ConfigData.VERTICAL_DIVIDER_WIDTH)
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.vertical(true)
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.opacity($r("app.float.opacity_0_2"))
|
||||
if (this.sysInfoPresenter.certInfo.status) {
|
||||
Button($r("app.string.CustomDialogExample_Button_off"))
|
||||
.onClick(() => {
|
||||
this.sysInfoPresenter.setSystemCertificateStatus(this.sysInfoPresenter.certInfo.uri, false);
|
||||
this.controller.close();
|
||||
})
|
||||
.backgroundColor($r("app.color.CustomDialogExample_Button_backgroundColor_FFFFFF"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_hyperlink"))
|
||||
} else {
|
||||
Button($r("app.string.CustomDialogExample_Button_on"))
|
||||
.onClick(() => {
|
||||
this.sysInfoPresenter.setSystemCertificateStatus(this.sysInfoPresenter.certInfo.uri, true);
|
||||
this.controller.close();
|
||||
})
|
||||
.backgroundColor($r("app.color.CustomDialogExample_Button_backgroundColor_FFFFFF"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_button1"))
|
||||
.width($r('app.float.wh_value_152'))
|
||||
.height($r('app.float.wh_value_40'))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_hyperlink"))
|
||||
}
|
||||
}
|
||||
.height($r('app.float.wh_value_64'))
|
||||
.padding({
|
||||
bottom: $r('app.float.wh_value_16')
|
||||
})
|
||||
.margin({
|
||||
top: $r('app.float.wh_value_16'),
|
||||
left: $r('app.float.wh_value_24'),
|
||||
right: $r('app.float.wh_value_24')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct ComponentSystem {
|
||||
private certAlias: string;
|
||||
private subjectName: string;
|
||||
private Status: boolean;
|
||||
private Index : number;
|
||||
private Uri: string;
|
||||
isSwitchTouched : boolean = false;
|
||||
@State isTouched: boolean = false;
|
||||
@Link setStatus: CMShowSysCaPresenter;
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomDialogExampleSystem({ sysInfoPresenter: $setStatus }),
|
||||
autoCancel: true,
|
||||
alignment: DialogAlignment.Bottom,
|
||||
offset: { dx: 0, dy: ConfigData.DIALOG_DY_OFFSET }
|
||||
})
|
||||
|
||||
build() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text(this.certAlias)
|
||||
.height($r("app.float.ComponentSystem_firText_height_value"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({top: $r("app.float.wh_value_10") });
|
||||
Text(this.subjectName)
|
||||
.height($r("app.float.ComponentSystem_secText_height_value"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_secondary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({ top: $r("app.float.wh_value_2"), bottom: $r("app.float.wh_value_11") });
|
||||
}.alignItems(HorizontalAlign.Start);
|
||||
Toggle({ type: ToggleType.Switch, isOn: this.setStatus.certList[this.Index].status })
|
||||
.width($r("app.float.ComponentSystem_Toggle_width_value"))
|
||||
.height($r("app.float.ComponentSystem_Toggle_height_value"))
|
||||
.selectedColor($r("app.color.ComponentSystem_Toggle_selectedColor_007DFF"))
|
||||
.onChange((isOn: boolean) => {
|
||||
if (isOn) {
|
||||
console.info('Component status:' + isOn);
|
||||
this.setStatus.setSystemCertificateStatus(this.Uri, true);
|
||||
} else {
|
||||
console.info('Component status:' + isOn);
|
||||
this.setStatus.setSystemCertificateStatus(this.Uri, false);
|
||||
}
|
||||
})
|
||||
.offset({ x: ConfigData.SWITCH_BUTTON_X_OFFSET, y: 0 })
|
||||
}
|
||||
.height($r("app.float.ComponentSystem_Flex_height_value"))
|
||||
.borderRadius($r("app.float.ComponentSystem_Flex_borderRadius_value"))
|
||||
.onClick(() => {
|
||||
this.setStatus.getSystemTrustedCertificate(this.Uri);
|
||||
console.info('this.setStatus.certInfo.status is:' + JSON.stringify(this.setStatus.certInfo));
|
||||
this.dialogController.open();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct ComponentUser {
|
||||
private certAlias: string;
|
||||
private subjectName: string;
|
||||
private Index : number = -1;
|
||||
private Uri: string;
|
||||
@State StatusText : Resource = $r("app.string.CustomDialogExampleUser_Status_false");
|
||||
@State isTouched: boolean = false;
|
||||
@Link setStatus: CMShowUserCaPresenter;
|
||||
@State mUserCaPresenterDetail: CMShowUserCaPresenter = CMShowUserCaPresenter.getInstance();
|
||||
@State @Watch("onShowDeleteWarnDialog") isShowWarning: boolean = false;
|
||||
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomDialogExampleUser({ isShowWarnDialog: $isShowWarning,userInfoPresenter: $mUserCaPresenterDetail,
|
||||
userInfoPresenterForAbstractList: $setStatus }),
|
||||
autoCancel: true,
|
||||
cancel: () => {
|
||||
this.setStatus.updateUserTrustedCertificateList();
|
||||
},
|
||||
alignment: DialogAlignment.Bottom,
|
||||
offset: { dx: 0, dy: ConfigData.DIALOG_DY_OFFSET }
|
||||
})
|
||||
|
||||
deleteWarnDialog: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomDialogDeleteWarning({
|
||||
isShowWarnDialog: $isShowWarning,
|
||||
deleteWarn: $mUserCaPresenterDetail,
|
||||
mShowUserListPresenter: $setStatus }),
|
||||
autoCancel: false,
|
||||
alignment:DialogAlignment.Bottom,
|
||||
offset: { dx: 0, dy: ConfigData.DIALOG_DY_OFFSET }
|
||||
})
|
||||
|
||||
onShowDeleteWarnDialog() {
|
||||
if (this.isShowWarning == true) {
|
||||
this.deleteWarnDialog.open();
|
||||
} else {
|
||||
this.dialogController.close();
|
||||
this.deleteWarnDialog.close();
|
||||
}
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
LogUtil.info('in ComponentUser aboutToAppear');
|
||||
if (this.setStatus.certList[this.Index].status == true) {
|
||||
this.StatusText = $r("app.string.CustomDialogExampleUser_Status_true");
|
||||
} else {
|
||||
this.StatusText = $r("app.string.CustomDialogExampleUser_Status_false");
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text(this.certAlias)
|
||||
.height($r("app.float.componentUser_firText_height_value"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({ top: $r("app.float.wh_value_10") });
|
||||
Text(this.subjectName)
|
||||
.height($r("app.float.componentUser_secText_height_value"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({ top: $r("app.float.wh_value_2"), bottom: $r("app.float.wh_value_11") });
|
||||
}.alignItems(HorizontalAlign.Start);
|
||||
Row() {
|
||||
Text(this.StatusText)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body2"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_secondary"))
|
||||
.textAlign(TextAlign.End)
|
||||
.margin({
|
||||
right: $r("app.float.componentUser_thdText_margin_value")
|
||||
})
|
||||
Image($r('app.media.ic_settings_arrow'))
|
||||
.width($r("app.float.componentUser_image_width_value"))
|
||||
.height($r("app.float.componentUser_image_height_value"))
|
||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
||||
.opacity($r("app.float.componentUser_image_opacity_value"));
|
||||
}
|
||||
}
|
||||
.height($r("app.float.componentUser_flex_height_value"))
|
||||
.borderRadius($r("app.float.componentUser_flex_borderRadius_value"))
|
||||
.onClick(() => {
|
||||
this.mUserCaPresenterDetail.getUserTrustedCertificate(this.Uri);
|
||||
console.info('userCerInfo is:' + JSON.stringify(this.setStatus.certInfo));
|
||||
this.dialogController.open();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct TrustedEvidence {
|
||||
@State mShowSysCaPresenter: CMShowSysCaPresenter = CMShowSysCaPresenter.getInstance();
|
||||
@State mShowUserCaPresenter: CMShowUserCaPresenter = CMShowUserCaPresenter.getInstance();
|
||||
@State mFaPresenter: CMFaPresenter = CMFaPresenter.getInstance();
|
||||
@State isTouched: boolean = false;
|
||||
@State currentIndex: number = 0
|
||||
@State fontColor: Resource = $r("app.color.TrustedEvidence_TabBuilder_fontColor_182431")
|
||||
@State selectedFontColor: Resource = $r("app.color.font_color_007DFF")
|
||||
private controller: TabsController = new TabsController();
|
||||
|
||||
@Builder TabBuilder(index: number) {
|
||||
Column() {
|
||||
Text(index == 0 ? $r('app.string.system') : $r('app.string.user'))
|
||||
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
|
||||
.fontSize($r('app.float.TrustedEvidence_TabBuilder_Text_fontSize_value'))
|
||||
.fontWeight(this.currentIndex === index ? FontWeight.Medium : FontWeight.Regular)
|
||||
.alignSelf(ItemAlign.Center)
|
||||
.margin({
|
||||
top: $r('app.float.TrustedEvidence_TabBuilder_Text_padding_top_value')
|
||||
})
|
||||
if (this.currentIndex === index) {
|
||||
Divider()
|
||||
.width($r('app.float.TrustedEvidence_TabBuilder_Divider_width_value'))
|
||||
.margin({ top: $r('app.float.TrustedEvidence_TabBuilder_Divider_padding_top_value') })
|
||||
.strokeWidth(2)
|
||||
.color(this.selectedFontColor)
|
||||
.alignSelf(ItemAlign.Center)
|
||||
}
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
LogUtil.info('in aboutToAppear');
|
||||
this.mShowSysCaPresenter.updateSystemTrustedCertificateList();
|
||||
this.mShowUserCaPresenter.updateUserTrustedCertificateList();
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
let uri = globalThis.abilityWant.uri;
|
||||
globalThis.abilityWant.uri = "";
|
||||
|
||||
if (uri === "certInstall") {
|
||||
this.mFaPresenter.startInstall();
|
||||
} else if (uri === "requestAuthorize") {
|
||||
this.mFaPresenter.startRequestAuth(globalThis.abilityWant.parameters.appUid);
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
GridContainer({columns:12, sizeType: SizeType.Auto, gutter: vp2px(1) === 2 ? '12vp' : '0vp',
|
||||
margin: vp2px(1) === 2 ? '24vp' : '0vp'}) {
|
||||
Row() {
|
||||
Column() {
|
||||
HeadComponent({ headName: $r('app.string.trustedEvidence') })
|
||||
Column() {
|
||||
Tabs({ barPosition: BarPosition.Start, index: 0, controller: this.controller }) {
|
||||
TabContent() {
|
||||
List() {
|
||||
ForEach(this.mShowSysCaPresenter.certList, (item, index) => {
|
||||
ListItem() {
|
||||
ComponentSystem({ certAlias: item.certAlias, subjectName: item.SubjectNameCN, Status: item.status,
|
||||
Uri: item.uri, setStatus: $mShowSysCaPresenter, Index: index })
|
||||
}
|
||||
}, item => JSON.stringify(item))
|
||||
}
|
||||
.margin({
|
||||
left: $r("app.float.wh_value_12"),
|
||||
right: $r("app.float.wh_value_12")
|
||||
})
|
||||
.padding({
|
||||
left: $r("app.float.wh_value_12"),
|
||||
top: $r("app.float.wh_value_4"),
|
||||
bottom: $r("app.float.wh_value_4")
|
||||
})
|
||||
.divider({
|
||||
strokeWidth: $r("app.float.sys_list_divider_strokeWidth_value"),
|
||||
color: $r("app.color.sys_list_divider_color_000000"),
|
||||
endMargin: '12vp'
|
||||
})
|
||||
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
|
||||
.backgroundColor($r("app.color.sys_list_backgroundColor_FFFFFF"))
|
||||
.visibility(this.mShowSysCaPresenter.certList.length > 0 ? Visibility.Visible : Visibility.None);
|
||||
}
|
||||
.tabBar(this.TabBuilder(0))
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouched = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouched = false;
|
||||
}
|
||||
});
|
||||
|
||||
TabContent() {
|
||||
List() {
|
||||
ForEach(this.mShowUserCaPresenter.certList, (item, index) => {
|
||||
ListItem() {
|
||||
ComponentUser({ certAlias: item.certAlias, subjectName: item.SubjectNameCN, Uri: item.uri,
|
||||
setStatus: $mShowUserCaPresenter, Index: index })
|
||||
}
|
||||
}, item => JSON.stringify(item))
|
||||
}
|
||||
.margin({
|
||||
left: $r("app.float.wh_value_12"),
|
||||
right: $r("app.float.wh_value_12")
|
||||
})
|
||||
.padding({
|
||||
left: $r("app.float.wh_value_12"),
|
||||
right: $r("app.float.wh_value_8"),
|
||||
top: $r("app.float.wh_value_4"),
|
||||
bottom: $r("app.float.wh_value_4")
|
||||
})
|
||||
.divider({
|
||||
strokeWidth: $r("app.float.user_list_divider_strokeWidth_value"),
|
||||
color: $r("app.color.user_list_divider_color_000000"),
|
||||
endMargin: '3vp'
|
||||
})
|
||||
.borderRadius($r("app.float.user_list_divider_borderRadius_value"))
|
||||
.backgroundColor($r("app.color.user_list_backgroundColor_FFFFFF"))
|
||||
.visibility(this.mShowUserCaPresenter.certList.length > 0 ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
.tabBar(this.TabBuilder(1))
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouched = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouched = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
.vertical(false)
|
||||
.scrollable(true)
|
||||
.barMode(BarMode.Fixed)
|
||||
.barWidth($r("app.float.tabs_barWidth_value"))
|
||||
.barHeight($r("app.float.tabs_barHeight_value"))
|
||||
.animationDuration(400)
|
||||
.width(ConfigData.WH_100_100)
|
||||
.backgroundColor($r("app.color.TrustedEvidence_tabs_backgroundColor_F1F3F5"))
|
||||
.onChange((index: number) => {
|
||||
this.currentIndex = index
|
||||
});
|
||||
}
|
||||
.height(ConfigData.WH_94_100)
|
||||
.width(ConfigData.WH_100_100);
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100)
|
||||
.useSizeType({
|
||||
xs: { span: 12, offset: 0 }, sm: { span: 12, offset: 0 },
|
||||
md: { span: 12, offset: 0 }, lg: { span: 8, offset: 2 }
|
||||
});
|
||||
|
||||
Column() {
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100)
|
||||
.useSizeType({
|
||||
xs: { span: 0, offset: 12 }, sm: { span: 0, offset: 12 },
|
||||
md: { span: 0, offset: 12 }, lg: { span: 2, offset: 10 }
|
||||
});
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100);
|
||||
}
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100);
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.width(ConfigData.WH_100_100)
|
||||
.height(ConfigData.WH_100_100);
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import certManagerModel from '../model/CertMangerModel';
|
||||
import BundleModel from '../model/BundleModel';
|
||||
import { CMModelErrorCode, CMModelOptType } from '../model/CertMangerModel';
|
||||
import { CredentialAbstractVo } from '../model/CertManagerVo/CredentialAbstractVo';
|
||||
import router from '@system.router';
|
||||
|
||||
const TAG = "CMAppCredAuthPresenter Presenter: ";
|
||||
const SUCCESS = 0;
|
||||
const FAIL = -1;
|
||||
|
||||
export default class CMAppCredAuthPresenter {
|
||||
private static sInstance: CMAppCredAuthPresenter;
|
||||
optType: CMModelOptType = CMModelOptType.CM_MODEL_OPT_UNKNOWN;
|
||||
credList: CredentialAbstractVo[] = [];
|
||||
appName: string = '';
|
||||
|
||||
public static getInstance(): CMAppCredAuthPresenter {
|
||||
if (CMAppCredAuthPresenter.sInstance == null) {
|
||||
CMAppCredAuthPresenter.sInstance = new CMAppCredAuthPresenter();
|
||||
}
|
||||
return CMAppCredAuthPresenter.sInstance;
|
||||
}
|
||||
|
||||
onAboutToAppear() {
|
||||
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
this.optType = CMModelOptType.CM_MODEL_OPT_UNKNOWN;
|
||||
this.credList = [];
|
||||
}
|
||||
|
||||
UpdateAppNameFromUid(uid) {
|
||||
console.log("getAppNameFromUid start uid = " + uid);
|
||||
BundleModel.getAppInfoList(uid, (errCode, appInfo) => {
|
||||
console.log("getAppNameFromUid success, appInfo = " + appInfo);
|
||||
if (!errCode) {
|
||||
this.appName = appInfo.AppName;
|
||||
} else {
|
||||
console.log("getAppNameFromUid fail, uid = " + uid);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
updateAppCredList() {
|
||||
certManagerModel.getCertOrCredList(CMModelOptType.CM_MODEL_OPT_APP_CRED, (errCode, credList) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
this.credList = credList;
|
||||
console.log("updateSystemTrustedCertificateList inin :" + JSON.stringify(credList));
|
||||
} else {
|
||||
console.log("updateSystemTrustedCertificateList fail");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
requestAuthorize(uri, appUid) {
|
||||
console.log(TAG + "requestAuthorize start uri :" + uri + "appUid: " + appUid);
|
||||
let want = globalThis.abilityWant;
|
||||
|
||||
certManagerModel.setAppAuth(CMModelOptType.CM_MODEL_OPT_APP_CRED, uri, appUid,
|
||||
true, (errCode, data) => {
|
||||
router.clear();
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
console.log("requestAuthorize success data: " + data);
|
||||
want.parameters.authUri = data;
|
||||
globalThis.certManagerAbilityContext.terminateSelfWithResult({
|
||||
resultCode: SUCCESS,
|
||||
want: want
|
||||
});
|
||||
} else {
|
||||
console.log("requestAuthorize fail");
|
||||
globalThis.certManagerAbilityContext.terminateSelfWithResult({
|
||||
resultCode: FAIL,
|
||||
want: want
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cancelProcess() {
|
||||
console.log("cancelProcess start");
|
||||
router.clear();
|
||||
globalThis.certManagerAbilityContext.terminateSelfWithResult({
|
||||
resultCode: FAIL,
|
||||
want: globalThis.abilityWant
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import router from '@system.router';
|
||||
import certManagerModel from '../model/CertMangerModel'
|
||||
import FileIoModel from '../model/FileIoModel'
|
||||
import { CMModelErrorCode, CMModelOptType } from '../model/CertMangerModel'
|
||||
|
||||
const TAG = "CMFaPresenter: ";
|
||||
const PAGE_URI_PWD_INPUT = 'pages/certPwdInput';
|
||||
const PAGE_URI_ALIAS_INPUT = 'pages/certInstallAliasInput';
|
||||
|
||||
export default class CMFaPresenter {
|
||||
private static sInstance: CMFaPresenter;
|
||||
|
||||
public static getInstance(): CMFaPresenter {
|
||||
if (CMFaPresenter.sInstance == null) {
|
||||
CMFaPresenter.sInstance = new CMFaPresenter();
|
||||
}
|
||||
return CMFaPresenter.sInstance;
|
||||
}
|
||||
|
||||
onAboutToAppear() {
|
||||
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
}
|
||||
|
||||
routeToNext(fileUri: string) {
|
||||
console.info(TAG + 'routeToNext fileUri: ' + fileUri);
|
||||
FileIoModel.getMediaFileSuffix(fileUri, (suffix) => {
|
||||
if (suffix) {
|
||||
if ((suffix == "cer") || (suffix == "pem")) {
|
||||
router.push({
|
||||
uri: PAGE_URI_ALIAS_INPUT,
|
||||
params: {
|
||||
uri: fileUri,
|
||||
suffix: suffix
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
uri: PAGE_URI_PWD_INPUT,
|
||||
params: {
|
||||
uri: fileUri,
|
||||
suffix: suffix
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
requestPermissions() {
|
||||
let permissionList: Array<string> = [
|
||||
"ohos.permission.READ_MEDIA"
|
||||
]
|
||||
globalThis.certManagerAbilityContext.requestPermissionsFromUser(permissionList, (data) => {
|
||||
console.log("requestPermissions finish");
|
||||
this.startInstall();
|
||||
})
|
||||
}
|
||||
|
||||
startInstall() {
|
||||
globalThis.certManagerAbilityContext.startAbilityForResult(
|
||||
{
|
||||
bundleName: "com.ohos.filepicker",
|
||||
abilityName: "MainAbility",
|
||||
parameters: {
|
||||
'startMode': 'choose',
|
||||
}
|
||||
},
|
||||
{
|
||||
windowMode: 102
|
||||
}
|
||||
)
|
||||
.then((data) => {
|
||||
if (!data.resultCode) {
|
||||
this.routeToNext(data.want.parameters.result)
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(TAG + 'start filePicker err: ' + error);
|
||||
})
|
||||
}
|
||||
|
||||
startRequestAuth(uri) {
|
||||
router.replace({
|
||||
uri: "pages/requestAuth", params: {
|
||||
appUid: uri,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
uninstallAllCert() {
|
||||
certManagerModel.delAllCertOrCred(CMModelOptType.CM_MODEL_OPT_USER_CA, (errCode) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
console.log(TAG + 'uninstallAllCert CM_MODEL_OPT_USER_CA success');
|
||||
} else {
|
||||
console.log(TAG + 'uninstallAllCert CM_MODEL_OPT_USER_CA failed');
|
||||
}
|
||||
});
|
||||
|
||||
certManagerModel.delAllCertOrCred(CMModelOptType.CM_MODEL_OPT_APP_CRED, (errCode) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
console.log(TAG + 'uninstallAllCert CM_MODEL_OPT_APP_CRED success');
|
||||
} else {
|
||||
console.log(TAG + 'uninstallAllCert CM_MODEL_OPT_APP_CRED failed');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import certManagerModel from '../model/CertMangerModel'
|
||||
import FileIoModel from '../model/FileIoModel'
|
||||
import { CMModelErrorCode, CMModelOptType } from '../model/CertMangerModel'
|
||||
import router from '@system.router';
|
||||
|
||||
const TAG = "CMInstallPresenter: ";
|
||||
|
||||
export default class CMInstallPresenter {
|
||||
private static sInstance: CMInstallPresenter;
|
||||
optType: CMModelOptType = CMModelOptType.CM_MODEL_OPT_UNKNOWN;
|
||||
|
||||
public static getInstance(): CMInstallPresenter {
|
||||
if (CMInstallPresenter.sInstance == null) {
|
||||
CMInstallPresenter.sInstance = new CMInstallPresenter();
|
||||
}
|
||||
return CMInstallPresenter.sInstance;
|
||||
}
|
||||
|
||||
onAboutToAppear() {
|
||||
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
this.optType = CMModelOptType.CM_MODEL_OPT_UNKNOWN;
|
||||
}
|
||||
|
||||
updateCertFileType(suffix) {
|
||||
console.info(TAG + 'updateCertFileType suffix: ' + suffix)
|
||||
if ((suffix == "cer") || (suffix == "pem")) {
|
||||
this.optType = CMModelOptType.CM_MODEL_OPT_USER_CA;
|
||||
} else if ((suffix == "p12") || (suffix == "jks") || (suffix == "pfx")) {
|
||||
this.optType = CMModelOptType.CM_MODEL_OPT_APP_CRED;
|
||||
}
|
||||
}
|
||||
|
||||
getFileDataFromUri(uri, callback) {
|
||||
FileIoModel.getMediaFileData(uri, (data) => {
|
||||
callback(data)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
installCert(uri, alias, suffix) {
|
||||
this.updateCertFileType(suffix);
|
||||
this.getFileDataFromUri(uri, (data) => {
|
||||
certManagerModel.installCertOrCred(this.optType, alias, data, globalThis.PwdStore.getCertPwd(), (errCode) => {
|
||||
console.info(TAG + 'installCertOrCred result: ' + JSON.stringify(errCode))
|
||||
globalThis.PwdStore.clearCertPwd();
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
console.info(TAG + 'installCert success');
|
||||
} else {
|
||||
console.info(TAG + 'installCert failed');
|
||||
}
|
||||
router.replace({ uri: "pages/certManagerFa" });
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import certManagerModel from '../model/CertMangerModel'
|
||||
import bundleModel from '../model/BundleModel'
|
||||
import { CMModelErrorCode, CMModelOptType } from '../model/CertMangerModel'
|
||||
import { CredentialAbstractVo } from '../model/CertManagerVo/CredentialAbstractVo'
|
||||
import { CredentialVo } from '../model/CertManagerVo/CredentialVo'
|
||||
import { AppAuthorVo } from '../model/CertManagerVo/AppAuthorVo'
|
||||
|
||||
export default class CMShowAppCredPresenter {
|
||||
private static sInstance: CMShowAppCredPresenter;
|
||||
credList: CredentialAbstractVo[] = [];
|
||||
appInfoList: AppAuthorVo[] = [];
|
||||
credInfo: CredentialVo = new CredentialVo("", "", "", 0, 0, null);
|
||||
|
||||
public static getInstance(): CMShowAppCredPresenter {
|
||||
if (CMShowAppCredPresenter.sInstance == null) {
|
||||
CMShowAppCredPresenter.sInstance = new CMShowAppCredPresenter();
|
||||
}
|
||||
return CMShowAppCredPresenter.sInstance;
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
this.credList = [];
|
||||
this.credInfo = new CredentialVo("", "", "", 0, 0, null);
|
||||
this.appInfoList = []
|
||||
}
|
||||
|
||||
updateAppCredList() {
|
||||
certManagerModel.getCertOrCredList(CMModelOptType.CM_MODEL_OPT_APP_CRED, (errCode, credList) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
credList.sort((certAbs, certAbsOther) => {
|
||||
let certAlias = certAbs.alias
|
||||
let certAliasOther = certAbsOther.alias
|
||||
if (certAlias <= certAliasOther) {
|
||||
return -1
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
})
|
||||
this.credList = credList;
|
||||
} else {
|
||||
console.log("updateAppCredList error :" + JSON.stringify(errCode));
|
||||
this.credList = []
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getAppCred(uri) {
|
||||
certManagerModel.getCertOrCred(CMModelOptType.CM_MODEL_OPT_APP_CRED, uri, (errCode, credInfo) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
this.credInfo = credInfo
|
||||
} else {
|
||||
console.log("getAppCred error :" + JSON.stringify(errCode));
|
||||
this.credInfo.clearCredentialVo();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
deleteAppCred(uri) {
|
||||
certManagerModel.deleteCertOrCred(CMModelOptType.CM_MODEL_OPT_APP_CRED, uri, (errCode) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
this.updateAppCredList();
|
||||
} else {
|
||||
console.log("deleteAppCred error :" + JSON.stringify(errCode));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getAuthorizedAppList(uri) {
|
||||
this.appInfoList = []
|
||||
certManagerModel.getAuthAppList(CMModelOptType.CM_MODEL_OPT_APP_CRED, uri, (errCode, appUidList) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
for (let i = 0; i < appUidList.length; i++) {
|
||||
bundleModel.getAppInfoList(Number(appUidList[i]),(errCode,AppInfo) => {
|
||||
if (errCode == CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
this.appInfoList.push(new AppAuthorVo(AppInfo.AppImage,appUidList[i], String(AppInfo.AppName), true))
|
||||
console.log("appInfoList: " + JSON.stringify(this.appInfoList));
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log("getAuthorizedAppList error :" + JSON.stringify(errCode));
|
||||
this.appInfoList = [];
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
removeGrantedAppList(uri) {
|
||||
for (let i = 0; i < this.appInfoList.length; i++) {
|
||||
if (!this.appInfoList[i].status) {
|
||||
certManagerModel.setAppAuth(CMModelOptType.CM_MODEL_OPT_APP_CRED, uri, this.appInfoList[i].uid, false, (errCode) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
console.log("removeGrantedAppList succeed" + JSON.stringify(errCode));
|
||||
} else {
|
||||
console.log("removeGrantedAppList error :" + JSON.stringify(errCode));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import certManagerModel from '../model/CertMangerModel'
|
||||
import { CMModelErrorCode, CMModelOptType } from '../model/CertMangerModel'
|
||||
import { CredentialAbstractVo } from '../model/CertManagerVo/CredentialAbstractVo'
|
||||
import { CredentialVo } from '../model/CertManagerVo/CredentialVo'
|
||||
|
||||
export default class CMShowPrivateCredPresenter {
|
||||
private static sInstance: CMShowPrivateCredPresenter;
|
||||
credList: CredentialAbstractVo[] = [];
|
||||
credInfo: CredentialVo = new CredentialVo("", "", "", 0, 0, null);
|
||||
|
||||
public static getInstance(): CMShowPrivateCredPresenter {
|
||||
if (CMShowPrivateCredPresenter.sInstance == null) {
|
||||
CMShowPrivateCredPresenter.sInstance = new CMShowPrivateCredPresenter();
|
||||
}
|
||||
return CMShowPrivateCredPresenter.sInstance;
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
this.credList = [];
|
||||
this.credInfo = new CredentialVo("", "", "", 0, 0, null);
|
||||
}
|
||||
|
||||
updatePrivateCredList() {
|
||||
certManagerModel.getCertOrCredList(CMModelOptType.CM_MODEL_OPT_PRIVATE_CRED, (errCode, credList) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
credList.sort((certAbs, certAbsOther) => {
|
||||
let certAlias = certAbs.alias
|
||||
let certAliasOther = certAbsOther.alias
|
||||
if (certAlias <= certAliasOther) {
|
||||
return -1
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
})
|
||||
this.credList = credList;
|
||||
} else {
|
||||
console.log("updatePrivateCredList error :" + JSON.stringify(errCode));
|
||||
this.credList = [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getPrivateCred(uri) {
|
||||
certManagerModel.getCertOrCred(CMModelOptType.CM_MODEL_OPT_PRIVATE_CRED, uri, (errCode, credInfo) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
this.credInfo = credInfo
|
||||
} else {
|
||||
console.log("getPrivateCred error :" + JSON.stringify(errCode));
|
||||
this.credInfo.clearCredentialVo();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import certManagerModel from '../model/CertMangerModel'
|
||||
import { CMModelErrorCode, CMModelOptType } from '../model/CertMangerModel'
|
||||
import { CertAbstractVo } from '../model/CertManagerVo/CertAbstractVo'
|
||||
import { CertInfoVo } from '../model/CertManagerVo/CertInfoVo'
|
||||
|
||||
const TAG = "CMShowSysCa Presenter: ";
|
||||
|
||||
export default class CMShowSysCaPresenter {
|
||||
private static sInstance: CMShowSysCaPresenter;
|
||||
certList: CertAbstractVo[] = [];
|
||||
certInfo: CertInfoVo = new CertInfoVo("", "", false, "", "", "", "", "", "", null, null, null, null);
|
||||
|
||||
public static getInstance(): CMShowSysCaPresenter {
|
||||
if (CMShowSysCaPresenter.sInstance == null) {
|
||||
CMShowSysCaPresenter.sInstance = new CMShowSysCaPresenter();
|
||||
}
|
||||
return CMShowSysCaPresenter.sInstance;
|
||||
}
|
||||
|
||||
onAboutToAppear() {
|
||||
this.updateSystemTrustedCertificateList();
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
this.certList = [];
|
||||
this.certInfo = new CertInfoVo("", "", false, "", "", "", "", "", "", null, null, null, null);
|
||||
}
|
||||
|
||||
updateSystemTrustedCertificateList() {
|
||||
certManagerModel.getCertOrCredList(CMModelOptType.CM_MODEL_OPT_SYSTEM_CA, (errCode, certList) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
certList.sort((certAbs, certAbsOther) => {
|
||||
let certAlias = certAbs.certAlias
|
||||
let certAliasOther = certAbsOther.certAlias
|
||||
if (certAlias <= certAliasOther) {
|
||||
return -1
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
})
|
||||
this.certList = certList;
|
||||
console.log("updateSystemTrustedCertificateList inin :" + JSON.stringify(certList));
|
||||
} else {
|
||||
console.info(TAG + 'updateSystemTrustedCertificateList fail,errCode is' + errCode);
|
||||
this.certList = [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getSystemTrustedCertificate(uri) {
|
||||
certManagerModel.getCertOrCred(CMModelOptType.CM_MODEL_OPT_SYSTEM_CA, uri, (errCode, certInfo) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
console.info(TAG + 'getSystemTrustedCertificate success,errCode is ' + errCode + ' certInfo is' +
|
||||
JSON.stringify(certInfo));
|
||||
this.certInfo = certInfo;
|
||||
} else {
|
||||
console.info(TAG + 'getSystemTrustedCertificate fail,errCode is' + errCode);
|
||||
this.certInfo.clearCertInfoVo();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setSystemCertificateStatus(uri, status) {
|
||||
certManagerModel.setCertStatus(CMModelOptType.CM_MODEL_OPT_SYSTEM_CA, uri, status, (errCode) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
console.info(TAG + 'setSystemCertificateStatus success,errCode is' + errCode);
|
||||
this.updateSystemTrustedCertificateList();
|
||||
} else {
|
||||
console.info(TAG + 'setSystemCertificateStatus fail,errCode is' + errCode);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import certManagerModel from '../model/CertMangerModel'
|
||||
import { CMModelErrorCode, CMModelOptType } from '../model/CertMangerModel'
|
||||
import { CertAbstractVo } from '../model/CertManagerVo/CertAbstractVo'
|
||||
import { CertInfoVo } from '../model/CertManagerVo/CertInfoVo'
|
||||
|
||||
const TAG = "CMFaShowUserCa Presenter: ";
|
||||
|
||||
export default class CMShowUserCaPresenter {
|
||||
private static sInstance: CMShowUserCaPresenter;
|
||||
certList: CertAbstractVo[] = [];
|
||||
certInfo: CertInfoVo = new CertInfoVo("", "", false, "", "", "", "", "", "", null, null, null, null);
|
||||
|
||||
public static getInstance(): CMShowUserCaPresenter {
|
||||
if (CMShowUserCaPresenter.sInstance == null) {
|
||||
CMShowUserCaPresenter.sInstance = new CMShowUserCaPresenter();
|
||||
}
|
||||
return CMShowUserCaPresenter.sInstance;
|
||||
}
|
||||
|
||||
onAboutToAppear() {
|
||||
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
this.certList = [];
|
||||
this.certInfo = new CertInfoVo("", "", false, "", "", "", "", "", "", null, null, null, null);
|
||||
}
|
||||
|
||||
updateUserTrustedCertificateList() {
|
||||
certManagerModel.getCertOrCredList(CMModelOptType.CM_MODEL_OPT_USER_CA, (errCode, certList) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
certList.sort((certAbs, certAbsOther) => {
|
||||
let certAlias = certAbs.certAlias
|
||||
let certAliasOther = certAbsOther.certAlias
|
||||
if (certAlias <= certAliasOther) {
|
||||
return -1
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
})
|
||||
this.certList = certList;
|
||||
console.log("updateUserTrustedCertificateList inin :" + JSON.stringify(certList));
|
||||
} else {
|
||||
console.info(TAG + 'updateUserTrustedCertificateList fail,errCode is ' + errCode);
|
||||
this.certList = [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getUserTrustedCertificate(uri) {
|
||||
certManagerModel.getCertOrCred(CMModelOptType.CM_MODEL_OPT_USER_CA, uri, (errCode, certInfo) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
console.info(TAG + 'getUserTrustedCertificate success, errCode is ' + errCode + ' certInfo is' +
|
||||
JSON.stringify(certInfo));
|
||||
this.certInfo = certInfo;
|
||||
} else {
|
||||
console.info(TAG + 'getUserTrustedCertificate fail, errCode is ' + errCode);
|
||||
this.certInfo.clearCertInfoVo();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setUserCertificateStatus(uri, status) {
|
||||
certManagerModel.setCertStatus(CMModelOptType.CM_MODEL_OPT_USER_CA, uri, status, (errCode) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
this.getUserTrustedCertificate(uri);
|
||||
} else {
|
||||
console.info(TAG + 'setUserCertificateStatus fail,errCode is ' + errCode)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
deleteUserCertificate(uri) {
|
||||
certManagerModel.deleteCertOrCred(CMModelOptType.CM_MODEL_OPT_USER_CA, uri, (errCode) => {
|
||||
if (errCode === CMModelErrorCode.CM_MODEL_ERROR_SUCCESS) {
|
||||
this.updateUserTrustedCertificateList();
|
||||
} else {
|
||||
console.info(TAG + 'deleteUserCertificate fail,errCode is ' + errCode);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,652 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CMResult, BusinessError, CMErrorCode, CMBlob, CMSignatureSpec, CertManagerStore } from './certStubStruct';
|
||||
import certStubUtil from './certStubUtil';
|
||||
import fileio from '@ohos.fileio';
|
||||
|
||||
var certUtil = new certStubUtil();
|
||||
const TAG = "CertManager Stub: ";
|
||||
const certNum = 10
|
||||
const keyNum = 20
|
||||
const authorListA = ["20010027", "20010026", "10003", "20010013","20010033"]
|
||||
const authorListB = ["20010033", "10003", "20010027"]
|
||||
const authorListC = ["20010032", "20010013", "20010026", "10003"]
|
||||
|
||||
export class CertStubPromise {
|
||||
exceptFlag = 0;
|
||||
uriBase = "uri://stub/certFile/"
|
||||
type = "CM_URI_TYPE_APP_KEY"
|
||||
uriCount = 0;
|
||||
systemCertMap = new Map();
|
||||
userCertMap = new Map();
|
||||
uriToAlias = new Map();
|
||||
appCredMap = new Map();
|
||||
privateCredMap = new Map();
|
||||
uriToAppList = new Map();
|
||||
|
||||
constructor() {
|
||||
let newCert;
|
||||
|
||||
console.log(TAG + "getSystemTrustedCertificateList stub constructor start");
|
||||
newCert = certUtil.parseCertInfo(this.uriBase + this.uriCount.toString(),
|
||||
"SystemRoot_1", true, new Uint8Array([0, 1, 2, 42, 100, 101, 102, 255]));
|
||||
this.systemCertMap.set(this.uriBase + this.uriCount.toString(), newCert);
|
||||
this.uriCount++;
|
||||
|
||||
newCert = certUtil.parseCertInfo(this.uriBase + this.uriCount.toString(),
|
||||
"SystemRoot_2", false, new Uint8Array([64, 1, 2, 42, 100, 123, 321, 255]));
|
||||
this.systemCertMap.set(this.uriBase + this.uriCount.toString(), newCert);
|
||||
this.uriCount++;
|
||||
|
||||
newCert = certUtil.parseCertInfo(this.uriBase + this.uriCount.toString(),
|
||||
"SystemRoot_3", true, new Uint8Array([54, 1, 123, 42, 100, 101, 102, 23]));
|
||||
this.systemCertMap.set(this.uriBase + this.uriCount.toString(), newCert);
|
||||
this.uriCount++;
|
||||
|
||||
newCert = certUtil.parseCertInfo(this.uriBase + this.uriCount.toString(),
|
||||
"UserRoot_1", true, new Uint8Array([0, 1, 2, 42, 100, 101, 102, 255]));
|
||||
this.userCertMap.set("UserRoot_1", newCert);
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), "UserRoot_1")
|
||||
this.uriCount++;
|
||||
|
||||
newCert = certUtil.parseCertInfo(this.uriBase + this.uriCount.toString(),
|
||||
"UserRoot_2", false, new Uint8Array([0, 1, 2, 42, 100, 101, 102, 255]));
|
||||
this.userCertMap.set("UserRoot_2", newCert);
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), "UserRoot_2")
|
||||
this.uriCount++;
|
||||
|
||||
newCert = certUtil.parseCertInfo(this.uriBase + this.uriCount.toString(),
|
||||
"UserRoot_3", true, new Uint8Array([0, 1, 2, 42, 100, 101, 102, 255]));
|
||||
this.userCertMap.set("UserRoot_3", newCert);
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), "UserRoot_3")
|
||||
this.uriCount++;
|
||||
|
||||
newCert = certUtil.parseCredential(this.type, "TheEncryptionForCCMPV1", this.uriBase + this.uriCount.toString(), certNum, keyNum,
|
||||
new Uint8Array([25, 5, 34, 45, 64, 78, 7, 8]));
|
||||
this.appCredMap.set("ApptemRoot_1", newCert);
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), "ApptemRoot_1")
|
||||
this.uriToAppList.set(this.uriBase + this.uriCount.toString(), authorListA)
|
||||
this.uriCount++;
|
||||
|
||||
newCert = certUtil.parseCredential(this.type, "TheEncryptionForCCMPV2", this.uriBase + this.uriCount.toString(), certNum, keyNum,
|
||||
new Uint8Array([23, 1, 43, 42, 78, 90, 56, 12]));
|
||||
this.appCredMap.set("ApptemRoot_2", newCert);
|
||||
this.uriToAppList.set(this.uriBase + this.uriCount.toString(), authorListB)
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), "ApptemRoot_2")
|
||||
this.uriCount++;
|
||||
|
||||
newCert = certUtil.parseCredential(this.type, "TheEncryptionForCCMPV3", this.uriBase + this.uriCount.toString(), certNum, keyNum,
|
||||
new Uint8Array([21, 1, 32, 645, 100, 101, 102, 23]));
|
||||
this.appCredMap.set("ApptemRoot_3", newCert);
|
||||
this.uriToAppList.set(this.uriBase + this.uriCount.toString(), authorListC)
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), "ApptemRoot_3")
|
||||
this.uriCount++;
|
||||
|
||||
newCert = certUtil.parseCredential(this.type, "Employee_WPA_EAPIEA", this.uriBase + this.uriCount.toString(), certNum, keyNum,
|
||||
new Uint8Array([32, 41, 54, 67, 77, 98, 91, 123]));
|
||||
this.privateCredMap.set("PrivatetemRoot_1", newCert);
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), "PrivatetemRoot_1")
|
||||
this.uriCount++;
|
||||
|
||||
newCert = certUtil.parseCredential(this.type, "Employee_WPA_EAPIEB", this.uriBase + this.uriCount.toString(), certNum, keyNum,
|
||||
new Uint8Array([34, 65, 67, 68, 33, 77, 14, 18]));
|
||||
this.privateCredMap.set("PrivatetemRoot_2", newCert);
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), "PrivatetemRoot_2")
|
||||
this.uriCount++;
|
||||
|
||||
newCert = certUtil.parseCredential(this.type, "Employee_WPA_EAPIEC", this.uriBase + this.uriCount.toString(), certNum, keyNum,
|
||||
new Uint8Array([12, 3, 54, 76, 8, 123, 43, 55]));
|
||||
this.privateCredMap.set("PrivatetemRoot_3", newCert);
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), "PrivatetemRoot_3")
|
||||
this.uriCount++;
|
||||
}
|
||||
|
||||
getSystemTrustedCertificateList() {
|
||||
return new Promise<CMResult>((resolve, reject) => {
|
||||
let error: BusinessError;
|
||||
let data: CMResult;
|
||||
let certList = new Array();
|
||||
|
||||
if (!this.exceptFlag) {
|
||||
console.log(TAG + "getSystemTrustedCertificateList stub start");
|
||||
this.systemCertMap.forEach((data, keyUri) => {
|
||||
certList.push(this.systemCertMap.get(keyUri))
|
||||
})
|
||||
data = {
|
||||
certList: certList
|
||||
};
|
||||
resolve(data);
|
||||
} else {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_FAILURE,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getSystemTrustedCertificate(certUri: string) {
|
||||
return new Promise<CMResult>((resolve, reject) => {
|
||||
let data: CMResult;
|
||||
let error: BusinessError;
|
||||
|
||||
if (this.systemCertMap.has(certUri)) {
|
||||
data = {
|
||||
certInfo: this.systemCertMap.get(certUri)
|
||||
};
|
||||
resolve(data);
|
||||
} else {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_EXIST,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
setCertificateStatus(certUri: string, store: number, status: boolean) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let error: BusinessError;
|
||||
let alias;
|
||||
|
||||
if ((!this.systemCertMap.has(certUri)) &&
|
||||
(!this.uriToAlias.has(certUri))) {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_EXIST,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
|
||||
if (store == CertManagerStore.CERT_MANAGER_SYSTEM_TRUSTED_STORE) {
|
||||
this.systemCertMap.get(certUri).status = status;
|
||||
resolve();
|
||||
} else if (store == CertManagerStore.CERT_MANAGER_USER_TRUSTED_STORE) {
|
||||
alias = this.uriToAlias.get(certUri);
|
||||
this.userCertMap.get(alias).status = status;
|
||||
resolve();
|
||||
} else {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_SUPPORTED,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
installUserTrustedCertificate(certificate: CMBlob) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let newCert = certUtil.parseCertInfo(this.uriBase + this.uriCount.toString(),
|
||||
certificate.alias, true, certificate.inData);
|
||||
this.userCertMap.set(certificate.alias, newCert);
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), certificate.alias)
|
||||
this.uriCount++;
|
||||
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
uninstallAllUserTrustedCertificate() {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
console.log(TAG + "uninstallAllUserTrustedCertificate stub in");
|
||||
this.userCertMap.clear();
|
||||
this.uriToAlias.clear();
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
uninstallUserTrustedCertificate(certUri: string) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let error: BusinessError;
|
||||
let alias;
|
||||
|
||||
if (!this.uriToAlias.has(certUri)) {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_EXIST,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
|
||||
alias = this.uriToAlias.get(certUri);
|
||||
this.uriToAlias.delete(certUri);
|
||||
this.userCertMap.delete(alias);
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
getUserTrustedCertificateList() {
|
||||
return new Promise<CMResult>((resolve, reject) => {
|
||||
let error: BusinessError;
|
||||
let data: CMResult;
|
||||
let certList = new Array();
|
||||
|
||||
if (!this.exceptFlag) {
|
||||
this.userCertMap.forEach((data, keyAlias) => {
|
||||
certList.push(this.userCertMap.get(keyAlias))
|
||||
})
|
||||
|
||||
data = {
|
||||
certList: certList
|
||||
};
|
||||
resolve(data);
|
||||
} else {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_FAILURE,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getUserTrustedCertificate(certUri: string) {
|
||||
return new Promise<CMResult>((resolve, reject) => {
|
||||
let data: CMResult;
|
||||
let error: BusinessError;
|
||||
|
||||
if (this.uriToAlias.has(certUri)) {
|
||||
let alias = this.uriToAlias.get(certUri);
|
||||
data = {
|
||||
certInfo: this.userCertMap.get(alias)
|
||||
};
|
||||
resolve(data);
|
||||
} else {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_EXIST,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
installAppCertificate(keystore: Uint8Array, keystorePwd: string, certAlias: string) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let newCred = certUtil.parseCredential(this.type, certAlias, this.uriBase + this.uriCount.toString(),
|
||||
certNum, keyNum, keystore);
|
||||
this.appCredMap.set(certAlias, newCred);
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), certAlias)
|
||||
this.uriCount++;
|
||||
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
installPrivateCertificate(keystore: Uint8Array, keystorePwd: string, certAlias: string) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let newCred = certUtil.parseCredential("privateCred", certAlias, this.uriBase + this.uriCount.toString(),
|
||||
1, 1, keystore);
|
||||
this.privateCredMap.set(certAlias, newCred);
|
||||
this.uriToAlias.set(this.uriBase + this.uriCount.toString(), certAlias);
|
||||
this.uriCount++;
|
||||
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
uninstallAllAppCertificate() {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
console.log(TAG + "uninstallAllAppCertificate stub in");
|
||||
this.appCredMap.clear();
|
||||
this.privateCredMap.clear();
|
||||
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
uninstallAppCertificate(keyUri: string) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let alias;
|
||||
let error: BusinessError;
|
||||
|
||||
if (!this.uriToAlias.has(keyUri)) {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_EXIST,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
|
||||
alias = this.uriToAlias.get(keyUri);
|
||||
this.uriToAlias.delete(keyUri);
|
||||
this.appCredMap.delete(alias);
|
||||
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
uninstallPrivateCertificate(keyUri) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let alias;
|
||||
let error: BusinessError;
|
||||
|
||||
if (!this.uriToAlias.has(keyUri)) {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_EXIST,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
|
||||
alias = this.uriToAlias.get(keyUri);
|
||||
this.uriToAlias.delete(keyUri);
|
||||
this.privateCredMap.delete(alias);
|
||||
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
getAppCertificateList() {
|
||||
return new Promise<CMResult>((resolve, reject) => {
|
||||
let error: BusinessError;
|
||||
let data: CMResult;
|
||||
let credList = new Array();
|
||||
|
||||
if (!this.exceptFlag) {
|
||||
this.appCredMap.forEach((data, keyAlias) => {
|
||||
credList.push(this.appCredMap.get(keyAlias))
|
||||
})
|
||||
|
||||
data = {
|
||||
credentialList: credList
|
||||
};
|
||||
resolve(data);
|
||||
} else {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_FAILURE,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getPrivateCertificateList() {
|
||||
return new Promise<CMResult>((resolve, reject) => {
|
||||
let error: BusinessError;
|
||||
let data: CMResult;
|
||||
let credList = new Array();
|
||||
|
||||
if (!this.exceptFlag) {
|
||||
this.privateCredMap.forEach((data, keyAlias) => {
|
||||
credList.push(this.privateCredMap.get(keyAlias))
|
||||
})
|
||||
|
||||
data = {
|
||||
credentialList: credList
|
||||
};
|
||||
resolve(data);
|
||||
} else {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_FAILURE,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getAppCertificate(keyUri: string) {
|
||||
return new Promise<CMResult>((resolve, reject) => {
|
||||
let data: CMResult;
|
||||
let error: BusinessError;
|
||||
|
||||
if (this.uriToAlias.has(keyUri)) {
|
||||
let alias = this.uriToAlias.get(keyUri);
|
||||
data = {
|
||||
credential: this.appCredMap.get(alias)
|
||||
};
|
||||
resolve(data);
|
||||
} else {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_EXIST,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getPrivateCertificate(keyUri: string) {
|
||||
return new Promise<CMResult>((resolve, reject) => {
|
||||
let data: CMResult;
|
||||
let error: BusinessError;
|
||||
|
||||
if (this.uriToAlias.has(keyUri)) {
|
||||
let alias = this.uriToAlias.get(keyUri);
|
||||
data = {
|
||||
credential: this.privateCredMap.get(alias)
|
||||
};
|
||||
resolve(data);
|
||||
} else {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_EXIST,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
grantAppCertificate(keyUri: string, clientAppUid: string) {
|
||||
return new Promise<CMResult>((resolve, reject) => {
|
||||
let appList: Array<string>;
|
||||
let data: CMResult;
|
||||
let error: BusinessError;
|
||||
|
||||
console.log(TAG + "grantAppCertificate stub uri: " + keyUri + " clientAppUid: " + clientAppUid);
|
||||
if (!this.uriToAlias.has(keyUri)) {
|
||||
error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_EXIST,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
|
||||
if (this.uriToAppList.has(keyUri)) {
|
||||
appList = this.uriToAppList.get(keyUri);
|
||||
} else {
|
||||
appList = new Array();
|
||||
}
|
||||
|
||||
appList.push(clientAppUid);
|
||||
this.uriToAppList.set(keyUri, appList)
|
||||
data = {
|
||||
authUri: "authUri-value"
|
||||
};
|
||||
console.log(TAG + "grantAppCertificate stub uriToAppList: " + JSON.stringify(appList));
|
||||
|
||||
resolve(data);
|
||||
})
|
||||
}
|
||||
|
||||
isAuthorizedApp(keyUri: string) {
|
||||
return new Promise<CMResult>((resolve, reject) => {
|
||||
let data: CMResult;
|
||||
data = {
|
||||
isAuth: false
|
||||
};
|
||||
resolve(data);
|
||||
})
|
||||
}
|
||||
|
||||
getAuthorizedAppList(keyUri: string) {
|
||||
return new Promise<CMResult>((resolve, reject) => {
|
||||
let data: CMResult;
|
||||
let appList: Array<string>;
|
||||
|
||||
if ((!this.uriToAlias.has(keyUri)) || (!this.uriToAppList.has(keyUri))) {
|
||||
data = {
|
||||
appUidList: appList,
|
||||
};
|
||||
resolve(data);
|
||||
}
|
||||
|
||||
appList = this.uriToAppList.get(keyUri);
|
||||
|
||||
data = {
|
||||
appUidList: appList
|
||||
};
|
||||
resolve(data);
|
||||
})
|
||||
}
|
||||
|
||||
removeGrantedAppCertificate(keyUri: string, clientAppUid: string) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let appList: Array<string>;
|
||||
|
||||
if ((!this.uriToAlias.has(keyUri)) || (!this.uriToAppList.has(keyUri))) {
|
||||
let error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_EXIST,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
|
||||
appList = this.uriToAppList.get(keyUri);
|
||||
if (appList.indexOf(clientAppUid) != -1) {
|
||||
appList = appList.filter(item => item != clientAppUid);
|
||||
this.uriToAppList.set(keyUri, appList);
|
||||
resolve();
|
||||
} else {
|
||||
let error = {
|
||||
code: CMErrorCode.CMR_ERROR_NOT_EXIST,
|
||||
};
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
init(authUri: string, spec: CMSignatureSpec) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let errorCode = CMErrorCode.CMR_SUCCESS;
|
||||
let data: CMResult;
|
||||
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
update(handle: number, data: Uint8Array, token?: Uint8Array) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let errorCode = CMErrorCode.CMR_SUCCESS;
|
||||
let data: CMResult;
|
||||
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
finish(handle: number, signature?: Uint8Array) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let errorCode = CMErrorCode.CMR_SUCCESS;
|
||||
let data: CMResult;
|
||||
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
abort(handle: number) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let errorCode = CMErrorCode.CMR_SUCCESS;
|
||||
let data: CMResult;
|
||||
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
mapToJson(map) {
|
||||
let obj = Object.create(null);
|
||||
for (let [k, v] of map) {
|
||||
obj[k] = v;
|
||||
}
|
||||
|
||||
return JSON.stringify(obj)
|
||||
}
|
||||
|
||||
jsonToMap(jsonString) {
|
||||
console.log(TAG + "jsonToMap start");
|
||||
let map = new Map();
|
||||
let obj = JSON.parse(jsonString);
|
||||
|
||||
for (let k of Object.keys(obj)) {
|
||||
map.set(k, obj[k])
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
saveAllMaps() {
|
||||
console.log(TAG + "saveAllMaps start");
|
||||
let dataList = [
|
||||
this.mapToJson(this.systemCertMap),
|
||||
this.mapToJson(this.userCertMap),
|
||||
this.mapToJson(this.uriToAlias),
|
||||
this.mapToJson(this.appCredMap),
|
||||
this.mapToJson(this.privateCredMap),
|
||||
this.mapToJson(this.uriToAppList)
|
||||
];
|
||||
|
||||
let context = globalThis.certManagerAbilityContext;
|
||||
let path = context.cacheDir;
|
||||
path += '/certStubData'
|
||||
try {
|
||||
fileio.unlinkSync(path);
|
||||
} catch (err) {
|
||||
console.log(TAG + "saveAllMaps unlinkSync err: " + err);
|
||||
}
|
||||
let fd = fileio.openSync(path, 0o102, 0o666);
|
||||
fileio.writeSync(fd, JSON.stringify(dataList));
|
||||
fileio.closeSync(fd);
|
||||
console.log(TAG + "saveAllMaps end");
|
||||
}
|
||||
|
||||
uint8ArrayToString(fileData) {
|
||||
var dataString = "";
|
||||
for (var i = 0; i < fileData.length; i++) {
|
||||
dataString += String.fromCharCode(fileData[i]);
|
||||
}
|
||||
return dataString
|
||||
}
|
||||
|
||||
restoreMapsFromJson(json) {
|
||||
console.log(TAG + "restoreMapsFromJson start Json: " + json);
|
||||
let dataList = JSON.parse(json);
|
||||
this.systemCertMap = this.jsonToMap(dataList[0]);
|
||||
this.userCertMap = this.jsonToMap(dataList[1]);
|
||||
this.uriToAlias = this.jsonToMap(dataList[2]);
|
||||
this.appCredMap = this.jsonToMap(dataList[3]);
|
||||
this.privateCredMap = this.jsonToMap(dataList[4]);
|
||||
this.uriToAppList = this.jsonToMap(dataList[5]);
|
||||
console.log(TAG + "restoreMapsFromJson end");
|
||||
}
|
||||
|
||||
restoreAllMaps() {
|
||||
console.log(TAG + "getAllMaps start");
|
||||
let context = globalThis.certManagerAbilityContext;
|
||||
let path = context.cacheDir;
|
||||
path += '/certStubData'
|
||||
|
||||
try {
|
||||
let fd = fileio.openSync(path, 0o002, 0o666);
|
||||
console.log(TAG + "getAllMaps fd: " + fd);
|
||||
let stat = fileio.fstatSync(fd);
|
||||
let size = stat.size;
|
||||
let buf = new ArrayBuffer(size);
|
||||
|
||||
fileio.read(fd, buf, (err, data) => {
|
||||
if (data) {
|
||||
this.restoreMapsFromJson(this.uint8ArrayToString(new Uint8Array(data.buffer)));
|
||||
}
|
||||
fileio.closeSync(fd);
|
||||
});
|
||||
} catch(err) {
|
||||
console.log(TAG + "getAllMaps err: " + err);
|
||||
}
|
||||
|
||||
console.log(TAG + "getAllMaps end");
|
||||
}
|
||||
}
|
||||
|
||||
let certStub = new CertStubPromise();
|
||||
|
||||
export default certStub as CertStubPromise;
|
@ -0,0 +1,161 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export interface CertInfo {
|
||||
uri: string,
|
||||
certAlias: string,
|
||||
status: boolean,
|
||||
issuerName: string,
|
||||
subjectName: string,
|
||||
serial: string,
|
||||
notBefore: string,
|
||||
notAfter: string,
|
||||
fingerprintSha256: string,
|
||||
cert: Uint8Array
|
||||
}
|
||||
|
||||
export interface certAbstract {
|
||||
uri: string,
|
||||
certAlias: string,
|
||||
status: boolean,
|
||||
subjectName: string,
|
||||
}
|
||||
|
||||
export interface CMResult {
|
||||
certList?: Array<certAbstract>,
|
||||
certInfo?: CertInfo,
|
||||
credentialList?:Array<CredentialAbstract>,
|
||||
credential?: Credential,
|
||||
appUidList?: Array<string>
|
||||
authUri?: string,
|
||||
outData?: Uint8Array,
|
||||
isAuth?: boolean
|
||||
}
|
||||
|
||||
export interface CMHandle {
|
||||
errorCode: number,
|
||||
handle: number;
|
||||
token?: Uint8Array;
|
||||
}
|
||||
|
||||
export interface Credential {
|
||||
type: string,
|
||||
alias: string,
|
||||
keyUri: string,
|
||||
certNum: number,
|
||||
keyNum: number,
|
||||
credData: Uint8Array
|
||||
}
|
||||
|
||||
export interface CredentialAbstract {
|
||||
type: string,
|
||||
alias: string,
|
||||
keyUri: string
|
||||
}
|
||||
|
||||
export interface CMContext {
|
||||
userId: string,
|
||||
uid: string,
|
||||
packageName: string
|
||||
};
|
||||
|
||||
export interface CMBlob {
|
||||
readonly inData?: Uint8Array,
|
||||
readonly alias?: string
|
||||
};
|
||||
|
||||
export interface CMKeyProperties {
|
||||
type: string; // Type of the key, must be CM_URI_TYPE_APP_KEY or CM_URI_TYPE_WLAN_KEY
|
||||
alg: string;
|
||||
size: number;
|
||||
padding: string;
|
||||
purpose: string;
|
||||
digest: string;
|
||||
authType: string;
|
||||
authTimeout: string;
|
||||
};
|
||||
|
||||
export interface CMSignatureSpec {
|
||||
alg: string;
|
||||
padding: string;
|
||||
digest: string;
|
||||
authToken: Uint8Array; // required only for user authentication
|
||||
};
|
||||
|
||||
export enum CertManagerStore {
|
||||
CERT_MANAGER_CREDENTIAL_STORE = 0, /* credential certificate store for end entity certificates. */
|
||||
CERT_MANAGER_SYSTEM_TRUSTED_STORE = 1, /* read only, updated by system only. */
|
||||
CERT_MANAGER_USER_TRUSTED_STORE = 2, /* modifiable by applications and user. */
|
||||
CERT_MANAGER_APPLICATION_TRUSTED_STORE = 3, /* application specific trusted certificate store; modifiable by the application only. */
|
||||
}
|
||||
|
||||
export enum CMErrorCode {
|
||||
CMR_SUCCESS = 0,
|
||||
CMR_FAILURE = -1,
|
||||
CMR_ERROR_INSTALL_CERTIFICATE = -2,
|
||||
CMR_ERROR_SET_STATUS = -3,
|
||||
CMR_ERROR_INVALID_ARGUMENT = -3,
|
||||
CMR_ERROR_INVALID_STORE = -4,
|
||||
CMR_ERROR_NOT_SUPPORTED = -5,
|
||||
CMR_ERROR_UNINSTALL = -6,
|
||||
CMR_ERROR_NO_PERMISSION = -7,
|
||||
CMR_ERROR_INSUFFICIENT_DATA = -8,
|
||||
CMR_ERROR_GET_CERTIRICATE = -9,
|
||||
CMR_ERROR_STORAGE_FAILURE = -10,
|
||||
CMR_ERROR_HARDWARE_FAILURE = -11,
|
||||
CMR_ERROR_ALREADY_EXISTS = -12,
|
||||
CMR_ERROR_NOT_EXIST = -13,
|
||||
CMR_ERROR_NULL_POINTER = -14,
|
||||
CMR_ERROR_FILE_SIZE_FAIL = -15,
|
||||
CMR_ERROR_READ_FILE_FAIL = -16,
|
||||
CMR_ERROR_INVALID_PUBLIC_KEY = -17,
|
||||
CMR_ERROR_INVALID_PRIVATE_KEY = -18,
|
||||
CMR_ERROR_INVALID_KEY_INFO = -19,
|
||||
CMR_ERROR_REMOVE_CERTIFICATE_FAIL = -20,
|
||||
CMR_ERROR_OPEN_FILE_FAIL = -21,
|
||||
CMR_ERROR_INVALID_KEY_FILE = -22,
|
||||
CMR_ERROR_IPC_MSG_FAIL = -23,
|
||||
CMR_ERROR_REQUEST_OVERFLOWS = -24,
|
||||
CMR_ERROR_PARAM_NOT_EXIST = -25,
|
||||
CMR_ERROR_CRYPTO_ENGINE_ERROR = -26,
|
||||
CMR_ERROR_COMMUNICATION_TIMEOUT = -27,
|
||||
CMR_ERROR_IPC_INIT_FAIL = -28,
|
||||
CMR_ERROR_IPC_DLOPEN_FAIL = -29,
|
||||
CMR_ERROR_EFUSE_READ_FAIL = -30,
|
||||
|
||||
CMR_ERROR_CHECK_GET_ALG_FAIL = -100,
|
||||
CMR_ERROR_CHECK_GET_KEY_SIZE_FAIL = -101,
|
||||
CMR_ERROR_CHECK_GET_PADDING_FAIL = -102,
|
||||
CMR_ERROR_INVALID_DIGEST = -117,
|
||||
|
||||
CMR_ERROR_INTERNAL_ERROR = -999,
|
||||
CMR_ERROR_UNKNOWN_ERROR = -1000,
|
||||
}
|
||||
|
||||
export interface BusinessError {
|
||||
/**
|
||||
* Defines the basic error code.
|
||||
* @since 6
|
||||
*/
|
||||
code: number;
|
||||
}
|
||||
|
||||
export interface AsyncCallback<T> {
|
||||
/**
|
||||
* Defines the callback data.
|
||||
* @since 6
|
||||
*/
|
||||
(err: BusinessError, data: T): void;
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CertInfo, certAbstract, CMResult, CMContext, AsyncCallback, BusinessError, CMHandle,
|
||||
Credential, CredentialAbstract, CMErrorCode, CMBlob, CMKeyProperties, CMSignatureSpec } from './certStubStruct'
|
||||
|
||||
export default class certStubUtil {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
parseCertInfo(uri: string, certAlias: string, status: boolean, cert: Uint8Array): CertInfo {
|
||||
let certInfo: CertInfo;
|
||||
|
||||
certInfo = {
|
||||
uri: uri,
|
||||
certAlias: certAlias,
|
||||
status: status,
|
||||
issuerName: "CN=SwissSign Gold CA - G2,OU=,O=SwissSign CA",
|
||||
subjectName: "CN=SwissSign Gold CA - G2,OU=,O=SwissSign CA",
|
||||
serial: "BB401C43F55E4FB0",
|
||||
notBefore: "1979/5/24",
|
||||
notAfter: "2030/5/24",
|
||||
fingerprintSha256: "D8:C5:38:8A:B7:30:1B:1B:6E:D4:7A:E6:45:25:3A:6F:9F:1A:27:61",
|
||||
cert: cert
|
||||
}
|
||||
|
||||
return certInfo;
|
||||
}
|
||||
|
||||
parseCertAbstract(uri: string, certAlias: string, status: boolean): certAbstract {
|
||||
let result: certAbstract;
|
||||
|
||||
result = {
|
||||
uri: uri,
|
||||
certAlias: certAlias,
|
||||
status: status,
|
||||
subjectName: "CN=SwissSign Gold CA - G2,OU=,O=SwissSign",
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
parseCMHandle(errorCode: number, handle: number, token: Uint8Array): CMHandle {
|
||||
let result: CMHandle;
|
||||
|
||||
result = {
|
||||
errorCode: errorCode,
|
||||
handle: handle,
|
||||
token: token,
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
parseCredential(type: string, alias: string, keyUri: string, certNum: number,
|
||||
keyNum: number, credData: Uint8Array): Credential {
|
||||
let result: Credential;
|
||||
|
||||
result = {
|
||||
type: type,
|
||||
alias: alias,
|
||||
keyUri: keyUri,
|
||||
certNum: certNum,
|
||||
keyNum: keyNum,
|
||||
credData: credData
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
parseCredentialAbstract(type: string, alias: string, keyUri: string): CredentialAbstract {
|
||||
let result: CredentialAbstract;
|
||||
|
||||
result = {
|
||||
type: type,
|
||||
alias: alias,
|
||||
keyUri: keyUri
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
parseCMContext(userId: string, uid: string, packageName: string): CMContext {
|
||||
let result: CMContext;
|
||||
|
||||
result = {
|
||||
userId: userId,
|
||||
uid: uid,
|
||||
packageName: packageName
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
parseCMBlob(inData: Uint8Array, alias: string): CMBlob {
|
||||
let result: CMBlob;
|
||||
|
||||
result = {
|
||||
inData: inData,
|
||||
alias: alias
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
parseCMKeyProperties(): CMKeyProperties {
|
||||
let result: CMKeyProperties;
|
||||
|
||||
result = {
|
||||
type: "CM_URI_TYPE_APP_KEY", // Type of the key, must be CM_URI_TYPE_APP_KEY or CM_URI_TYPE_WLAN_KEY
|
||||
alg: "alg",
|
||||
size: 375,
|
||||
padding: "padding purpose",
|
||||
purpose: "purpose property",
|
||||
digest: "digest property",
|
||||
authType: "Sha-256",
|
||||
authTimeout: "30"
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
parseCMSignatureSpec(alg: string, padding: string, digest: string, authToken: Uint8Array): CMSignatureSpec {
|
||||
let result: CMSignatureSpec;
|
||||
|
||||
result = {
|
||||
alg: alg,
|
||||
padding: padding,
|
||||
digest: digest,
|
||||
authToken: authToken // required only for user authentication
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
50
CertificateManager/product/phone/src/main/module.json5
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
{
|
||||
"module": {
|
||||
"name": "phone",
|
||||
"type": "feature",
|
||||
"srcEntrance": "./ets/Application/AbilityStage.ts",
|
||||
"description": "$string:mainability_description",
|
||||
"mainElement": "MainAbility",
|
||||
"deviceTypes": [
|
||||
"phone"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"uiSyntax": "ets",
|
||||
"abilities": [
|
||||
{
|
||||
"name": "MainAbility",
|
||||
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
|
||||
"description": "$string:mainability_description",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:entry_MainAbility",
|
||||
"visible": true,
|
||||
"launchType": "singleton"
|
||||
}
|
||||
],
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.READ_MEDIA",
|
||||
"reason": "$string:read_media_permission_reason"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,272 @@
|
||||
{
|
||||
"color": [
|
||||
{
|
||||
"name": "color_333333_grey",
|
||||
"value": "#333333"
|
||||
},
|
||||
{
|
||||
"name": "color_666666_grey",
|
||||
"value": "#666666"
|
||||
},
|
||||
{
|
||||
"name": "color_999999_grey",
|
||||
"value": "#999999"
|
||||
},
|
||||
{
|
||||
"name": "color_E3E3E3_grey",
|
||||
"value": "#E3E3E3"
|
||||
},
|
||||
{
|
||||
"name": "color_D8D8D8_grey",
|
||||
"value": "#D8D8D8"
|
||||
},
|
||||
{
|
||||
"name": "color_button_grey",
|
||||
"value": "#1824310D"
|
||||
},
|
||||
{
|
||||
"name": "color_00000000_transparent",
|
||||
"value": "#00000000"
|
||||
},
|
||||
{
|
||||
"name": "volume_bg_color",
|
||||
"value": "#CCFFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "white_bg_color",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "font_color_182431",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "font_color_007DFF",
|
||||
"value": "#007DFF"
|
||||
},
|
||||
{
|
||||
"name": "search_no_result_text_color",
|
||||
"value": "$color:font_color_182431"
|
||||
},
|
||||
{
|
||||
"name": "search_result_text_color",
|
||||
"value": "$color:font_color_182431"
|
||||
},
|
||||
{
|
||||
"name": "search_result_text_color_highlight",
|
||||
"value": "$color:font_color_007DFF"
|
||||
},
|
||||
{
|
||||
"name": "bluetooth_text_color_highlight",
|
||||
"value": "$color:font_color_007DFF"
|
||||
},
|
||||
{
|
||||
"name": "FAFAFA",
|
||||
"value": "#FAFAFA"
|
||||
},
|
||||
{
|
||||
"name": "DCEAF9",
|
||||
"value": "#DCEAF9"
|
||||
},
|
||||
{
|
||||
"name": "4C89F0",
|
||||
"value": "#4C89F0"
|
||||
},
|
||||
{
|
||||
"name": "D1D0DB",
|
||||
"value": "#D1D0DB"
|
||||
},
|
||||
{
|
||||
"name": "cm_del_all_font_color",
|
||||
"value": "#007DFF"
|
||||
},
|
||||
{
|
||||
"name": "cm_del_all_cancel_button_color",
|
||||
"value": "#007DFF"
|
||||
},
|
||||
{
|
||||
"name": "cm_del_all_delete_button_color",
|
||||
"value": "#FA2A2D"
|
||||
},
|
||||
{
|
||||
"name": "request_auth_font_color",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "request_auth_background_color",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "request_auth_bt_font_color",
|
||||
"value": "#4C89F0"
|
||||
},
|
||||
{
|
||||
"name": "request_auth_color",
|
||||
"value": "#E5E5E5"
|
||||
},
|
||||
{
|
||||
"name": "install_cancel_bt_font_color",
|
||||
"value": "#007DFF"
|
||||
},
|
||||
{
|
||||
"name": "install_cancel_bt_bg_color",
|
||||
"value": "#0d182431"
|
||||
},
|
||||
{
|
||||
"name": "install_confirm_bt_font_color",
|
||||
"value": "#ffffffff"
|
||||
},
|
||||
{
|
||||
"name": "install_confirm_bt_bg_color",
|
||||
"value": "#007DFF"
|
||||
},
|
||||
{
|
||||
"name": "install_confirm_bt_bg_disable_color",
|
||||
"value": "#66007DFF"
|
||||
},
|
||||
{
|
||||
"name": "install_info_font_color",
|
||||
"value": "#E6000000"
|
||||
},
|
||||
{
|
||||
"name": "credentials_app_name_color",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "credentials_app_Toggle_selectColor",
|
||||
"value": "#007DFF"
|
||||
},
|
||||
{
|
||||
"name": "credentials_app_title_color",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "credentials_app_list_backgroundColor",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "credentials_app_finishColor",
|
||||
"value": "#4C89F0"
|
||||
},
|
||||
{
|
||||
"name": "credentials_app_finish_backgroundColor",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "credentials_detail_keyNum_fontColor",
|
||||
"value": "#000000"
|
||||
},
|
||||
{
|
||||
"name": "credentials_detail_close_fontColor",
|
||||
"value": "#4C89F0"
|
||||
},
|
||||
{
|
||||
"name": "warning_delete_fontColor",
|
||||
"value": "#FF0000"
|
||||
},
|
||||
{
|
||||
"name": "public_delete_fontColor",
|
||||
"value": "#CD5C5C"
|
||||
},
|
||||
{
|
||||
"name": "evidenceList_TabBuilder_fontColor_182431",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "Evidence_color",
|
||||
"value": "#0D000000"
|
||||
},
|
||||
{
|
||||
"name": "Evidence_backgroundColor",
|
||||
"value": "#F1F3F5"
|
||||
},
|
||||
{
|
||||
"name": "sys_list_divider_color_000000",
|
||||
"value": "#0D000000"
|
||||
},
|
||||
{
|
||||
"name": "TrustedEvidence_TabBuilder_fontColor_182431",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "sys_list_backgroundColor_FFFFFF",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "user_list_divider_color_000000",
|
||||
"value": "#0D000000"
|
||||
},
|
||||
{
|
||||
"name": "user_list_backgroundColor_FFFFFF",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "componentUser_text_fontColor_182431",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "ComponentSystem_text_fontColor_182431",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "ComponentSystem_Toggle_selectedColor_007DFF",
|
||||
"value": "#007DFF"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_text_fontColor_182431",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_list_backgroundColor_FFFFFF",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_Button_backgroundColor_FFFFFF",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_Button_fontColor_4C89F0",
|
||||
"value": "#4C89F0"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_text_fontColor_182431",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Flex_Toggle_selectedColor_007DFF",
|
||||
"value": "#007DFF"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Flex_firButton_backgroundColor_FFFFFF",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Flex_firButton_fontColor_4C89F0",
|
||||
"value": "#4C89F0"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_warning_secButton_fontColor_FF0000",
|
||||
"value": "#FF0000"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Flex_secButton_backgroundColor_FFFFFF",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Flex_secButton_fontColor_FF0000",
|
||||
"value": "#FF0000"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_Text_fontColor_182431",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "CertManager_Divider_Color_182431",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "TrustedEvidence_tabs_backgroundColor_F1F3F5",
|
||||
"value": "#F1F3F5"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,290 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "entry_MainAbility",
|
||||
"value": "证书管理FA"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
},
|
||||
{
|
||||
"name": "read_media_permission_reason",
|
||||
"value": "安装证书功能需使用媒体库权限"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"value": "版本 "
|
||||
},
|
||||
{
|
||||
"name": "certificateTab",
|
||||
"value": "证书与凭据"
|
||||
},
|
||||
{
|
||||
"name": "certificateManage",
|
||||
"value": "证书管理"
|
||||
},
|
||||
{
|
||||
"name": "trustedEvidence",
|
||||
"value": "受信任的证书"
|
||||
},
|
||||
{
|
||||
"name": "userEvidence",
|
||||
"value": "凭据列表"
|
||||
},
|
||||
{
|
||||
"name": "installInStorageDevice",
|
||||
"value": "从存储设备安装"
|
||||
},
|
||||
{
|
||||
"name": "installCertificateFailed",
|
||||
"value": "从存储设备安装失败"
|
||||
},
|
||||
{
|
||||
"name": "certificatePwdTab",
|
||||
"value": "提取证书"
|
||||
},
|
||||
{
|
||||
"name": "certificateAliasTab",
|
||||
"value": "设置证书"
|
||||
},
|
||||
{
|
||||
"name": "certificatePwdInfo",
|
||||
"value": "输入证书密码以提取"
|
||||
},
|
||||
{
|
||||
"name": "certificateAliasInfo",
|
||||
"value": "输入证书名称"
|
||||
},
|
||||
{
|
||||
"name": "deleteAllCred",
|
||||
"value": "删除所有证书与凭据"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"name": "deleteAllCredDialogTitle",
|
||||
"value": "删除所有证书与凭据"
|
||||
},
|
||||
{
|
||||
"name": "deleteAllCredDialogMessage",
|
||||
"value": "所有用户证书与凭据将被永久删除。是否删除?"
|
||||
},
|
||||
{
|
||||
"name": "deleteAllCredCancel",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "deleteAllCredDelete",
|
||||
"value": "删除"
|
||||
},
|
||||
{
|
||||
"name": "pickCredToAuth",
|
||||
"value": "选择证书授权"
|
||||
},
|
||||
{
|
||||
"name": "requestAuthMsg",
|
||||
"value": "应用\"%s\"请求使用证书。选择一个证书可让该应用对服务器使用此身份凭证。该应用已将请求服务标识为\"localhost\",您只应向信任的应用授予使用证书的权限。"
|
||||
},
|
||||
{
|
||||
"name": "requestAuthCancel",
|
||||
"value": "拒绝"
|
||||
},
|
||||
{
|
||||
"name": "requestAuthFinish",
|
||||
"value": "授权"
|
||||
},
|
||||
{
|
||||
"name": "requestFailPromptMsg",
|
||||
"value": "授权失败,无效AppUid"
|
||||
},
|
||||
{
|
||||
"name": "installPwdInputCancel",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "installPwdInputConfirm",
|
||||
"value": "提取"
|
||||
},
|
||||
{
|
||||
"name": "installAliasInputCancel",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "installAliasInputConfirm",
|
||||
"value": "确定"
|
||||
},
|
||||
{
|
||||
"name": "installAliasInputInfo",
|
||||
"value": "注:此证书颁发者可能会检查进出设备的所有流量\n该数据包包含:CA证书"
|
||||
},
|
||||
{
|
||||
"name": "managerAuthApp",
|
||||
"value": "管理授权应用"
|
||||
},
|
||||
{
|
||||
"name": "cancelAuthApp",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "finishAuthApp",
|
||||
"value": "完成"
|
||||
},
|
||||
{
|
||||
"name": "evidenceDetails",
|
||||
"value": "凭据详情"
|
||||
},
|
||||
{
|
||||
"name": "entryContains",
|
||||
"value": "此条目包含:"
|
||||
},
|
||||
{
|
||||
"name": "keyNum",
|
||||
"value": " %s个用户密钥"
|
||||
},
|
||||
{
|
||||
"name": "userCerNum",
|
||||
"value": " %s个用户证书"
|
||||
},
|
||||
{
|
||||
"name": "privateDetailsClose",
|
||||
"value": "关闭"
|
||||
},
|
||||
{
|
||||
"name": "publicDetailsCancel",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "publicDetailsDelete",
|
||||
"value": "删除"
|
||||
},
|
||||
{
|
||||
"name": "warning_title",
|
||||
"value": "删除凭据"
|
||||
},
|
||||
{
|
||||
"name": "warning_message",
|
||||
"value": "删除后,被授权此凭据的应用将无法正常使用。是否删除?"
|
||||
},
|
||||
{
|
||||
"name": "warning_cancel",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "warning_delete",
|
||||
"value": "删除"
|
||||
},
|
||||
{
|
||||
"name": "tabName_public",
|
||||
"value": "公共"
|
||||
},
|
||||
{
|
||||
"name": "tabName_private",
|
||||
"value": "私有"
|
||||
},
|
||||
{
|
||||
"name": "system",
|
||||
"value": "系统"
|
||||
},
|
||||
{
|
||||
"name": "user",
|
||||
"value": "用户"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_firText",
|
||||
"value": "证书详情"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_firListItem_text",
|
||||
"value": "颁发给:"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_secListItem_text",
|
||||
"value": "颁发者:"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_thdListItem_text",
|
||||
"value": "有效期:"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_Button_text",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_Button_on",
|
||||
"value": "启用"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_Button_off",
|
||||
"value": "禁用"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Status_true",
|
||||
"value": "已启用"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Status_false",
|
||||
"value": "已禁用"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Flex_firButton_text",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Flex_secButton_text",
|
||||
"value": "删除"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_warning_Button_text",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_warning_Button_title_text",
|
||||
"value": "删除证书"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_warning_Button_message_text",
|
||||
"value": "删除后,被授权此证书的应用将无法正常使用。是否删除?"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_warning_firButton_text",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_warning_secButton_text",
|
||||
"value": "删除"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_firText",
|
||||
"value": "常用名称:"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_secText",
|
||||
"value": "组织:"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_thdText",
|
||||
"value": "组织单位:"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_fouText",
|
||||
"value": "序列号:"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_fifText",
|
||||
"value": "颁发时间:"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_sixText",
|
||||
"value": "有效期至:"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_fouListItem_text",
|
||||
"value": "指纹:"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_FingerPrint_text",
|
||||
"value": "SHA-256 指纹:"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_back</title>
|
||||
<defs>
|
||||
<path d="M5.31079777,13.7499686 L11.2803301,19.7196699 L11.3140714,19.7556673 C11.5727547,20.0502619 11.5615076,20.4991526 11.2803301,20.7803301 C10.9991526,21.0615076 10.5502619,21.0727547 10.2556673,20.8140714 L10.2196699,20.7803301 L3.18929777,13.7499686 L5.31079777,13.7499686 Z M11.2803301,3.21966991 C11.5615076,3.5008474 11.5727547,3.94973814 11.3140714,4.24433269 L11.2803301,4.28033009 L4.3105,11.25 L21,11.25 C21.3994202,11.25 21.7259152,11.56223 21.7487268,11.9559318 L21.75,12 C21.75,12.3994202 21.43777,12.7259152 21.0440682,12.7487268 L21,12.75 L3.10355339,12.75 C2.8383369,12.75 2.58398299,12.6446432 2.39644661,12.4571068 C2.01893979,12.0796 2.00635623,11.4753589 2.35869593,11.0827365 L2.39644661,11.0428932 L10.2196699,3.21966991 C10.5125631,2.9267767 10.9874369,2.9267767 11.2803301,3.21966991 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_back" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" fill-rule="nonzero" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,3 @@
|
||||
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96"><defs>
|
||||
<style>.cls-1{fill:#1a1a1a;}</style>
|
||||
</defs><title>_ic</title><path class="cls-1" d="M76.29,72.05,52.24,48,76.29,24a3,3,0,1,0-4.24-4.24l-24,24-24-24A3,3,0,1,0,19.71,24L43.76,48l-24,24A3,3,0,1,0,24,76.29L48,52.24l24,24.05a3,3,0,0,0,4.24-4.24Z"/></svg>
|
After Width: | Height: | Size: 356 B |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>xxxhdpi/ic_delete</title>
|
||||
<defs>
|
||||
<path d="M5.629,7.5 L6.72612901,18.4738834 C6.83893748,19.6019681 7.77211147,20.4662096 8.89848718,20.4990325 L8.96496269,20.5 L15.0342282,20.5 C16.1681898,20.5 17.1211231,19.6570911 17.2655686,18.5392856 L17.2731282,18.4732196 L18.1924161,9.2527383 L18.369,7.5 L19.877,7.5 L19.6849078,9.40262938 L18.7657282,18.6220326 C18.5772847,20.512127 17.0070268,21.9581787 15.1166184,21.9991088 L15.0342282,22 L8.96496269,22 C7.06591715,22 5.47142703,20.5815579 5.24265599,18.7050136 L5.23357322,18.6231389 L4.121,7.5 L5.629,7.5 Z M10.25,11.75 C10.6642136,11.75 11,12.0857864 11,12.5 L11,18.5 C11,18.9142136 10.6642136,19.25 10.25,19.25 C9.83578644,19.25 9.5,18.9142136 9.5,18.5 L9.5,12.5 C9.5,12.0857864 9.83578644,11.75 10.25,11.75 Z M13.75,11.75 C14.1642136,11.75 14.5,12.0857864 14.5,12.5 L14.5,18.5 C14.5,18.9142136 14.1642136,19.25 13.75,19.25 C13.3357864,19.25 13,18.9142136 13,18.5 L13,12.5 C13,12.0857864 13.3357864,11.75 13.75,11.75 Z M12,1.75 C13.7692836,1.75 15.2083571,3.16379796 15.2491124,4.92328595 L15.25,5 L21,5 C21.4142136,5 21.75,5.33578644 21.75,5.75 C21.75,6.14942022 21.43777,6.47591522 21.0440682,6.49872683 L21,6.5 L14.5,6.5 C14.1005798,6.5 13.7740848,6.18777001 13.7512732,5.7940682 L13.75,5.75 L13.75,5 C13.75,4.03350169 12.9664983,3.25 12,3.25 C11.0536371,3.25 10.2827253,4.00119585 10.2510148,4.93983756 L10.25,5 L10.25,5.75 C10.25,6.14942022 9.93777001,6.47591522 9.5440682,6.49872683 L9.5,6.5 L2.75,6.5 C2.33578644,6.5 2,6.16421356 2,5.75 C2,5.35057978 2.31222999,5.02408478 2.7059318,5.00127317 L2.75,5 L8.75,5 C8.75,3.20507456 10.2050746,1.75 12,1.75 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="ic_delete" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" fill-rule="nonzero" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1 @@
|
||||
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96"><defs><style>.cls-1{fill:#1a1a1a;}</style></defs><title>ic</title><path class="cls-1" d="M15,42H81a3,3,0,0,0,0-6H15a3,3,0,0,0,0,6Z"/><path class="cls-1" d="M81,54H15a3,3,0,0,0,0,6H81a3,3,0,0,0,0-6Z"/></svg>
|
After Width: | Height: | Size: 301 B |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_cancel</title>
|
||||
<defs>
|
||||
<path d="M19.7781746,4.22182541 C20.0710678,4.51471863 20.0710678,4.98959236 19.7781746,5.28248558 L5.28248558,19.7781746 C4.98959236,20.0710678 4.51471863,20.0710678 4.22182541,19.7781746 C3.92893219,19.4852814 3.92893219,19.0104076 4.22182541,18.7175144 L10.9395166,11.9994697 L4.22182541,5.28248558 C3.92893219,4.98959236 3.92893219,4.51471863 4.22182541,4.22182541 C4.51471863,3.92893219 4.98959236,3.92893219 5.28248558,4.22182541 L12,10.9389863 L18.7175144,4.22182541 C19.0104076,3.92893219 19.4852814,3.92893219 19.7781746,4.22182541 Z M19.7781746,18.7175144 C20.0710678,19.0104076 20.0710678,19.4852814 19.7781746,19.7781746 C19.4852814,20.0710678 19.0104076,20.0710678 18.7175144,19.7781746 L12.7072836,13.7675902 L13.767767,12.7071068 L19.7781746,18.7175144 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_cancel" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状" fill="#000000" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_close</title>
|
||||
<defs>
|
||||
<path d="M12,1 C18.0751322,1 23,5.92486775 23,12 C23,18.0751322 18.0751322,23 12,23 C5.92486775,23 1,18.0751322 1,12 C1,5.92486775 5.92486775,1 12,1 Z M12,2.5 C6.75329488,2.5 2.5,6.75329488 2.5,12 C2.5,17.2467051 6.75329488,21.5 12,21.5 C17.2467051,21.5 21.5,17.2467051 21.5,12 C21.5,6.75329488 17.2467051,2.5 12,2.5 Z M8.81801948,7.75735931 L12.0007071,10.9386327 L15.1819805,7.75735931 C15.4748737,7.46446609 15.9497475,7.46446609 16.2426407,7.75735931 C16.5355339,8.05025253 16.5355339,8.52512627 16.2426407,8.81801948 L8.81801948,16.2426407 C8.52512627,16.5355339 8.05025253,16.5355339 7.75735931,16.2426407 C7.46446609,15.9497475 7.46446609,15.4748737 7.75735931,15.1819805 L10.9400469,11.9992929 L7.75735931,8.81801948 C7.46446609,8.52512627 7.46446609,8.05025253 7.75735931,7.75735931 C8.05025253,7.46446609 8.52512627,7.46446609 8.81801948,7.75735931 Z M13.767767,12.7071068 L16.2426407,15.1819805 C16.5355339,15.4748737 16.5355339,15.9497475 16.2426407,16.2426407 C15.9497475,16.5355339 15.4748737,16.5355339 15.1819805,16.2426407 L12.7071068,13.767767 L13.767767,12.7071068 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_close" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" fill-rule="nonzero" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1"
|
||||
id="图层_1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 48 96"
|
||||
enable-background="new 0 0 48 96"
|
||||
xml:space="preserve">
|
||||
<path
|
||||
fill="#CCCCCC"
|
||||
d="M37.1,45.9l-22-22c-1.2-1.2-3.1-1.2-4.2,0c-1.2,1.2-1.2,3.1,0,4.2L30.8,48L10.9,67.9c-1.2,1.2-1.2,3.1,0,4.2
|
||||
c0.6,0.6,1.4,0.9,2.1,0.9s1.5-0.3,2.1-0.9l22-22C38.3,48.9,38.3,47.1,37.1,45.9z"/>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 681 B |
After Width: | Height: | Size: 6.6 KiB |
@ -0,0 +1,10 @@
|
||||
{
|
||||
"src": [
|
||||
"pages/certManagerFa",
|
||||
"pages/certPwdInput",
|
||||
"pages/trustedCa",
|
||||
"pages/cerEvidenceFa",
|
||||
"pages/requestAuth",
|
||||
"pages/certInstallAliasInput"
|
||||
]
|
||||
}
|
@ -0,0 +1,290 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "entry_MainAbility",
|
||||
"value": "Certificate Manager FA"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
},
|
||||
{
|
||||
"name": "read_media_permission_reason",
|
||||
"value": "Media library permission is required when installing certificates"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"value": "Version "
|
||||
},
|
||||
{
|
||||
"name": "certificateTab",
|
||||
"value": "Certificate and Credential"
|
||||
},
|
||||
{
|
||||
"name": "certificateManage",
|
||||
"value": "Certificate Manager"
|
||||
},
|
||||
{
|
||||
"name": "trustedEvidence",
|
||||
"value": "Trusted Certificate"
|
||||
},
|
||||
{
|
||||
"name": "userEvidence",
|
||||
"value": "Credential List"
|
||||
},
|
||||
{
|
||||
"name": "installInStorageDevice",
|
||||
"value": "Install From Storage"
|
||||
},
|
||||
{
|
||||
"name": "installCertificateFailed",
|
||||
"value": "Install From Storage Failed"
|
||||
},
|
||||
{
|
||||
"name": "certificatePwdTab",
|
||||
"value": "Get Certificated"
|
||||
},
|
||||
{
|
||||
"name": "certificateAliasTab",
|
||||
"value": "Set Certificated"
|
||||
},
|
||||
{
|
||||
"name": "certificatePwdInfo",
|
||||
"value": "Input Password"
|
||||
},
|
||||
{
|
||||
"name": "certificateAliasInfo",
|
||||
"value": "Input Certificate Alias"
|
||||
},
|
||||
{
|
||||
"name": "deleteAllCred",
|
||||
"value": "Delete All Credentials and Certificates"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"name": "deleteAllCredDialogTitle",
|
||||
"value": "Delete All Credentials and Certificates"
|
||||
},
|
||||
{
|
||||
"name": "deleteAllCredDialogMessage",
|
||||
"value": "All credentials and certificates will be deleted. Whether or not to delete?"
|
||||
},
|
||||
{
|
||||
"name": "deleteAllCredCancel",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "deleteAllCredDelete",
|
||||
"value": "Delete"
|
||||
},
|
||||
{
|
||||
"name": "pickCredToAuth",
|
||||
"value": "Select credential"
|
||||
},
|
||||
{
|
||||
"name": "requestAuthMsg",
|
||||
"value": "Application \"%s\" Request a certificate. Selecting a certificate allows the app to use this identity credential for the server. The app has identified the requested service as \"localhost\", You should only grant permission to use certificates to trusted apps."
|
||||
},
|
||||
{
|
||||
"name": "requestAuthCancel",
|
||||
"value": "Reject"
|
||||
},
|
||||
{
|
||||
"name": "requestAuthFinish",
|
||||
"value": "Authorize"
|
||||
},
|
||||
{
|
||||
"name": "requestFailPromptMsg",
|
||||
"value": "Authorize failed , invalid AppUid"
|
||||
},
|
||||
{
|
||||
"name": "installPwdInputCancel",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "installPwdInputConfirm",
|
||||
"value": "Extract"
|
||||
},
|
||||
{
|
||||
"name": "installAliasInputCancel",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "installAliasInputConfirm",
|
||||
"value": "Confirm"
|
||||
},
|
||||
{
|
||||
"name": "installAliasInputInfo",
|
||||
"value": "Attention: This certificate issuer may check all traffic entering and leaving the device\nThe packets contain:CA certificate"
|
||||
},
|
||||
{
|
||||
"name": "managerAuthApp",
|
||||
"value": "Manage Authorized Applications"
|
||||
},
|
||||
{
|
||||
"name": "cancelAuthApp",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "finishAuthApp",
|
||||
"value": "Finish"
|
||||
},
|
||||
{
|
||||
"name": "evidenceDetails",
|
||||
"value": "Credential details"
|
||||
},
|
||||
{
|
||||
"name": "entryContains",
|
||||
"value": "This item contains:"
|
||||
},
|
||||
{
|
||||
"name": "keyNum",
|
||||
"value": " %s user keys"
|
||||
},
|
||||
{
|
||||
"name": "userCerNum",
|
||||
"value": " %s user certificates"
|
||||
},
|
||||
{
|
||||
"name": "privateDetailsClose",
|
||||
"value": "Close"
|
||||
},
|
||||
{
|
||||
"name": "publicDetailsCancel",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "publicDetailsDelete",
|
||||
"value": "Delete"
|
||||
},
|
||||
{
|
||||
"name": "warning_title",
|
||||
"value": "Delete certificate"
|
||||
},
|
||||
{
|
||||
"name": "warning_message",
|
||||
"value": "After deletion, the application authorized with this certificate will not work normally. Whether or not to delete?"
|
||||
},
|
||||
{
|
||||
"name": "warning_cancel",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "warning_delete",
|
||||
"value": "Delete"
|
||||
},
|
||||
{
|
||||
"name": "tabName_public",
|
||||
"value": "Public"
|
||||
},
|
||||
{
|
||||
"name": "tabName_private",
|
||||
"value": "Private"
|
||||
},
|
||||
{
|
||||
"name": "system",
|
||||
"value": "System"
|
||||
},
|
||||
{
|
||||
"name": "user",
|
||||
"value": "User"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_firText",
|
||||
"value": "Certificate Detail"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_firListItem_text",
|
||||
"value": "Issued to:"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_secListItem_text",
|
||||
"value": "Issued by:"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_thdListItem_text",
|
||||
"value": "Validity:"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_Button_text",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_Button_on",
|
||||
"value": "Enable"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_Button_off",
|
||||
"value": "Disable"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Status_true",
|
||||
"value": "Enabled"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Status_false",
|
||||
"value": "Disabled"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Flex_firButton_text",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_Flex_secButton_text",
|
||||
"value": "Delete"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_warning_Button_text",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_warning_Button_title_text",
|
||||
"value": "Delete certificate"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_warning_Button_message_text",
|
||||
"value": "After deletion, the application authorized with this certificate will not work normally. Whether or not to delete?"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_warning_firButton_text",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExampleUser_warning_secButton_text",
|
||||
"value": "Delete"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_firText",
|
||||
"value": "Common name:"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_secText",
|
||||
"value": "Organization:"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_thdText",
|
||||
"value": "Organizational unit:"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_fouText",
|
||||
"value": "Serial number:"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_fifText",
|
||||
"value": "Issued on:"
|
||||
},
|
||||
{
|
||||
"name": "DialogSubjectComponent_sixText",
|
||||
"value": "Expires on:"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_fouListItem_text",
|
||||
"value": "Fingerprints:"
|
||||
},
|
||||
{
|
||||
"name": "CustomDialogExample_FingerPrint_text",
|
||||
"value": "SHA-256 fingerprints:"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "entry_MainAbility",
|
||||
"value": "证书管理FA"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
},
|
||||
{
|
||||
"name": "certificateTab",
|
||||
"value": "证书与凭据"
|
||||
},
|
||||
{
|
||||
"name": "certificateManage",
|
||||
"value": "证书管理"
|
||||
},
|
||||
{
|
||||
"name": "trustedEvidence",
|
||||
"value": "受信任的证书"
|
||||
},
|
||||
{
|
||||
"name": "userEvidence",
|
||||
"value": "凭据列表"
|
||||
},
|
||||
{
|
||||
"name": "installInStorageDevice",
|
||||
"value": "从存储设备安装"
|
||||
},
|
||||
{
|
||||
"name": "installCertificateFailed",
|
||||
"value": "从存储设备安装失败"
|
||||
},
|
||||
{
|
||||
"name": "certificatePwdTab",
|
||||
"value": "提取证书"
|
||||
},
|
||||
{
|
||||
"name": "certificatePwdInfo",
|
||||
"value": "输入证书密码以提取"
|
||||
},
|
||||
{
|
||||
"name": "deleteAllCred",
|
||||
"value": "删除所有凭据"
|
||||
}
|
||||
]
|
||||
}
|
BIN
CertificateManager/signature/OpenHarmony.p12
Normal file
44
CertificateManager/signature/OpenHarmonyApplication.cer
Normal file
@ -0,0 +1,44 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICRDCCAcmgAwIBAgIED+E4izAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
|
||||
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
|
||||
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
|
||||
MTAyMDIxMjE0MThaFw00OTEyMzExMjE0MThaMGgxCzAJBgNVBAYTAkNOMRQwEgYD
|
||||
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEoMCYG
|
||||
A1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTB2MBAGByqGSM49
|
||||
AgEGBSuBBAAiA2IABE023XmRaw2DnO8NSsb+KG/uY0FtS3u5LQucdr3qWVnRW5ui
|
||||
QIL6ttNZBEeLTUeYcJZCpayg9Llf+1SmDA7dY4iP2EcRo4UN3rilovtfFfsmH4ty
|
||||
3SApHVFzWUl+NwdH8KNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
|
||||
AQYwHQYDVR0OBBYEFBc6EKGrGXzlAE+s0Zgnsphadw7NMAwGCCqGSM49BAMDBQAD
|
||||
ZwAwZAIwd1p3JzHN93eoPped1li0j64npgqNzwy4OrkehYAqNXpcpaEcLZ7UxW8E
|
||||
I2lZJ3SbAjAkqySHb12sIwdSFKSN9KCMMEo/eUT5dUXlcKR2nZz0MJdxT5F51qcX
|
||||
1CumzkcYhgU=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICYTCCAeWgAwIBAgIEHmXAPTAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
|
||||
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
|
||||
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
|
||||
MTAyMDIxMjE1MzJaFw00OTEyMzExMjE1MzJaMGMxCzAJBgNVBAYTAkNOMRQwEgYD
|
||||
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEjMCEG
|
||||
A1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwdjAQBgcqhkjOPQIBBgUr
|
||||
gQQAIgNiAAQhnu7Hna8XNa2KyqRf5+lBJScE4xqf89N0g0OuqAb2re8nGsvWkw26
|
||||
uDekfnBYicd+G3Cydqa2zFIwV7Talyg2ULW3r8KbGpyl84mJEPPRmCGJ+H9gtCsf
|
||||
+OrJ4Y76LVWjYzBhMB8GA1UdIwQYMBaAFBc6EKGrGXzlAE+s0Zgnsphadw7NMA8G
|
||||
A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTbhrciFtUL
|
||||
oUu33SV7ufEFfaItRzAMBggqhkjOPQQDAwUAA2gAMGUCMG3cXjiDmXTvf7D4Omhf
|
||||
qcc2nuO+EMfWE+N9ZhBP5UhV34mAGWi3SfLU6rcV0urWEQIxAMYIb3epOnKhUrcm
|
||||
Lfu1WKzFlpYQwmw73RaCHP2I3k6NcuWOYeNwWXSNZ8o0nzvaLg==
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICMzCCAbegAwIBAgIEaOC/zDAMBggqhkjOPQQDAwUAMGMxCzAJBgNVBAYTAkNO
|
||||
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
|
||||
bTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjEwMjAy
|
||||
MTIxOTMxWhcNNDkxMjMxMTIxOTMxWjBoMQswCQYDVQQGEwJDTjEUMBIGA1UEChML
|
||||
T3Blbkhhcm1vbnkxGTAXBgNVBAsTEE9wZW5IYXJtb255IFRlYW0xKDAmBgNVBAMT
|
||||
H09wZW5IYXJtb255IEFwcGxpY2F0aW9uIFJlbGVhc2UwWTATBgcqhkjOPQIBBggq
|
||||
hkjOPQMBBwNCAATbYOCQQpW5fdkYHN45v0X3AHax12jPBdEDosFRIZ1eXmxOYzSG
|
||||
JwMfsHhUU90E8lI0TXYZnNmgM1sovubeQqATo1IwUDAfBgNVHSMEGDAWgBTbhrci
|
||||
FtULoUu33SV7ufEFfaItRzAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYEFPtxruhl
|
||||
cRBQsJdwcZqLu9oNUVgaMAwGCCqGSM49BAMDBQADaAAwZQIxAJta0PQ2p4DIu/ps
|
||||
LMdLCDgQ5UH1l0B4PGhBlMgdi2zf8nk9spazEQI/0XNwpft8QAIwHSuA2WelVi/o
|
||||
zAlF08DnbJrOOtOnQq5wHOPlDYB4OtUzOYJk9scotrEnJxJzGsh/
|
||||
-----END CERTIFICATE-----
|
BIN
CertificateManager/signature/certmanager.p7b
Normal file
@ -0,0 +1 @@
|
||||
<EFBFBD>Я@И<0E>м?ЫіЯEЩ
|
@ -0,0 +1 @@
|
||||
<EFBFBD>7h<EFBFBD><EFBFBD>&<26><>|)?<3F><>
|
@ -0,0 +1 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><11>k<EFBFBD>R[|<7C>8<11>O[
|
@ -0,0 +1 @@
|
||||
o «5ehì¾è.Ð<>O
|
176
LICENSE
Normal file
@ -0,0 +1,176 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
66
OAT.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README.
|
||||
All configurations in this file will be merged to OAT-Default.xml, if you have any questions or concerns, please create issue in OpenHarmony/tools_oat and @jalenchen or chenyaxun.
|
||||
|
||||
licensefile:
|
||||
1.If the project don't have "LICENSE" in root dir, please define all the license files in this project in , OAT will check license files according to this rule.
|
||||
|
||||
policylist:
|
||||
1. policy: If the OAT-Default.xml policies do not meet your requirements, please add policies here.
|
||||
2. policyitem: The fields type, name, path, desc is required, and the fields rule, group, filefilter is optional,the default value is:
|
||||
<policyitem type="" name="" path="" desc="" rule="may" group="defaultGroup" filefilter="defaultPolicyFilter"/>
|
||||
3. policyitem type:
|
||||
"compatibility" is used to check license compatibility in the specified path;
|
||||
"license" is used to check source license header in the specified path;
|
||||
"copyright" is used to check source copyright header in the specified path;
|
||||
"import" is used to check source dependency in the specified path, such as import ... ,include ...
|
||||
"filetype" is used to check file type in the specified path, supported file types: archive, binary
|
||||
"filename" is used to check whether the specified file exists in the specified path(projectroot means the root dir of the project), supported file names: LICENSE, README, README.OpenSource
|
||||
4. policyitem name: This field is used for define the license, copyright, "*" means match all, the "!" prefix means could not match this value. For example, "!GPL" means can not use GPL license.
|
||||
5. policyitem path: This field is used for define the source file scope to apply this policyitem, the "!" prefix means exclude the files. For example, "!.*/lib/.*" means files in lib dir will be exclude while process this policyitem.
|
||||
6. policyitem rule and group: These two fields are used together to merge policy results. "may" policyitems in the same group means any one in this group passed, the result will be passed.
|
||||
7. policyitem filefilter: Used to bind filefilter which define filter rules.
|
||||
7. policyitem desc: Used to describe the reason of this policy item, committers will check this while merging the code.
|
||||
8. filefilter: Filter rules, the type filename is used to filter file name, the type filepath is used to filter file path.
|
||||
|
||||
Note:If the text contains special characters, please escape them according to the following rules:
|
||||
" == >
|
||||
& == >
|
||||
' == >
|
||||
< == >
|
||||
> == >
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<oatconfig>
|
||||
<policylist>
|
||||
<policy name="projectPolicy" desc="">
|
||||
</policy>
|
||||
</policylist>
|
||||
<filefilterlist>
|
||||
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||
<filteritem type="filepath" name="CertificateManager/AppScope/resources/base/media/app_icon.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="CertificateManager/product/phone/src/main/resources/base/media/icon.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="CertificateManager/doc/image/image-20220727141455437.png" desc="self developed image"/>
|
||||
</filefilter>
|
||||
<filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies">
|
||||
</filefilter>
|
||||
<filefilter name="defaultPolicyFilter" desc="Filters for LICENSE file policies">
|
||||
</filefilter>
|
||||
</filefilterlist>
|
||||
</oatconfig>
|
||||
</configuration>
|
41
README.md
@ -1,39 +1,12 @@
|
||||
# security_privacy_center
|
||||
# 安全隐私中心
|
||||
|
||||
#### 介绍
|
||||
{**以下是 Gitee 平台说明,您可以替换此简介**
|
||||
Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台
|
||||
无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
|
||||
## 简介
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
### 内容介绍
|
||||
|
||||
安全隐私中心模块包含提供安全和隐私保护能力的系统应用。
|
||||
|
||||
|
||||
#### 安装教程
|
||||
### 目录
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
[证书管理](CertificateManager/readme.md)
|
||||
|