• Home
Name Date Size #Lines LOC

..--

AppScope/12-May-2024-5449

entry/12-May-2024-1,2191,061

screenshots/device/12-May-2024-

.gitignoreD12-May-2024142 1111

README.mdD12-May-20241.5 KiB3819

README_zh.mdD12-May-20241.7 KiB4524

build-profile.json5D12-May-20241 KiB4341

hvigorfile.tsD12-May-2024158 21

package.jsonD12-May-2024369 1818

README.md

1# Cipher
2
3### Introduction
4
5This sample shows how to use cipher algorithms, including Rivest-Shamir-Adleman (RSA) and Advanced Encryption Standard (AES). The display effect is as follows:
6
7![](screenshots/device/index_en.png) ![](screenshots/device/encrypt_en.png) ![](screenshots/device/decrypt_en.png)
8
9### Concepts
10
11RSA: A public-key cryptosystem that works on two different keys: a public encryption key and a private decryption key.
12
13AES: A block encryption standard established by the U.S. National Institute of Standards and technology (NIST). It is also called Rijndael.
14
15### Required Permissions
16
17N/A.
18
19### Usage
20
211. On the home screen, touch the **Encrypt** button. On the **Encrypt** screen, select an encryption algorithm from the **Encryption Algorithm** drop-down list box, enter the content to be encrypted in the text box, and touch the **Encrypt** button.
22
23   The encrypted content is displayed in the text box below.
24
252. Touch the **Reset** button to clear the content in the text box.
26
273. Touch the **Decrypt** button on the home screen. On the **Decrypt** screen, select a decryption algorithm from the **Decryption Algorithm** drop-down list box, enter the content to be decrypted in the text box, and touch the **Decrypt** button.
28
29   The decrypted content is displayed in the text box below.
30
314. Touch the **Reset** button to clear the content in the text box.
32
33### Constraints
34
35- This sample can only be run on standard-system devices.
36
37- This sample requires DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100) to compile and run.
38

README_zh.md

1# 加解密
2
3### 介绍
4
5本示例使用[cipher](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-system-cipher.md)相关接口实现了字符串加解密算法,包括RSA加密算法与AES加密算法。
6
7RSA加密算法:RSA公开密钥密码体制是一种使用不同的加密密钥与解密密钥,由已知加密密钥推导出解密密钥在计算上是不可行的密码体制。
8
9AES加密算法:AES密码学中的高级加密标准,又称Rijndael加密法,是美国联邦政府采用的一种区块加密标准。
10
11使用说明
12
131.点击主页面的**加密**按钮,在加密界面中点击**Encryption Algorithm**下拉选择加密算法,在输入框中输入待加密的内容,点击**加密**
14按钮,下方文本框中显示加密后内容。
15
162.点击**重置**按钮,清除文本框中内容。
17
183.点击主页面的**解密**按钮,在解密界面中点击**Decrypt Algorithm**下拉选择解密算法,在输入框中输入待解密的内容,点击**解密**
19按钮,下方文本框中显示解密后内容。
20
214.点击**重置**按钮,清除文本框中内容。
22
23### 效果预览
24
25|主页|加密页面|解密页面|
26|--------------------------------|--------------------------------|--------------------------------|
27|![](screenshots/device/index.png)| ![](screenshots/device/encryption.png) |![](screenshots/device/decrypt.png)|
28
29### 相关权限
30
31不涉及。
32
33### 依赖
34
35不涉及。
36
37### 约束与限制
38
391.本示例仅支持在标准系统上运行。
40
412.本示例仅支持API9版本SDK,版本号:3.2.10.6。
42
433.本示例需要使用DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100)及以上才可编译运行。
44
45