| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| AppScope/ | 22-Oct-2025 | - | 35 | 32 | ||
| entry/ | 22-Oct-2025 | - | 974 | 897 | ||
| hvigor/ | 22-Oct-2025 | - | 38 | 36 | ||
| screenshots/ | 22-Oct-2025 | - | ||||
| .gitignore | D | 22-Oct-2025 | 133 | 12 | 12 | |
| README.md | D | 22-Oct-2025 | 3 KiB | 73 | 53 | |
| build-profile.json5 | D | 22-Oct-2025 | 1.4 KiB | 58 | 57 | |
| code-linter.json5 | D | 22-Oct-2025 | 958 | 35 | 34 | |
| hvigorfile.ts | D | 22-Oct-2025 | 843 | 22 | 5 | |
| oh-package.json5 | D | 22-Oct-2025 | 834 | 26 | 24 | |
| ohosTest.md | D | 22-Oct-2025 | 1.1 KiB | 11 | 9 |
README.md
1# 使用SM2非对称密钥加解密及密文格式转换 2 3### 介绍 4 5本示例主要展示了使用SM2非对称密钥加解密及密文格式转换场景 。该工程中展示的代码详细描述可查如下链接。 6 7- [使用SM2非对称密钥加解密](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/CryptoArchitectureKit/crypto-sm2-asym-encrypt-decrypt.md) 8- [使用SM2密文格式转换](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/CryptoArchitectureKit/crypto-sm2-ciphertext-conversion.md) 9 10### 效果预览 11 12| 首页效果图 | 执行结果图 | 13| ------------------------------------------------------------ | ------------------------------------------------------------ | 14| <img src="./screenshots/EncryptionDecryptionGuidanceSM21.png" style="zoom: 50%;" /> | <img src="./screenshots/EncryptionDecryptionGuidanceSM22.png" style="zoom: 50%;" /> | 15 16### 使用说明 17 181. 运行Index主界面。 192. 页面呈现上述执行结果图效果,点击不同按钮可以跳转到不同功能页面,点击跳转页面中按钮可以执行对应操作,并更新文本内容。 203. 运行测试用例EncryptionDecryptionGuidanceSM2.test.ets文件对页面代码进行测试可以全部通过。 21 22### 工程目录 23 24``` 25entry/src/ 26 ├── main 27 │ ├── ets 28 │ │ ├── entryability 29 │ │ ├── entrybackupability 30 │ │ ├── pages 31 │ │ ├── Index.ets // 使用SM2非对称密钥加解密及密文格式转换示例代码 32 │ │ ├── sm2 33 │ │ | ├── CreateASN.1Ciphertext.ets 34 │ │ | ├── ObtainCiphertext.ets 35 │ │ | ├── SM2EncryptionDecryptionAsync.ets 36 │ │ | ├── SM2EncryptionDecryptionSync.ets 37 │ ├── module.json5 38 │ └── resources 39 ├── ohosTest 40 │ ├── ets 41 │ │ └── test 42 │ │ ├── Ability.test.ets 43 │ │ ├── EncryptionDecryptionGuidanceSM2.test.ets // 自动化测试代码 44 │ │ └── List.test.ets 45``` 46 47### 相关权限 48 49不涉及。 50 51### 依赖 52 53不涉及。 54 55### 约束与限制 56 571.本示例仅支持标准系统上运行, 支持设备:RK3568。 58 592.本示例为Stage模型,支持API14版本SDK,版本号:5.0.2.57,镜像版本号:OpenHarmony_5.0.2.58。 60 613.本示例需要使用DevEco Studio 5.0.1 Release (Build Version: 5.0.5.306, built on December 6, 2024)及以上版本才可编译运行。 62 63### 下载 64 65如需单独下载本工程,执行如下命令: 66 67```` 68git init 69git config core.sparsecheckout true 70echo code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM2 > .git/info/sparse-checkout 71git remote add origin https://gitee.com/openharmony/applications_app_samples.git 72git pull origin master 73````