From 5d1cea8576fd32bcd9cc7e6b68ff5f1928d87092 Mon Sep 17 00:00:00 2001 From: qiaozzzh Date: Mon, 19 Jun 2023 16:28:02 +0800 Subject: [PATCH] XTS Adapter Signed-off-by: qiaozzzh Change-Id: Ibf8f90cd189d3f801f155789abc98fac90c43948 --- .../SecurityHuksRSASignExtendJsunit.test.js | 6 +++--- .../utils/param/publicFunc.js | 19 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksRSASignExtendJsunit.test.js b/security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksRSASignExtendJsunit.test.js index ec9547df4..e9e323c38 100644 --- a/security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksRSASignExtendJsunit.test.js +++ b/security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksRSASignExtendJsunit.test.js @@ -13,7 +13,7 @@ * limitations under the License. */ import huks from "@ohos.security.huks"; -import { describe, it, expect } from "@ohos/hypium"; +import { describe, it, expect, beforeAll } from "@ohos/hypium"; import Data from '../../../../../../utils/data.json'; import { stringToUint8Array, @@ -56,7 +56,7 @@ let handle; let IV = '0000000000000000'; let IVErr = '00000000000000000000000000000000000000000000000000000000000000000000'; let AAD = '0000000000000000'; -let NONCE = '00000000000'; +let NONCE = '000000000000'; let AEAD = '0000000000000000'; let useSoftware = true; @@ -239,7 +239,7 @@ async function publicExportFunc(srcKeyAlies, HuksOptions) { export default function SecurityHuksRSASignExtendJsunit() { describe('SecurityHuksRSASignExtendJsunit', function () { beforeAll(async function (done) { - useSoftware = checkSoftware(); + useSoftware = await checkSoftware(); done(); }) diff --git a/security/security_huks_reformed_test/utils/param/publicFunc.js b/security/security_huks_reformed_test/utils/param/publicFunc.js index 8ba2411e1..d55351acf 100644 --- a/security/security_huks_reformed_test/utils/param/publicFunc.js +++ b/security/security_huks_reformed_test/utils/param/publicFunc.js @@ -68,17 +68,14 @@ async function checkSoftware() { HuksSignVerifyDSA.HuksTagDSADigestSHA256 ) }; - try { - let res = await huks.generateKeyItem(dsaAlies, dsaOption); - if (res == null) { - await huks.deleteKeyItem(dsaAlies, dsaOption); - console.error("This device uses software"); - return true; - } else { - console.error("This device does not use software"); - return false; - } - } catch (e) { + let res = await huks.generateKey(dsaAlies, dsaOption); + console.log(`test generate:${JSON.stringify(res)}`); + if (res.errorCode == 0) { + await huks.deleteKey(dsaAlies, dsaOption); + console.error("This device uses software"); + return true; + } else { + console.error("This device does not use software"); return false; } } -- GitLab