> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
> The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```
```js
importcipherfrom'@system.cipher'
```
...
...
@@ -24,27 +23,27 @@ Encrypts or decrypts data using RSA.
| transformation | string | No | RSA algorithm padding. The default value is **RSA/None/OAEPWithSHA256AndMGF1Padding**. |
| success | Function | No | Called when data is encrypted or decrypted successfully. |
| fail | Function | No | Called when data fails to be encrypted or decrypted. |
| complete | Function | No | Called when the execution is complete. |
| action | string | Yes| Action to perform. The options are as follows:<br>- encrypt<br>- decrypt|
| text | string | Yes| Text to be encrypted or decrypted.<br> The text to be encrypted must be common text that meets the following requirement:<br> Maximum text length = Key length/8 - 66<br>For example, if the key is of 1024 bytes, the text to be encrypted cannot exceed 62 bytes (1024/8 -66 = 62).<br> The text to be decrypted must be binary text encoded in Base64. The default format is used for Base64 encoding.|
| key | string | Yes| RSA key. The key is used as a public key in encryption and a private key in decryption.|
| transformation | string | No| RSA padding. The default value is **RSA/None/OAEPWithSHA256AndMGF1Padding**.|
| success | Function | No| Called when data is encrypted or decrypted successful.|
| fail | Function | No| Called when data fails to be encrypted or decrypted.|
| complete | Function | No| Called when the execution is complete.|
| transformation | string | No | Encryption mode and padding of the AES algorithm. The default value is **AES/CBC/PKCS5Padding**. |
| iv | string | No | Initial vector for AES-based encryption and decryption. The value is a character string encoded using Base64. The default value is the key value. |
| ivOffset | string | No | Offset of the initial vector for AES-based encryption and decryption. The default value is **0**. |
| ivLen | string | No | Length of the initial vector for AES-based encryption and decryption. The default value is **16**. |
| success | Function | No | Called when data is encrypted or decrypted successfully. |
| fail | Function | No | Called when data fails to be encrypted or decrypted. |
| complete | Function | No | Called when the execution is complete. |
| action | string | Yes| Action to perform. The options are as follows:<br>- encrypt<br>- decrypt|
| text | string | Yes| Text to be encrypted or decrypted.<br> The text to be encrypted must be common text. The text to be decrypted must be binary text encoded in Base64. The default format is used for Base64 encoding.|
| key | string | Yes| Key used for encryption or decryption. It is a string encoded in Base64.|
| transformation | string | No| Encryption mode and padding of the AES algorithm. The default value is **AES/CBC/PKCS5Padding**.|
| iv | string | No| Initialization vector (IV) for AES-based encryption and decryption. The value is a string encoded in Base64. The default value is the key value.|
| ivOffset | string | No| Offset of the IV for AES-based encryption and decryption. The default value is **0**.|
| ivLen | string | No| Length of the IV for AES-based encryption and decryption, in bytes. The default value is **16**.|
| success | Function | No| Called when data is encrypted or decrypted successful.|
| fail | Function | No| Called when data fails to be encrypted or decrypted.|
| complete | Function | No| Called when the execution is complete.|