1# crypto_common.h 2 3<!--Kit: Crypto Architecture Kit--> 4<!--Subsystem: Security--> 5<!--Owner: @zxz--3--> 6<!--Designer: @lanming--> 7<!--Tester: @PAFT--> 8<!--Adviser: @zengyawen--> 9 10## **Overview** 11 12Defines common APIs for cryptographic operations. 13 14**Header file**: <CryptoArchitectureKit/crypto_common.h> 15 16**Library**: libohcrypto.so 17 18**System capability**: SystemCapability.Security.CryptoFramework 19 20**Since**: 12 21 22**Related module**: [CryptoCommonApi](capi-cryptocommonapi.md) 23 24## Summary 25 26### Structs 27 28| Name| typedef Keyword| Description| 29| -- | -- | -- | 30| [Crypto_DataBlob](capi-cryptocommonapi-crypto-datablob.md) | Crypto_DataBlob | Defines the data used for encryption and decryption.| 31 32### Enums 33 34| Name| typedef Keyword| Description| 35| -- | -- | -- | 36| [OH_Crypto_ErrCode](#oh_crypto_errcode) | OH_Crypto_ErrCode | Enumerates the encryption and decryption error codes.| 37| [Crypto_CipherMode](#crypto_ciphermode) | Crypto_CipherMode | Enumerates the cryptographic operation types.| 38 39### Functions 40 41| Name| Description| 42| -- | -- | 43| [void OH_Crypto_FreeDataBlob(Crypto_DataBlob *dataBlob)](#oh_crypto_freedatablob) | Releases a **dataBlob** instance.| 44 45## Enum Description 46 47### OH_Crypto_ErrCode 48 49``` 50enum OH_Crypto_ErrCode 51``` 52 53**Description** 54 55Enumerates the encryption and decryption error codes. 56 57**Since**: 12 58 59| Enum Item| Description| 60| -- | -- | 61| CRYPTO_SUCCESS = 0 | The operation is successful.| 62| CRYPTO_INVALID_PARAMS = 401 | The input parameter is invalid.| 63| CRYPTO_NOT_SUPPORTED = 801 | The function or algorithm is not supported.| 64| CRYPTO_MEMORY_ERROR = 17620001 | Memory error.| 65| CRYPTO_PARAMETER_CHECK_FAILED = 17620003 | Parameter check failed.<br>**Since**: 20 | 66| CRYPTO_OPERTION_ERROR = 17630001 | The encryption or decryption operation fails.| 67 68### Crypto_CipherMode 69 70``` 71enum Crypto_CipherMode 72``` 73 74**Description** 75 76Enumerates the cryptographic operation types. 77 78**Since**: 12 79 80| Enum Item| Description| 81| -- | -- | 82| CRYPTO_ENCRYPT_MODE = 0 | Encryption.| 83| CRYPTO_DECRYPT_MODE = 1 | Decryption.| 84 85 86## Function Description 87 88### OH_Crypto_FreeDataBlob() 89 90``` 91void OH_Crypto_FreeDataBlob(Crypto_DataBlob *dataBlob) 92``` 93 94**Description** 95 96Releases a **dataBlob** instance. 97 98**Since**: 12 99 100 101**Parameters** 102 103| Name| Description| 104| -- | -- | 105| [Crypto_DataBlob](capi-cryptocommonapi-crypto-datablob.md) *dataBlob | Pointer to the **dataBlob** instance to release.| 106