307c31fc创建于 2024年12月31日历史提交

crypto_sym_key.h

概述

定义对称密钥接口。

库: libohcrypto.so

系统能力: SystemCapability.Security.CryptoFramework

起始版本: 12

相关模块:CryptoSymKeyApi

汇总

类型定义

名称 描述
typedef struct OH_CryptoSymKey OH_CryptoSymKey 定义对称密钥结构体。
typedef struct OH_CryptoSymKeyGenerator OH_CryptoSymKeyGenerator 定义对称密钥生成器结构体。

函数

名称 描述
OH_Crypto_ErrCode OH_CryptoSymKeyGenerator_Create (const char *algoName, OH_CryptoSymKeyGenerator **ctx) 根据给定的算法名称创建对称密钥生成器。
OH_Crypto_ErrCode OH_CryptoSymKeyGenerator_Generate (OH_CryptoSymKeyGenerator *ctx, OH_CryptoSymKey **keyCtx) 随机生成对称密钥。
OH_Crypto_ErrCode OH_CryptoSymKeyGenerator_Convert (OH_CryptoSymKeyGenerator *ctx, const Crypto_DataBlob *keyData, OH_CryptoSymKey **keyCtx) 将对称密钥数据转换为对称密钥。
const char * OH_CryptoSymKeyGenerator_GetAlgoName (OH_CryptoSymKeyGenerator *ctx) 获取对称密钥生成器的算法名称。
void OH_CryptoSymKeyGenerator_Destroy (OH_CryptoSymKeyGenerator *ctx) 销毁对称密钥生成器。
const char * OH_CryptoSymKey_GetAlgoName (OH_CryptoSymKey *keyCtx) 从对称密钥获取对称密钥算法名称。
OH_Crypto_ErrCode OH_CryptoSymKey_GetKeyData (OH_CryptoSymKey *keyCtx, Crypto_DataBlob *out) 从密钥实例获取对称密钥数据。
void OH_CryptoSymKey_Destroy (OH_CryptoSymKey *keyCtx) 销毁对称密钥实例。