提交 37cb79cb 编写于 作者: Z zhangcheng

修改HUKS demo代码

Signed-off-by: Nzhangcheng <zhangcheng195@huawei.com>
上级 f12c7d1b
......@@ -171,6 +171,7 @@ RSA512, RSA768, RSA1024, RSA2048, RSA3072, RSA4096, ECC224, ECC256, ECC384, ECC5
/* 以生成RSA512密钥为例 */
var srcKeyAlias = 'hukRsaKeyAlias';
var srcKeyAliasSecond = 'huksRsaKeyAliasSecond';
var exportKey;
async function testImportExport() {
/* 集成生成密钥参数集 */
......@@ -1425,6 +1426,7 @@ function hkdfStringToUint8Array(str) {
var deriveHkdfInData = "deriveHkdfTestIndata";
var srcKeyAlias = "deriveHkdfKeyAlias";
var handle;
var HuksKeyDeriveKeySize = 32;
async function testDerive() {
......@@ -1455,7 +1457,7 @@ async function testDerive() {
await huks.generateKey(srcKeyAlias, huksOptions).then((data) => {
console.info('test generateKey data = ' + JSON.stringify(data));
}).catch((err) => {
console.info(`test init err: " + ${JSON.stringify(data)}`);
console.info(`test init err: " + ${JSON.stringify(err)}`);
});
/* 调整init时的参数集 */
......@@ -1497,7 +1499,7 @@ async function testDerive() {
}
finishProperties[6] = {
tag: huks.HuksTag.HUKS_TAG_KEY_ALIAS,
value: stringToUint8Array(srcKeyAlias),
value: hkdfStringToUint8Array(srcKeyAlias),
}
finishProperties[7] = {
tag: huks.HuksTag.HUKS_TAG_PADDING,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册