1e41f4b71Sopenharmony_ci# Asymmetric Key Encryption and Decryption Algorithm Specifications
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ciThis topic describes the supported algorithms and specifications for asymmetric key encryption and decryption.
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciFor details about the cipher modes supported by each algorithm, see the specifications of each algorithm.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## RSA
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci[RSA](crypto-asym-key-generation-conversion-spec.md#rsa) is an asymmetric cipher, with fixed-length blocks. If the data length does not meet the requirement, padding is required.
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ciThe Crypto framework supports the following padding modes for RSA encryption and decryption:
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci- [NoPadding](#nopadding): No padding. The length of the input or output data must be the same as that of the RSA modulus (**n** in bytes).
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci- [PKCS1](#pkcs1): RSAES-PKCS1-V1_5 mode in RFC3447, corresponding to RSA_PKCS1_PADDING in OpenSSL.
19e41f4b71Sopenharmony_ci  
20e41f4b71Sopenharmony_ci  The RSA converts the source data (**D**) into encryption blocks (EBs). In encryption, the length of the input data must be less than or equal to the RSA modulus minus 11. The length of the output data is the same as that of the RSA modulus.
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci- [PKCS1_OAEP](#pkcs1_oaep): RSAES-OAEP mode in RFC 3447, corresponding to RSA_PKCS1_OAEP_PADDING in OpenSSL.
23e41f4b71Sopenharmony_ci  
24e41f4b71Sopenharmony_ci  In this mode, two message digests (**md** and **mgf1_md**) need to be set. In encryption, the input data must meet the following requirements:<br>Input data length < RSA modulus length – **md** length (bytes) – **mgf1_md** length (bytes) – 2<br>The length of the output data is the same as that of the RSA modulus.
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci  You can also set the **pSource** byte stream to define the encoding input for OAEP padding and obtain the PKCS1_OAEP parameters (as listed in the following table).
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci  | PKCS1_OAEP Parameter| Description|
29e41f4b71Sopenharmony_ci  | -------- | -------- |
30e41f4b71Sopenharmony_ci  | md | MD algorithm.|
31e41f4b71Sopenharmony_ci  | mgf | Mask generation function. Currently, only MGF1 is supported.|
32e41f4b71Sopenharmony_ci  | mgf1_md | MD algorithm used in MGF1.|
33e41f4b71Sopenharmony_ci  | pSource | byte stream, which is the source for encoding input P in OAEP padding.|
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci> **NOTE**
36e41f4b71Sopenharmony_ci>
37e41f4b71Sopenharmony_ci> It takes time to generate an RSA2048, RSA3072, RSA4096, or RSA8192 asymmetric key pair or when the plaintext length exceeds 2048 bits. Since the execution of the main thread has a time limit, the operation may fail if you use a synchronous API. You are advised to use asynchronous APIs or use [multithread concurrent tasks](../../arkts-utils/multi-thread-concurrency-overview.md) to generate a key of a large size.
38e41f4b71Sopenharmony_ci>
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci### NoPadding
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ciThe RSA encryption and decryption can be implemented based a string parameter. When creating a **Cipher** instance, you need to specify the algorithm specifications in a string parameter. The string parameter consists of the asymmetric key type and padding mode (which is **NoPadding**) with a vertical bar (|) in between.
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci| Asymmetric Key Type| String Parameter| API Version|
45e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
46e41f4b71Sopenharmony_ci| RSA512 | RSA512\|NoPadding | 9+ |
47e41f4b71Sopenharmony_ci| RSA768 | RSA768\|NoPadding | 9+ |
48e41f4b71Sopenharmony_ci| RSA1024 | RSA1024\|NoPadding | 9+ |
49e41f4b71Sopenharmony_ci| RSA2048 | RSA2048\|NoPadding | 9+ |
50e41f4b71Sopenharmony_ci| RSA3072 | RSA3072\|NoPadding | 9+ |
51e41f4b71Sopenharmony_ci| RSA4096 | RSA4096\|NoPadding | 9+ |
52e41f4b71Sopenharmony_ci| RSA8192 | RSA8192\|NoPadding | 9+ |
53e41f4b71Sopenharmony_ci| RSA | RSA\|NoPadding | 10+ |
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ciAs indicated by the last row in the preceding table, you can specify the RSA key type without the key length to ensure compatibility with the key generated based on the key parameter. In this case, the encryption or decryption operation varies depending on the actual key length.
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci### PKCS1
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ciThe RSA encryption and decryption can be implemented based a string parameter. When creating a **Cipher** instance, you need to specify the algorithm specifications in a string parameter. The string parameter consists of the asymmetric key type and padding mode (which is **PKCS1**) with a vertical bar (|) in between.
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci| Asymmetric Key Type| String Parameter| API Version|
63e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
64e41f4b71Sopenharmony_ci| RSA512 | RSA512\|PKCS1 | 9+ |
65e41f4b71Sopenharmony_ci| RSA768 | RSA768\|PKCS1 | 9+ |
66e41f4b71Sopenharmony_ci| RSA1024 | RSA1024\|PKCS1 | 9+ |
67e41f4b71Sopenharmony_ci| RSA2048 | RSA2048\|PKCS1 | 9+ |
68e41f4b71Sopenharmony_ci| RSA3072 | RSA3072\|PKCS1 | 9+ |
69e41f4b71Sopenharmony_ci| RSA4096 | RSA4096\|PKCS1 | 9+ |
70e41f4b71Sopenharmony_ci| RSA8192 | RSA8192\|PKCS1 | 9+ |
71e41f4b71Sopenharmony_ci| RSA | RSA\|PKCS1 | 10+ |
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ciAs indicated by the last row in the preceding table, you can specify the RSA key type without the key length to ensure compatibility with the key generated based on the key parameter. In this case, the encryption or decryption operation varies depending on the actual key length.
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci### PKCS1_OAEP
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ciThe RSA encryption and decryption can be implemented based a string parameter. When creating a **Cipher** instance, you need to specify the algorithm specifications in a string parameter. The string parameter consists of the asymmetric key type, padding mode (which is **PKCS1_OAEP**), MD algorithm, and mask digest algorithm with a vertical bar (|) in between.
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ciIn the following table, the options included in the square brackets ([]) are mutually exclusive. You can use only one of them in a string parameter.
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ciFor example, if the asymmetric key type is **RSA2048**, the padding mode is **PKCS1_OAEP**, the MD algorithm is **SHA256**, and the mask digest algorithm is **MGF1_SHA256**, the string parameter is **RSA2048|PKCS1_OAEP|SHA256|MGF1\_SHA256**.
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ci> **NOTE**
85e41f4b71Sopenharmony_ci> Input data length < RSA key modulus – **md** length – **mgf1_md** length – 2<br> For example, if the RSA key is of 512 bits, **SHA512** cannot be used.
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci| Asymmetric Key Type| Padding Mode| MD Algorithm| Mask Digest Algorithm| API Version|
88e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
89e41f4b71Sopenharmony_ci| RSA512 | PKCS1_OAEP | MD5 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256] | 9+ |
90e41f4b71Sopenharmony_ci| RSA512 | PKCS1_OAEP | SHA1 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256] | 9+ |
91e41f4b71Sopenharmony_ci| RSA512 | PKCS1_OAEP | SHA224 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256] | 9+ |
92e41f4b71Sopenharmony_ci| RSA768 | PKCS1_OAEP | MD5 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
93e41f4b71Sopenharmony_ci| RSA768 | PKCS1_OAEP | SHA1 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
94e41f4b71Sopenharmony_ci| RSA768 | PKCS1_OAEP | SHA224 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
95e41f4b71Sopenharmony_ci| RSA768 | PKCS1_OAEP | SHA256 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384] | 9+ |
96e41f4b71Sopenharmony_ci| RSA1024 | PKCS1_OAEP | MD5 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
97e41f4b71Sopenharmony_ci| RSA1024 | PKCS1_OAEP | SHA1 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
98e41f4b71Sopenharmony_ci| RSA1024 | PKCS1_OAEP | SHA224 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
99e41f4b71Sopenharmony_ci| RSA1024 | PKCS1_OAEP | SHA256 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
100e41f4b71Sopenharmony_ci| RSA1024 | PKCS1_OAEP | SHA384 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
101e41f4b71Sopenharmony_ci| RSA2048 | PKCS1_OAEP | MD5 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
102e41f4b71Sopenharmony_ci| RSA2048 | PKCS1_OAEP | SHA1 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
103e41f4b71Sopenharmony_ci| RSA2048 | PKCS1_OAEP | SHA224 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
104e41f4b71Sopenharmony_ci| RSA2048 | PKCS1_OAEP | SHA256 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
105e41f4b71Sopenharmony_ci| RSA2048 | PKCS1_OAEP | SHA384 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
106e41f4b71Sopenharmony_ci| RSA2048 | PKCS1_OAEP | SHA512 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
107e41f4b71Sopenharmony_ci| RSA3072 | PKCS1_OAEP | MD5 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
108e41f4b71Sopenharmony_ci| RSA3072 | PKCS1_OAEP | SHA1 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
109e41f4b71Sopenharmony_ci| RSA3072 | PKCS1_OAEP | SHA224 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
110e41f4b71Sopenharmony_ci| RSA3072 | PKCS1_OAEP | SHA256 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
111e41f4b71Sopenharmony_ci| RSA3072 | PKCS1_OAEP | SHA384 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
112e41f4b71Sopenharmony_ci| RSA3072 | PKCS1_OAEP | SHA512 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
113e41f4b71Sopenharmony_ci| RSA4096 | PKCS1_OAEP | MD5 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
114e41f4b71Sopenharmony_ci| RSA4096 | PKCS1_OAEP | SHA1 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
115e41f4b71Sopenharmony_ci| RSA4096 | PKCS1_OAEP | SHA224 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
116e41f4b71Sopenharmony_ci| RSA4096 | PKCS1_OAEP | SHA256 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
117e41f4b71Sopenharmony_ci| RSA4096 | PKCS1_OAEP | SHA384 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
118e41f4b71Sopenharmony_ci| RSA4096 | PKCS1_OAEP | SHA512 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
119e41f4b71Sopenharmony_ci| RSA8192 | PKCS1_OAEP | MD5 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
120e41f4b71Sopenharmony_ci| RSA8192 | PKCS1_OAEP | SHA1 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
121e41f4b71Sopenharmony_ci| RSA8192 | PKCS1_OAEP | SHA224 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
122e41f4b71Sopenharmony_ci| RSA8192 | PKCS1_OAEP | SHA256 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
123e41f4b71Sopenharmony_ci| RSA8192 | PKCS1_OAEP | SHA384 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
124e41f4b71Sopenharmony_ci| RSA8192 | PKCS1_OAEP | SHA512 | [MGF1_MD5\|MGF1_SHA1\|MGF1_SHA224\|MGF1_SHA256\|MGF1_SHA384\|MGF1_SHA512] | 9+ |
125e41f4b71Sopenharmony_ci| RSA | PKCS1_OAEP | MD algorithm that meets the length requirements| MGF1_ MD algorithm that meets the length requirements| 10+ |
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ciAs indicated by the last row in the preceding table, you can specify the RSA key type without the key length to ensure compatibility with the key generated based on the key parameter. In this case, the encryption or decryption operation varies depending on the actual key length.
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ci### Getting and Setting of OAEP Parameters
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ciSince API version 10, OAEP parameters can be set and obtained when PKCS1_OAEP is used with RSA. In ths following table, the symbol "√" indicates that the parameter can be obtained or set.
133e41f4b71Sopenharmony_ci
134e41f4b71Sopenharmony_ci| OAEP Parameter| Value| Get| Set|
135e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
136e41f4b71Sopenharmony_ci| md | OAEP_MD_NAME_STR | √ | - |
137e41f4b71Sopenharmony_ci| mgf | OAEP_MGF_NAME_STR | √ | - |
138e41f4b71Sopenharmony_ci| mgf1_md | OAEP_MGF1_MD_STR | √ | - |
139e41f4b71Sopenharmony_ci| pSource | OAEP_MGF1_PSRC_UINT8ARR | √ | √ |
140e41f4b71Sopenharmony_ci
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci## SM2
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_ci[SM2](crypto-asym-key-generation-conversion-spec.md#sm2) is an asymmetric encryption algorithm with a fixed length. Currently, the Crypto framework supports data encryption and decryption in the format defined in GM/T 0009-2012.
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ciThe SM2 asymmetric encryption result consists of C1, C2, and C3. C1 is the elliptic curve points calculated based on the random number generated. C2 is the ciphertext data. C3 is the value calculated using the specified MD algorithm.
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ciSM2 encryption and decryption can be implemented based on a string parameter. When creating a **Cipher** instance, you need to specify the algorithm specifications in a string parameter. The string parameter consists of the asymmetric key type (algorithm_key length) and padding mode with a vertical bar (|) in between.
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_ciIn the following table, the options included in the square brackets ([]) are mutually exclusive. You can use only one of them in a string parameter. The SM2 algorithm and key length are separated by an underscore (_).
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ciFor example, if the key length is 256 bits and the digest algorithm is MD5, the string parameter is **SM2_256|MD5**.
153e41f4b71Sopenharmony_ci| Asymmetric Key Type| MD Algorithm| API Version|
154e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
155e41f4b71Sopenharmony_ci| SM2_256 | [MD5\|SHA1\|SHA224\|SHA256\|SHA384\|SHA512\|SM3] | 10+ |
156e41f4b71Sopenharmony_ci| SM2 | [MD5\|SHA1\|SHA224\|SHA256\|SHA384\|SHA512\|SM3] | 10+ |
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ciAs indicated by the last row in the preceding table, you can specify the SM2 key type without the key length to ensure compatibility with the key generated based on the key parameter. In this case, the encryption or decryption operation varies depending on the actual key length.
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci
161e41f4b71Sopenharmony_ci### SM2 MD Algorithm Parameter
162e41f4b71Sopenharmony_ci
163e41f4b71Sopenharmony_ciSince API version 11, SM2 MD digest algorithm parameter can be obtained. The symbol "√" indicates that the parameter can be obtained or set.
164e41f4b71Sopenharmony_ci
165e41f4b71Sopenharmony_ci| SM2 MD Algorithm Parameter| Value| Get| Set|
166e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
167e41f4b71Sopenharmony_ci| md | SM2_MD_NAME_STR | √ | - |
168e41f4b71Sopenharmony_ci
169e41f4b71Sopenharmony_ci
170e41f4b71Sopenharmony_ci### SM2 Ciphertext Format
171e41f4b71Sopenharmony_ci
172e41f4b71Sopenharmony_ciSince API version 12, SM2 format conversion is supported. Currently, the SM2 ciphertext is in ASN.1 format, in which the parameters are in the **C1C3C2** order.
173e41f4b71Sopenharmony_ci
174e41f4b71Sopenharmony_ciYou can convert the SM2 ciphertext into ASN.1 format based on the SM2 parameters specified or obtain SM2 parameters from the SM2 ciphertext in ASN.1 format.
175e41f4b71Sopenharmony_ci
176e41f4b71Sopenharmony_ciSM2 ciphertext consists of the following parameters:
177e41f4b71Sopenharmony_ci
178e41f4b71Sopenharmony_ci- **xCoordinate**: coordinate X of C1, that is, **C1_X**.
179e41f4b71Sopenharmony_ci
180e41f4b71Sopenharmony_ci- **yCoordinate**: coordinate Y of C1, that is, **C1_Y**. You can obtain **C1** based on **xCoordinate** and **yCoordinate**. **C1** is a point on the elliptic curve generated using a random number.
181e41f4b71Sopenharmony_ci
182e41f4b71Sopenharmony_ci- **cipherTextData**: ciphertext, that is, **C2**.
183e41f4b71Sopenharmony_ci
184e41f4b71Sopenharmony_ci- **hashData**: hash value, that is, **C3**.
185e41f4b71Sopenharmony_ci
186e41f4b71Sopenharmony_ciA string parameter can be used to specify the SM2 ciphertext format conversion mode.
187e41f4b71Sopenharmony_ci
188e41f4b71Sopenharmony_ci| SM2 Ciphertext Format Conversion Mode| Generate SM2 Ciphertext Based on Parameters| Obtain Parameters from SM2 Ciphertext|
189e41f4b71Sopenharmony_ci| --------  | -------- | -------- |
190e41f4b71Sopenharmony_ci| C1C3C2 | √ | √ |
191