1# CryptoCommonApi 2 3 4## Overview 5 6Provides common APIs for cryptographic operations. 7 8**Since**: 12 9 10 11## Summary 12 13 14### Files 15 16| Name | Description | 17| -------- | -------- | 18| [crypto_common.h](crypto__common_8h.md) | Defines common APIs for cryptographic operations. | 19 20 21### Structs 22 23| Name | Description | 24| -------- | -------- | 25| struct [Crypto_DataBlob](_crypto___data_blob.md) | Defines the data used for encryption and decryption. | 26 27 28### Types 29 30| Name | Description | 31| -------- | -------- | 32| typedef struct [Crypto_DataBlob](_crypto___data_blob.md) [Crypto_DataBlob](#crypto_datablob) | Defines a struct for the data used for encryption and decryption. | 33 34 35### Enums 36 37| Name | Description | 38| -------- | -------- | 39| [OH_Crypto_ErrCode](#oh_crypto_errcode) {<br>CRYPTO_SUCCESS = 0, CRYPTO_INVALID_PARAMS = 401,<br>CRYPTO_NOT_SUPPORT = 801, CRYPTO_MEMORY_ERROR = 17620001,<br>CRYPTO_OPERTION_ERROR = 17630001<br>} | Enumerates the encryption and decryption error codes. | 40| [Crypto_CipherMode](#crypto_ciphermode) {<br>CRYPTO_ENCRYPT_MODE = 0,<br>CRYPTO_DECRYPT_MODE = 1<br>} | Enumerates the cryptographic operation types. | 41 42 43### Functions 44 45| Name | Description | 46| -------- | -------- | 47| void [OH_Crypto_FreeDataBlob](#oh_crypto_freedatablob) ([Crypto_DataBlob](_crypto___data_blob.md) \*dataBlob) | Releases a **dataBlob** instance. | 48 49 50## Type Description 51 52 53### Crypto_DataBlob 54 55``` 56typedef struct Crypto_DataBlob Crypto_DataBlob 57``` 58 59**Description** 60 61Defines a struct for the data used for encryption and decryption. 62 63**Since**: 12 64 65 66## Enum Description 67 68 69### Crypto_CipherMode 70 71``` 72enum Crypto_CipherMode 73``` 74 75**Description** 76 77Enumerates the cryptographic operation types. 78 79**Since**: 12 80 81| Enum | Description | 82| -------- | -------- | 83| CRYPTO_ENCRYPT_MODE | Encrypt data. | 84| CRYPTO_DECRYPT_MODE | Decrypt data. | 85 86 87### OH_Crypto_ErrCode 88 89``` 90enum OH_Crypto_ErrCode 91``` 92 93**Description** 94 95Enumerates the encryption and decryption error codes. 96 97**Since**: 12 98 99| Enum | Description | 100| -------- | -------- | 101| CRYPTO_SUCCESS | The operation is successful. | 102| CRYPTO_INVALID_PARAMS | Invalid parameters are detected. | 103| CRYPTO_NOT_SUPPORT | The function or algorithm is not supported. | 104| CRYPTO_MEMORY_ERROR | A memory error occurred. | 105| CRYPTO_OPERTION_ERROR | The encryption or decryption operation fails. | 106 107 108## Function Description 109 110 111### OH_Crypto_FreeDataBlob() 112 113``` 114void OH_Crypto_FreeDataBlob (Crypto_DataBlob *dataBlob) 115``` 116 117**Description** 118 119Releases a **dataBlob** instance. 120 121**Since**: 12 122 123**Parameters** 124 125| Name | Description | 126| -------- | -------- | 127| dataBlob | Pointer to the **dataBlob** instance to release. | 128