harmony 鸿蒙crypto_sym_cipher.h

  • 2025-06-12
  • 浏览 (5)

crypto_sym_cipher.h

Overview

Provides APIs for symmetric encryption and decryption.

Library: libohcrypto.so

System capability: SystemCapability.Security.CryptoFramework

Since: 12

Related module: CryptoSymCipherApi

Summary

Types

Name Description
typedef struct OH_CryptoSymCipher OH_CryptoSymCipher Defines a symmetric encryption and decryption instance.
typedef struct OH_CryptoSymCipherParams OH_CryptoSymCipherParams Defines symmetric encryption and decryption parameters.

Enums

Name Description
CryptoSymCipher_ParamsType {
CRYPTO_IV_DATABLOB = 100,
CRYPTO_AAD_DATABLOB = 101,
CRYPTO_TAG_DATABLOB = 102
}
Enumerates the types of symmetric encryption and decryption parameters.

Functions

Name Description
OH_Crypto_ErrCode OH_CryptoSymCipherParams_Create (OH_CryptoSymCipherParams **params) Creates a symmetric encryption/decryption parameter instance.
OH_Crypto_ErrCode OH_CryptoSymCipherParams_SetParam (OH_CryptoSymCipherParams *params, CryptoSymCipher_ParamsType paramsType, Crypto_DataBlob *value) Sets symmetric encryption/decryption parameters.
void OH_CryptoSymCipherParams_Destroy (OH_CryptoSymCipherParams *params) Destroys a symmetric encryption/decryption parameter instance.
OH_Crypto_ErrCode OH_CryptoSymCipher_Create (const char *algoName, OH_CryptoSymCipher **ctx) Creates a symmetric encryption/decryption instance based on the given algorithm name.
OH_Crypto_ErrCode OH_CryptoSymCipher_Init (OH_CryptoSymCipher *ctx, Crypto_CipherMode mod, OH_CryptoSymKey *key, OH_CryptoSymCipherParams *params) Initializes a symmetric encryption/decryption instance.
OH_Crypto_ErrCode OH_CryptoSymCipher_Update (OH_CryptoSymCipher *ctx, Crypto_DataBlob *in, Crypto_DataBlob *out) Updates the data to be encrypted or decrypted.
OH_Crypto_ErrCode OH_CryptoSymCipher_Final (OH_CryptoSymCipher *ctx, Crypto_DataBlob *in, Crypto_DataBlob *out) Finishes the encryption or decryption operation.
const char * OH_CryptoSymCipher_GetAlgoName (OH_CryptoSymCipher *ctx) Obtains the symmetric encryption/decryption algorithm.
void OH_CryptoSymCipher_Destroy (OH_CryptoSymCipher *ctx) Destroys a symmetric encryption/decryption instance.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Crypto Architecture Kit (Crypto Architecture Service)

harmony 鸿蒙Crypto_DataBlob

harmony 鸿蒙CryptoAsymKeyApi

harmony 鸿蒙CryptoCommonApi

harmony 鸿蒙CryptoDigestApi

harmony 鸿蒙CryptoSignatureApi

harmony 鸿蒙CryptoSymCipherApi

harmony 鸿蒙CryptoSymKeyApi

harmony 鸿蒙crypto_asym_key.h

harmony 鸿蒙crypto_common.h

0  赞