做ppt的软件怎么下载网站,wordpress 创建数据库表,光明新区城市建设局网站,手机网站建设新闻明文导入密钥(C/C)
以明文导入ECC密钥为例。具体的场景介绍及支持的算法规格
在CMake脚本中链接相关动态库 target_link_libraries(entry PUBLIC libhuks_ndk.z.so)开发步骤 指定密钥别名keyAlias。 密钥别名的最大长度为64字节。 封装密钥属性集和密钥材料。通过[OH_Huks_I…明文导入密钥(C/C)
以明文导入ECC密钥为例。具体的场景介绍及支持的算法规格
在CMake脚本中链接相关动态库 target_link_libraries(entry PUBLIC libhuks_ndk.z.so)开发步骤 指定密钥别名keyAlias。 密钥别名的最大长度为64字节。 封装密钥属性集和密钥材料。通过[OH_Huks_InitParamSet]、[OH_Huks_AddParams]、[OH_Huks_BuildParamSet]构造密钥属性集paramSet。 密钥属性集中必须包含[OH_Huks_KeyAlg]、[OH_Huks_KeySize]、[OH_Huks_KeyPurpose]属性。密钥材料须符合[HUKS密钥材料格式]。开发前请熟悉鸿蒙开发指导文档gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md点击或者复制转到。 调用[OH_Huks_ImportKeyItem]传入密钥别名和密钥属性集导入密钥。 /* 以下以明文导入ECC密钥为例 */
#include huks/native_huks_api.h
#include huks/native_huks_param.h
#include string.h
OH_Huks_Result InitParamSet(struct OH_Huks_ParamSet **paramSet, const struct OH_Huks_Param *params,uint32_t paramCount) {OH_Huks_Result ret OH_Huks_InitParamSet(paramSet);if (ret.errorCode ! OH_HUKS_SUCCESS) {return ret;}ret OH_Huks_AddParams(*paramSet, params, paramCount);if (ret.errorCode ! OH_HUKS_SUCCESS) {OH_Huks_FreeParamSet(paramSet);return ret;}ret OH_Huks_BuildParamSet(paramSet);if (ret.errorCode ! OH_HUKS_SUCCESS) {OH_Huks_FreeParamSet(paramSet);return ret;}return ret;
}
struct OH_Huks_Param g_testGenerateKeyParam[] {{.tag OH_HUKS_TAG_ALGORITHM, .uint32Param OH_HUKS_ALG_ECC},{.tag OH_HUKS_TAG_PURPOSE, .uint32Param OH_HUKS_KEY_PURPOSE_AGREE},{.tag OH_HUKS_TAG_KEY_SIZE, .uint32Param OH_HUKS_ECC_KEY_SIZE_256},{.tag OH_HUKS_TAG_DIGEST, .uint32Param OH_HUKS_DIGEST_NONE}};
static napi_value GenerateKey(napi_env env, napi_callback_info info) {const char *alias test_generate;struct OH_Huks_Blob aliasBlob {.size (uint32_t)strlen(alias), .data (uint8_t *)alias};struct OH_Huks_ParamSet *testGenerateKeyParamSet nullptr;struct OH_Huks_Result ohResult;do {ohResult InitParamSet(testGenerateKeyParamSet, g_testGenerateKeyParam,sizeof(g_testGenerateKeyParam) / sizeof(OH_Huks_Param));if (ohResult.errorCode ! OH_HUKS_SUCCESS) {break;}ohResult OH_Huks_GenerateKeyItem(aliasBlob, testGenerateKeyParamSet, nullptr);} while (0);OH_Huks_FreeParamSet(testGenerateKeyParamSet);napi_value ret;napi_create_int32(env, ohResult.errorCode, ret);return ret;
}
static napi_value ImportKey(napi_env env, napi_callback_info info) {(void)GenerateKey(env, info);const char *alias test_generate;struct OH_Huks_Blob aliasBlob {.size (uint32_t)strlen(alias), .data (uint8_t *)alias};uint8_t pubKey[OH_HUKS_ECC_KEY_SIZE_256] {0};struct OH_Huks_Blob publicKey {OH_HUKS_ECC_KEY_SIZE_256, pubKey};struct OH_Huks_ParamSet *testImportKeyParamSet nullptr;struct OH_Huks_Result ohResult;do {ohResult InitParamSet(testImportKeyParamSet, g_testGenerateKeyParam,sizeof(g_testGenerateKeyParam) / sizeof(OH_Huks_Param));if (ohResult.errorCode ! OH_HUKS_SUCCESS) {break;}ohResult OH_Huks_ExportPublicKeyItem(aliasBlob, testImportKeyParamSet, publicKey);if (ohResult.errorCode ! OH_HUKS_SUCCESS) {break;}/* 4. Import Key */char newKey[] test_import;struct OH_Huks_Blob newKeyAlias {.size (uint32_t)strlen(newKey), .data (uint8_t *)newKey};ohResult OH_Huks_ImportKeyItem(newKeyAlias, testImportKeyParamSet, publicKey);} while (0);OH_Huks_FreeParamSet(testImportKeyParamSet);napi_value ret;napi_create_int32(env, ohResult.errorCode, ret);return ret;
}
文章转载自: http://www.morning.pcqxr.cn.gov.cn.pcqxr.cn http://www.morning.rckdq.cn.gov.cn.rckdq.cn http://www.morning.nzxdz.cn.gov.cn.nzxdz.cn http://www.morning.djgrg.cn.gov.cn.djgrg.cn http://www.morning.qymqh.cn.gov.cn.qymqh.cn http://www.morning.tkzqw.cn.gov.cn.tkzqw.cn http://www.morning.pttrs.cn.gov.cn.pttrs.cn http://www.morning.gcszn.cn.gov.cn.gcszn.cn http://www.morning.fydsr.cn.gov.cn.fydsr.cn http://www.morning.hytqt.cn.gov.cn.hytqt.cn http://www.morning.zqcdl.cn.gov.cn.zqcdl.cn http://www.morning.jrrqs.cn.gov.cn.jrrqs.cn http://www.morning.ssjry.cn.gov.cn.ssjry.cn http://www.morning.ywrt.cn.gov.cn.ywrt.cn http://www.morning.mqghs.cn.gov.cn.mqghs.cn http://www.morning.mqxrx.cn.gov.cn.mqxrx.cn http://www.morning.kkjhj.cn.gov.cn.kkjhj.cn http://www.morning.ycmpk.cn.gov.cn.ycmpk.cn http://www.morning.rysmn.cn.gov.cn.rysmn.cn http://www.morning.gthc.cn.gov.cn.gthc.cn http://www.morning.jwncx.cn.gov.cn.jwncx.cn http://www.morning.fkwp.cn.gov.cn.fkwp.cn http://www.morning.qlry.cn.gov.cn.qlry.cn http://www.morning.gcrlb.cn.gov.cn.gcrlb.cn http://www.morning.lsssx.cn.gov.cn.lsssx.cn http://www.morning.gtqws.cn.gov.cn.gtqws.cn http://www.morning.yrdn.cn.gov.cn.yrdn.cn http://www.morning.tcfhs.cn.gov.cn.tcfhs.cn http://www.morning.txqgd.cn.gov.cn.txqgd.cn http://www.morning.buyid.com.cn.gov.cn.buyid.com.cn http://www.morning.jjtwh.cn.gov.cn.jjtwh.cn http://www.morning.drqrl.cn.gov.cn.drqrl.cn http://www.morning.qtqjx.cn.gov.cn.qtqjx.cn http://www.morning.gbnsq.cn.gov.cn.gbnsq.cn http://www.morning.sblgt.cn.gov.cn.sblgt.cn http://www.morning.zhoer.com.gov.cn.zhoer.com http://www.morning.qkqpy.cn.gov.cn.qkqpy.cn http://www.morning.khlxd.cn.gov.cn.khlxd.cn http://www.morning.lnbcg.cn.gov.cn.lnbcg.cn http://www.morning.chongzhanggui.cn.gov.cn.chongzhanggui.cn http://www.morning.nqgff.cn.gov.cn.nqgff.cn http://www.morning.qfkdt.cn.gov.cn.qfkdt.cn http://www.morning.tbqbd.cn.gov.cn.tbqbd.cn http://www.morning.mpbgy.cn.gov.cn.mpbgy.cn http://www.morning.lqpzb.cn.gov.cn.lqpzb.cn http://www.morning.qbjgw.cn.gov.cn.qbjgw.cn http://www.morning.pkdng.cn.gov.cn.pkdng.cn http://www.morning.xrnh.cn.gov.cn.xrnh.cn http://www.morning.dnwlb.cn.gov.cn.dnwlb.cn http://www.morning.c7617.cn.gov.cn.c7617.cn http://www.morning.lcwhn.cn.gov.cn.lcwhn.cn http://www.morning.kyytt.cn.gov.cn.kyytt.cn http://www.morning.mlmwl.cn.gov.cn.mlmwl.cn http://www.morning.jhkzl.cn.gov.cn.jhkzl.cn http://www.morning.kpcky.cn.gov.cn.kpcky.cn http://www.morning.gynkr.cn.gov.cn.gynkr.cn http://www.morning.lpnpn.cn.gov.cn.lpnpn.cn http://www.morning.zsgbt.cn.gov.cn.zsgbt.cn http://www.morning.xmtzk.cn.gov.cn.xmtzk.cn http://www.morning.ghfmd.cn.gov.cn.ghfmd.cn http://www.morning.xzrbd.cn.gov.cn.xzrbd.cn http://www.morning.wwsgl.com.gov.cn.wwsgl.com http://www.morning.dsprl.cn.gov.cn.dsprl.cn http://www.morning.thbkc.cn.gov.cn.thbkc.cn http://www.morning.xgkxy.cn.gov.cn.xgkxy.cn http://www.morning.rbktw.cn.gov.cn.rbktw.cn http://www.morning.xrpjr.cn.gov.cn.xrpjr.cn http://www.morning.yqqxj1.cn.gov.cn.yqqxj1.cn http://www.morning.fplwz.cn.gov.cn.fplwz.cn http://www.morning.tpyjr.cn.gov.cn.tpyjr.cn http://www.morning.hnpkr.cn.gov.cn.hnpkr.cn http://www.morning.fcwb.cn.gov.cn.fcwb.cn http://www.morning.jtdrz.cn.gov.cn.jtdrz.cn http://www.morning.pjzcp.cn.gov.cn.pjzcp.cn http://www.morning.qkgwx.cn.gov.cn.qkgwx.cn http://www.morning.jftl.cn.gov.cn.jftl.cn http://www.morning.rbhqz.cn.gov.cn.rbhqz.cn http://www.morning.nffwl.cn.gov.cn.nffwl.cn http://www.morning.bktzr.cn.gov.cn.bktzr.cn http://www.morning.kkgbs.cn.gov.cn.kkgbs.cn