harmony 鸿蒙crypto_key_agreement.h

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

crypto_key_agreement.h

概述

定义密钥协商接口。

库: libohcrypto.so

引用文件:

系统能力: SystemCapability.Security.CryptoFramework

起始版本: 20

相关模块: CryptoKeyAgreementApi

汇总

结构体

|名称|typedef关键字|描述| |–|–|–| |OH_CryptoKeyAgreement|OH_CryptoKeyAgreement|定义密钥协商结构。|

函数

|名称|描述| |–|–| |OH_Crypto_ErrCode OH_CryptoKeyAgreement_Create(const char *algoName, OH_CryptoKeyAgreement **ctx)|根据给定的算法名称创建密钥协商实例。| |OH_Crypto_ErrCode OH_CryptoKeyAgreement_GenerateSecret(OH_CryptoKeyAgreement *ctx, OH_CryptoPrivKey *privkey,OH_CryptoPubKey *pubkey, Crypto_DataBlob *secret)|生成密钥协商的秘密值。| |void OH_CryptoKeyAgreement_Destroy(OH_CryptoKeyAgreement *ctx)|销毁密钥协商实例。|

函数说明

OH_CryptoKeyAgreement_Create()

OH_Crypto_ErrCode OH_CryptoKeyAgreement_Create(const char *algoName, OH_CryptoKeyAgreement **ctx)

描述

根据给定的算法名称创建密钥协商实例。

起始版本: 20

参数:

|参数项|描述| |–|–| |const char *algoName|用于生成密钥协商实例的算法名称。
例如”ECC”、”X25519”。| |OH_CryptoKeyAgreement **ctx|密钥协商实例。|

返回:

|类型|说明| |–|–| |OH_Crypto_ErrCode|CRYPTO_SUCCESS = 0 : 操作成功。
CRYPTO_INVALID_PARAMS = 401 : 参数无效。
CRYPTO_NOT_SUPPORTED = 801 : 操作不支持。
CRYPTO_MEMORY_ERROR = 17620001 : 内存错误。
CRYPTO_OPERTION_ERROR = 17630001 : 调用三方算法库API出错。|

OH_CryptoKeyAgreement_GenerateSecret()

OH_Crypto_ErrCode OH_CryptoKeyAgreement_GenerateSecret(OH_CryptoKeyAgreement *ctx, OH_CryptoPrivKey *privkey,OH_CryptoPubKey *pubkey, Crypto_DataBlob *secret)

描述

生成密钥协商的秘密值。

起始版本: 20

参数:

|参数项|描述| |–|–| |OH_CryptoKeyAgreement *ctx|密钥协商实例。| |OH_CryptoPrivKey *privkey|私钥。| |OH_CryptoPubKey *pubkey|公钥。| |Crypto_DataBlob *secret|秘密值。|

返回:

|类型|说明| |–|–| |OH_Crypto_ErrCode|CRYPTO_SUCCESS = 0 : 操作成功。
CRYPTO_INVALID_PARAMS = 401 : 参数无效。
CRYPTO_NOT_SUPPORTED = 801 : 操作不支持。
CRYPTO_MEMORY_ERROR = 17620001 : 内存错误。
CRYPTO_OPERTION_ERROR = 17630001 : 调用三方算法库API出错。|

OH_CryptoKeyAgreement_Destroy()

void OH_CryptoKeyAgreement_Destroy(OH_CryptoKeyAgreement *ctx)

描述

销毁密钥协商实例。

起始版本: 20

参数:

|参数项|描述| |–|–| |OH_CryptoKeyAgreement *ctx|密钥协商实例。|

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Crypto Architecture Kit(加解密算法框架服务)

harmony 鸿蒙crypto_architecture_kit.h

harmony 鸿蒙crypto_asym_cipher.h

harmony 鸿蒙crypto_asym_key.h

harmony 鸿蒙crypto_common.h

harmony 鸿蒙Crypto_DataBlob

harmony 鸿蒙crypto_digest.h

harmony 鸿蒙crypto_kdf.h

harmony 鸿蒙crypto_mac.h

harmony 鸿蒙crypto_rand.h

0  赞