• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 使用ECC压缩/非压缩格式转换
2
3### 介绍
4
5可通过指定ECC公钥数据,生成公钥对象(PubKey);也可从公钥对象(PubKey)中,获取ECC公钥数据。当前仅支持ECC算法中,满足X509规范的压缩/非压缩格式的公钥数据。此处的公钥数据应当是完整的X509公钥,对于只使用点数据的情况.
6
7本示例主要展示了使用ECC压缩/非压缩公钥格式转换(ArkTS)、使用ECC压缩/非压缩公钥格式转换(C/C++)、使用ECC压缩/非压缩点格式转换场景。该工程中展示的代码详细描述可查如下链接中业务扩展场景介绍部分。
8
9- [使用ECC压缩/非压缩公钥格式转换(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/CryptoArchitectureKit/crypto-convert-compressed-or-uncompressed-ECC-pubkey.md)
10- [使用ECC压缩/非压缩公钥格式转换(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/CryptoArchitectureKit/crypto-convert-compressed-or-uncompressed-ECC-pubkey-ndk.md)
11- [使用ECC压缩/非压缩点格式转换](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/CryptoArchitectureKit/crypto-convert-compressed-or-uncompressed-ECC-point.md)
12
13### 效果预览
14
15| 首页效果图                                                   | 执行结果图                                                   |
16| ------------------------------------------------------------ | ------------------------------------------------------------ |
17| <img src="./screenshots/ECCCompressPublicKeyFormatConversion1.png" style="zoom: 50%;" /> | <img src="./screenshots/ECCCompressPublicKeyFormatConversion2.png" style="zoom: 50%;" /> |
18
19### 使用说明
20
211. 运行Index主界面。
222. 页面呈现上述执行结果图效果,点击不同按钮可以跳转到不同功能页面,点击跳转页面中按钮可以执行对应操作,并更新文本内容。
233. 运行测试用例ECCCompressPublicKeyFormatConversion.test.ets文件对页面代码进行测试可以全部通过。
24
25### 工程目录
26
27```
28entry/src/
29 ├── main
30 │   ├── cpp
31 │   │   ├── types
32 │   │   |   ├── libentry
33 │   │   |       ├── index.d.ts
34 │   │   |       ├── oh-package.json5
35 │   │   |   ├── project
36 │   │   |       ├── specifyUncompressedPublicKey.cpp
37 │   │   |       ├── file.h
38 │   │   ├── CMakeList.txt
39 │   │   ├── napi_init.cpp
40 │   ├── ets
41 │   │   ├── entryability
42 │   │   ├── entrybackupability
43 │   │   ├── pages
44 │   │       ├── Index.ets               // 使用ECC压缩/非压缩格式转换示例代码
45 │   │       ├── CompressedPointData.ets
46 │   │       ├── GetKeyObject.ets
47 │   │       ├── SpecifyUncompressedPublicKey.ets
48 │   ├── module.json5
49 │   └── resources
50 ├── ohosTest
51 │   ├── ets
52 │   │   └── test
53 │   │       ├── Ability.test.ets
54 │   │       ├── ECCCompressPublicKeyFormatConversion.test.ets  // 自动化测试代码
55 │   │       └── List.test.ets
56```
57
58### 相关权限
59
60不涉及。
61
62### 依赖
63
64不涉及。
65
66### 约束与限制
67
681.本示例仅支持标准系统上运行, 支持设备:RK3568。
69
702.本示例为Stage模型,支持API14版本SDK,版本号:5.0.2.57,镜像版本号:OpenHarmony_5.0.2.58。
71
723.本示例需要使用DevEco Studio 5.0.1 Release (Build Version: 5.0.5.306, built on December 6, 2024)及以上版本才可编译运行。
73
74### 下载
75
76如需单独下载本工程,执行如下命令:
77
78````
79git init
80git config core.sparsecheckout true
81echo code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/ECCCompressPublicKeyFormatConversion > .git/info/sparse-checkout
82git remote add origin https://gitee.com/openharmony/applications_app_samples.git
83git pull origin master
84````