1e41f4b71Sopenharmony_ci# Encryption and Decryption Overview and Algorithm Specifications 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciYou can use the keys in HUKS to encrypt or decrypt data. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci## Supported Algorithms 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciThe following table lists the supported specifications for key encryption and decryption. 8e41f4b71Sopenharmony_ci<!--Del--> 9e41f4b71Sopenharmony_ciThe key management service specifications include mandatory specifications and optional specifications. Mandatory specifications are algorithm specifications that must be supported. Optional specifications can be used based on actual situation. Before using the optional specifications, refer to the documents provided by the vendor to ensure that the specifications are supported. 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci**You are advised to use mandatory specifications in your development for compatibility purposes.** 12e41f4b71Sopenharmony_ci<!--DelEnd--> 13e41f4b71Sopenharmony_ci**Specifications for Standard-System Devices** 14e41f4b71Sopenharmony_ci| Algorithm/Cipher Mode/Padding Mode| Description| API Version| <!--DelCol4-->Mandatory| 15e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 16e41f4b71Sopenharmony_ci| <!--DelRow-->AES/ECB/NoPadding<br>AES/ECB/PKCS7 | - | 8+ | No| 17e41f4b71Sopenharmony_ci| AES/CBC/NoPadding<br>AES/CBC/PKCS7<br>AES/CTR/NoPadding | The **IV** parameter is mandatory.| 8+ | Yes| 18e41f4b71Sopenharmony_ci| AES/GCM/NoPadding | **Nonce** is mandatory for encryption.<br>**Nonce** and **AEAD** are mandatory for decryption.| 8+ | Yes| 19e41f4b71Sopenharmony_ci| RSA/ECB/NoPadding<br>RSA/ECB/PKCS1_V1_5<br>RSA/ECB/OAEP | The OAEP padding mode supports the following MD algorithms: SHA-256, SHA-384, and SHA-512.| 8+ | Yes| 20e41f4b71Sopenharmony_ci| <!--DelRow-->SM4/ECB/NoPadding<br>SM4/ECB/PKCS7<br>SM4/CBC/PKCS7 | **IV** is mandatory in CBC mode and is not recommended in ECB mode.| 9+ | No| 21e41f4b71Sopenharmony_ci| SM4/CTR/NoPadding<br>SM4/CBC/NoPadding<br>SM4/CFB/NoPadding | **IV** is mandatory.| 12+ | Yes| 22e41f4b71Sopenharmony_ci| SM4/OFB/NoPadding | **Nonce** is mandatory.| 12+ | Yes| 23e41f4b71Sopenharmony_ci| SM2/-/NoPadding | SM3 is used as the MD algorithm.| 11+ | Yes| 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci**Specifications for Mimi-System Devices** 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci<!--Del--> 28e41f4b71Sopenharmony_ciBefore implementing the specifications for mini-system devices, determine whether your device supports the related specifications. 29e41f4b71Sopenharmony_ci<!--DelEnd--> 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci| Algorithm/Cipher Mode/Padding Mode| Description| API Version| 32e41f4b71Sopenharmony_ci| -------- | -------- | -------- | 33e41f4b71Sopenharmony_ci| AES/GCM/NoPadding | - | 8+ | 34e41f4b71Sopenharmony_ci| AES/CBC/NoPadding<br>AES/CTR/NoPadding | **IV** is mandatory.| 11+ | 35e41f4b71Sopenharmony_ci| DES/ECB/NoPadding | - | 12+ | 36e41f4b71Sopenharmony_ci| DES/CBC/NoPadding | **IV** is mandatory.| 12+ | 37e41f4b71Sopenharmony_ci| 3DES/ECB/NoPadding | - | 12+ | 38e41f4b71Sopenharmony_ci| 3DES/CBC/NoPadding | **IV** is mandatory.| 12+ | 39e41f4b71Sopenharmony_ci| RSA/ECB/PKCS1_V1_5 | - | 12+ | 40e41f4b71Sopenharmony_ci| RSA/ECB/OAEP | SHA-256 is used as the MD algorithm.| 12+ | 41