openharmony 鸿蒙 capi-crypto-key-agreement-h

2025-06-12 浏览 (1)

crypto_key_agreement.h

概述

定义密钥协商接口。

库: libohcrypto.so

引用文件: <CryptoArchitectureKit/crypto_key_agreement.h>

系统能力: SystemCapability.Security.CryptoFramework

起始版本: 20

相关模块: CryptoKeyAgreementApi

汇总

结构体

名称typedef关键字描述
OH_CryptoKeyAgreementOH_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_ErrCodeCRYPTO_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_ErrCodeCRYPTO_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

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/qqERkD