From 8632ba977ed919fb24b956d6f06a27a1586480d0 Mon Sep 17 00:00:00 2001 From: hu-jixiang1 Date: Thu, 5 May 2022 16:48:00 +0800 Subject: [PATCH] huks code basic Signed-off-by: hu-jixiang1 Change-Id: I34629351b007f4b8741948713880b717b49de470 --- ...SecurityHuksAESBasicCallbackJsunit.test.js | 11 +--- ...ityHuksCipherAESBasicPromiseJsunit.test.js | 10 +--- .../huks_hmac_callback_BasicTest/BUILD.gn | 60 +++++++++---------- .../huks_hmac_promise_BasicTest/BUILD.gn | 60 +++++++++---------- ...uksDSABasicAbort63KBCallbackJsunit.test.js | 3 +- ...uksDSABasicAbort65KBCallbackJsunit.test.js | 3 +- ...ksDSABasicFinish63KBCallbackJsunit.test.js | 11 ++-- ...ksDSABasicFinish65KBCallbackJsunit.test.js | 11 ++-- ...uksECCBasicAbort63KBCallbackJsunit.test.js | 3 +- ...uksECCBasicAbort65KBCallbackJsunit.test.js | 3 +- ...ksECCBasicFinish63KBCallbackJsunit.test.js | 11 ++-- ...ksECCBasicFinish65KBCallbackJsunit.test.js | 11 ++-- ...rityHuksED25519BasicCallbackJsunit.test.js | 27 +++++---- ...uksRSABasicAbort63KBCallbackJsunit.test.js | 3 +- ...uksRSABasicAbort65KBCallbackJsunit.test.js | 3 +- ...ksRSABasicFinish63KBCallbackJsunit.test.js | 11 ++-- ...ksRSABasicFinish65KBCallbackJsunit.test.js | 11 ++-- ...HuksDSABasicAbort63KBPromiseJsunit.test.js | 6 +- ...HuksDSABasicAbort65KBPromiseJsunit.test.js | 4 +- ...uksDSABasicFinish63KBPromiseJsunit.test.js | 11 ++-- ...uksDSABasicFinish65KBPromiseJsunit.test.js | 11 ++-- ...HuksECCBasicAbort63KBPromiseJsunit.test.js | 3 +- ...HuksECCBasicAbort65KBPromiseJsunit.test.js | 3 +- ...uksECCBasicFinish63KBPromiseJsunit.test.js | 11 ++-- ...uksECCBasicFinish65KBPromiseJsunit.test.js | 11 ++-- ...urityHuksED25519BasicPromiseJsunit.test.js | 27 +++++---- ...HuksRSABasicAbort63KBPromiseJsunit.test.js | 3 +- ...HuksRSABasicAbort65KBPromiseJsunit.test.js | 3 +- ...uksRSABasicFinish63KBPromiseJsunit.test.js | 11 ++-- ...uksRSABasicFinish65KBPromiseJsunit.test.js | 11 ++-- .../signverify/publicSignverifyCallback.js | 59 +++++++----------- .../signverify/publicSignverifyPromise.js | 59 +++++++----------- 32 files changed, 249 insertions(+), 236 deletions(-) diff --git a/security/security_huks_basic/huks_cipher_callback_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksAESBasicCallbackJsunit.test.js b/security/security_huks_basic/huks_cipher_callback_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksAESBasicCallbackJsunit.test.js index c44b4173a..e75b1a1f9 100644 --- a/security/security_huks_basic/huks_cipher_callback_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksAESBasicCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_cipher_callback_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksAESBasicCallbackJsunit.test.js @@ -96,7 +96,6 @@ async function publicUpdateFunc(HuksOptions, thirdInderfaceName, isEncrypt) { let inDataArray = HuksOptions.inData; if (Array.from(inDataArray).length < dateSize) { await update(handle, HuksOptions); - // HuksOptions.inData = new Uint8Array(new Array()); await publicFinishAbortFunc(HuksOptions, thirdInderfaceName, isEncrypt, 0); } else { let count = Math.floor(Array.from(inDataArray).length / dateSize); @@ -116,12 +115,7 @@ async function publicUpdateFunc(HuksOptions, thirdInderfaceName, isEncrypt) { ) ); } - await publicFinishAbortFunc( - HuksOptions, - thirdInderfaceName, - isEncrypt, - remainder - ); + await publicFinishAbortFunc(HuksOptions, thirdInderfaceName, isEncrypt); } } @@ -158,8 +152,7 @@ function updateCallback(handle, HuksOptions) { async function publicFinishAbortFunc( HuksOptions, thirdInderfaceName, - isEncrypt, - remainder + isEncrypt ) { if (thirdInderfaceName == 'finish') { await finish(HuksOptions, isEncrypt); diff --git a/security/security_huks_basic/huks_cipher_promise_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksCipherAESBasicPromiseJsunit.test.js b/security/security_huks_basic/huks_cipher_promise_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksCipherAESBasicPromiseJsunit.test.js index bbf5c1e3e..1a834473f 100644 --- a/security/security_huks_basic/huks_cipher_promise_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksCipherAESBasicPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_cipher_promise_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksCipherAESBasicPromiseJsunit.test.js @@ -92,12 +92,7 @@ async function publicUpdateFunc(HuksOptions, thirdInderfaceName, isEncrypt) { } else { HuksOptions.inData = new Uint8Array(new Array()); } - await publicFinishAbortFunc( - HuksOptions, - thirdInderfaceName, - isEncrypt, - remainder - ); + await publicFinishAbortFunc(HuksOptions, thirdInderfaceName, isEncrypt); } } @@ -124,8 +119,7 @@ async function update(handle, HuksOptions) { async function publicFinishAbortFunc( HuksOptions, thirdInderfaceName, - isEncrypt, - remainder + isEncrypt ) { if (thirdInderfaceName == 'finish') { await finish(HuksOptions, isEncrypt); diff --git a/security/security_huks_basic/huks_hmac_callback_BasicTest/BUILD.gn b/security/security_huks_basic/huks_hmac_callback_BasicTest/BUILD.gn index 27a317886..856daedad 100644 --- a/security/security_huks_basic/huks_hmac_callback_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_hmac_callback_BasicTest/BUILD.gn @@ -1,30 +1,30 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("hukshmac_callback_basic_js_test") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":huks_js_assets", - ":huks_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksHmacBasicCallbackJSApiTest" -} -ohos_js_assets("huks_js_assets") { - source_dir = "./entry/src/main/js/MainAbility" -} -ohos_resources("huks_js_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("hukshmac_callback_basic_js_test") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":huks_js_assets", + ":huks_js_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsHuksHmacBasicCallbackJSApiTest" +} +ohos_js_assets("huks_js_assets") { + source_dir = "./entry/src/main/js/MainAbility" +} +ohos_resources("huks_js_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/security/security_huks_basic/huks_hmac_promise_BasicTest/BUILD.gn b/security/security_huks_basic/huks_hmac_promise_BasicTest/BUILD.gn index 6b5f3b70c..de6c66e0f 100644 --- a/security/security_huks_basic/huks_hmac_promise_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_hmac_promise_BasicTest/BUILD.gn @@ -1,30 +1,30 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("hukshmac_promise_basic_js_test") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":huks_js_assets", - ":huks_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksHmacBasicPromiseJSApiTest" -} -ohos_js_assets("huks_js_assets") { - source_dir = "./entry/src/main/js/MainAbility" -} -ohos_resources("huks_js_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("hukshmac_promise_basic_js_test") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":huks_js_assets", + ":huks_js_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsHuksHmacBasicPromiseJSApiTest" +} +ohos_js_assets("huks_js_assets") { + source_dir = "./entry/src/main/js/MainAbility" +} +ohos_resources("huks_js_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBCallbackJsunit.test.js index 035fc8051..dec2af574 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBCallbackJsunit.test.js @@ -36,7 +36,8 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { NewSrcKeyAlies, HuksOptions, 'abort', - true + true, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBCallbackJsunit.test.js index 95895d8d4..ae814fc70 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBCallbackJsunit.test.js @@ -37,7 +37,8 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { NewSrcKeyAlies, HuksOptions, 'abort', - true + true, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBCallbackJsunit.test.js index 7bff51dc6..79e956bcd 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBCallbackJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData63 = Data.Data63b; let srcData63Kb = stringToUint8Array(srcData63); +let finishOutData; describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { it('testSignVerifyDSA001', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias001'; @@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, newSrcKeyAlies, HuksOptions, 'finish', - true + true, + srcData63Kb ); HuksOptions = { properties: new Array( @@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { HuksSignVerifyDSA.HuksTagDSADigestSHA1, HuksSignVerifyDSA.HuksTagDSACOMMONSIZE ), - inData: srcData63Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, newSrcKeyAlies, HuksOptions, 'finish', - false + false, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBCallbackJsunit.test.js index 490b801c3..d1c2003dd 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBCallbackJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData65 = Data.Data65b; let srcData65Kb = stringToUint8Array(srcData65); +let finishOutData; describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { it('testSignVerifyDSA003', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias003'; @@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, newSrcKeyAlies, HuksOptions, 'finish', - true + true, + srcData65Kb ); HuksOptions = { properties: new Array( @@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { HuksSignVerifyDSA.HuksTagDSADigestSHA1, HuksSignVerifyDSA.HuksKeySIZE1024 ), - inData: srcData65Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, newSrcKeyAlies, HuksOptions, 'finish', - false + false, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort63KBCallbackJsunit.test.js index d8a9591ec..a93390760 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort63KBCallbackJsunit.test.js @@ -36,7 +36,8 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort65KBCallbackJsunit.test.js index cb986da79..42cf30e6d 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort65KBCallbackJsunit.test.js @@ -36,7 +36,8 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish63KBCallbackJsunit.test.js index 45db6668f..73aded402 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish63KBCallbackJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData63 = Data.Data63b; let srcData63Kb = stringToUint8Array(srcData63); +let finishOutData; describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { it('testSignVerifyECC001', 0, async function (done) { const srcKeyAlies = 'testSignVerifyECCSize224SIGNNONEKeyAlias001'; @@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData63Kb ); HuksOptions = { properties: new Array( @@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { HuksSignVerifyECC.HuksTagECCDigestNONE, HuksSignVerifyECC.HuksKeyECCSize224 ), - inData: srcData63Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - false + false, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish65KBCallbackJsunit.test.js index 279d6b8bf..1f2a03ee6 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish65KBCallbackJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData65 = Data.Data65b; let srcData65Kb = stringToUint8Array(srcData65); +let finishOutData; describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { it('testSignVerifyECC003', 0, async function (done) { const srcKeyAlies = 'testSignVerifyECCSize224SIGNNONEKeyAlias003'; @@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData65Kb ); HuksOptions = { properties: new Array( @@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { HuksSignVerifyECC.HuksTagECCDigestNONE, HuksSignVerifyECC.HuksKeyECCSize224 ), - inData: srcData65Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - false + false, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksED25519BasicCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksED25519BasicCallbackJsunit.test.js index 36f4de923..9e48412ff 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksED25519BasicCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksED25519BasicCallbackJsunit.test.js @@ -21,6 +21,7 @@ let srcData63 = Data.Data63b; let srcData63Kb = stringToUint8Array(srcData63); let srcData65 = Data.Data65b; let srcData65Kb = stringToUint8Array(srcData65); +let finishOutData; describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { it('testSignVerifyED25519001', 0, async function (done) { const srcKeyAlies = 'testSignVerifyED25519Size256SIGNKeyAlias001'; @@ -33,12 +34,13 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData63Kb ); HuksOptions = { @@ -48,14 +50,15 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { HuksSignVerifyED25519.HuksKeyED25519Size256, HuksSignVerifyED25519.HuksTagDigestSHA1 ), - inData: srcData63Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - false + false, + srcData63Kb ); done(); }); @@ -76,7 +79,8 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData63Kb ); done(); }); @@ -92,12 +96,13 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData65Kb ); HuksOptions = { properties: new Array( @@ -106,14 +111,15 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { HuksSignVerifyED25519.HuksKeyED25519Size256, HuksSignVerifyED25519.HuksTagDigestSHA1 ), - inData: srcData65Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - false + false, + srcData65Kb ); done(); }); @@ -134,7 +140,8 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort63KBCallbackJsunit.test.js index 61fc28e2a..667a1901b 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort63KBCallbackJsunit.test.js @@ -40,7 +40,8 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort65KBCallbackJsunit.test.js index f0945bfad..c978731df 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort65KBCallbackJsunit.test.js @@ -37,7 +37,8 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish63KBCallbackJsunit.test.js index de55c6474..8380c0b58 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish63KBCallbackJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData63 = Data.Data63b; let srcData63Kb = stringToUint8Array(srcData63); +let finishOutData; describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { it('testSignVerifyRSA001', 0, async function (done) { const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias001'; @@ -32,12 +33,13 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData63Kb ); HuksOptions = { properties: new Array( @@ -47,14 +49,15 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, HuksSignVerifyRSA.HuksKeyRSASize512 ), - inData: srcData63Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - false + false, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish65KBCallbackJsunit.test.js index dce3cdd51..026203fab 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish65KBCallbackJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData65 = Data.Data65b; let srcData65Kb = stringToUint8Array(srcData65); +let finishOutData; describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { it('testSignVerifyRSA003', 0, async function (done) { const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias003'; @@ -32,12 +33,13 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData65Kb ); HuksOptions = { properties: new Array( @@ -47,14 +49,15 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, HuksSignVerifyRSA.HuksKeyRSASize512 ), - inData: srcData65Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + false, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBPromiseJsunit.test.js index ee369309d..6c942e3f5 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBPromiseJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData63 = Data.Data63b; let srcData63Kb = stringToUint8Array(srcData63); +let finishOutData; describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { it('testSignVerifyDSA102', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias102'; @@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, NewSrcKeyAlies, HuksOptions, 'abort', - true + true, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBPromiseJsunit.test.js index 3f76d1261..c01a5e7f7 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBPromiseJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData65 = Data.Data65b; let srcData65Kb = stringToUint8Array(srcData65); +let finishOutData; describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { it('testSignVerifyDSA104', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias104'; @@ -36,7 +37,8 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { NewSrcKeyAlies, HuksOptions, 'abort', - true + true, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBPromiseJsunit.test.js index 6eb95fec6..31628987a 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBPromiseJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData63 = Data.Data63b; let srcData63Kb = stringToUint8Array(srcData63); +let finishOutData; describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { it('testSignVerifyDSA101', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias101'; @@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, newSrcKeyAlies, HuksOptions, 'finish', - true + true, + srcData63Kb ); HuksOptions = { properties: new Array( @@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { HuksSignVerifyDSA.HuksTagDSADigestSHA1, HuksSignVerifyDSA.HuksTagDSACOMMONSIZE ), - inData: srcData63Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, newSrcKeyAlies, HuksOptions, 'finish', - false + false, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBPromiseJsunit.test.js index db70b9f29..cb19fdc52 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBPromiseJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData65 = Data.Data65b; let srcData65Kb = stringToUint8Array(srcData65); +let finishOutData; describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { it('testSignVerifyDSA103', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias103'; @@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, newSrcKeyAlies, HuksOptions, 'finish', - true + true, + srcData65Kb ); HuksOptions = { properties: new Array( @@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { HuksSignVerifyDSA.HuksTagDSADigestSHA1, HuksSignVerifyDSA.HuksKeySIZE1024 ), - inData: srcData65Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, newSrcKeyAlies, HuksOptions, 'finish', - false + false, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort63KBPromiseJsunit.test.js index 8ce919a55..1900281c1 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort63KBPromiseJsunit.test.js @@ -36,7 +36,8 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort65KBPromiseJsunit.test.js index e56659629..d7000b4ed 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicAbort65KBPromiseJsunit.test.js @@ -36,7 +36,8 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish63KBPromiseJsunit.test.js index 54882eaf9..aabb45623 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish63KBPromiseJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData63 = Data.Data63b; let srcData63Kb = stringToUint8Array(srcData63); +let finishOutData; describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { it('testSignVerifyECC101', 0, async function (done) { const srcKeyAlies = 'testSignVerifyECCSize224SIGNNONEKeyAlias101'; @@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData63Kb ); HuksOptions = { properties: new Array( @@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { HuksSignVerifyECC.HuksTagECCDigestNONE, HuksSignVerifyECC.HuksKeyECCSize224 ), - inData: srcData63Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - false + false, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish65KBPromiseJsunit.test.js index 5e579de45..c3a673af5 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish65KBPromiseJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData65 = Data.Data65b; let srcData65Kb = stringToUint8Array(srcData65); +let finishOutData; describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { it('testSignVerifyECC103', 0, async function (done) { const srcKeyAlies = 'testSignVerifyECCSize224SIGNNONEKeyAlias103'; @@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData65Kb ); HuksOptions = { properties: new Array( @@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { HuksSignVerifyECC.HuksTagECCDigestNONE, HuksSignVerifyECC.HuksKeyECCSize224 ), - inData: srcData65Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - false + false, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksED25519BasicPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksED25519BasicPromiseJsunit.test.js index 3bba46b1d..f07216d6c 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksED25519BasicPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksED25519BasicPromiseJsunit.test.js @@ -21,6 +21,7 @@ let srcData63 = Data.Data63b; let srcData63Kb = stringToUint8Array(srcData63); let srcData65 = Data.Data65b; let srcData65Kb = stringToUint8Array(srcData65); +let finishOutData; describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { it('testSignVerifyED25519101', 0, async function (done) { const srcKeyAlies = 'testSignVerifyED25519Size256SIGNKeyAlias101'; @@ -33,12 +34,13 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData63Kb ); HuksOptions = { @@ -48,14 +50,15 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { HuksSignVerifyED25519.HuksKeyED25519Size256, HuksSignVerifyED25519.HuksTagDigestSHA1 ), - inData: srcData63Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - false + false, + srcData63Kb ); done(); }); @@ -76,7 +79,8 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData63Kb ); done(); }); @@ -92,12 +96,13 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData65Kb ); HuksOptions = { properties: new Array( @@ -106,14 +111,15 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { HuksSignVerifyED25519.HuksKeyED25519Size256, HuksSignVerifyED25519.HuksTagDigestSHA1 ), - inData: srcData65Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - false + false, + srcData65Kb ); done(); }); @@ -134,7 +140,8 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort63KBPromiseJsunit.test.js index 09aee608b..09dbca4f1 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort63KBPromiseJsunit.test.js @@ -37,7 +37,8 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort65KBPromiseJsunit.test.js index c0c5cab9e..a500d3f51 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicAbort65KBPromiseJsunit.test.js @@ -38,7 +38,8 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { srcKeyAlies + 'New', HuksOptions, 'abort', - true + true, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish63KBPromiseJsunit.test.js index f92b7bd07..408f9b1ed 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish63KBPromiseJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData63 = Data.Data63b; let srcData63Kb = stringToUint8Array(srcData63); +let finishOutData; describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { it('testSignVerifyRSA101', 0, async function (done) { const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias101'; @@ -32,12 +33,13 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData63Kb ); HuksOptions = { properties: new Array( @@ -47,14 +49,15 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, HuksSignVerifyRSA.HuksKeyRSASize512 ), - inData: srcData63Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - false + false, + srcData63Kb ); done(); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish65KBPromiseJsunit.test.js index 4d8922314..ead51dcaa 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/entry/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish65KBPromiseJsunit.test.js @@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc' import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js'; let srcData65 = Data.Data65b; let srcData65Kb = stringToUint8Array(srcData65); +let finishOutData; describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { it('testSignVerifyRSA103', 0, async function (done) { const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias103'; @@ -32,12 +33,13 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( + finishOutData = await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + true, + srcData65Kb ); HuksOptions = { @@ -48,14 +50,15 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, HuksSignVerifyRSA.HuksKeyRSASize512 ), - inData: srcData65Kb, + inData: finishOutData, }; await publicSignVerifyFunc( srcKeyAlies, srcKeyAlies + 'New', HuksOptions, 'finish', - true + false, + srcData65Kb ); done(); }); diff --git a/security/security_huks_basic/utils/param/signverify/publicSignverifyCallback.js b/security/security_huks_basic/utils/param/signverify/publicSignverifyCallback.js index 1568eeca6..9ebc06986 100644 --- a/security/security_huks_basic/utils/param/signverify/publicSignverifyCallback.js +++ b/security/security_huks_basic/utils/param/signverify/publicSignverifyCallback.js @@ -49,7 +49,7 @@ function generateKey(srcKeyAlies, HuksOptions) { async function publicImportKey(keyAlias, HuksOptions) { let _InData = HuksOptions.inData; - HuksOptions.inData = finishOutData; + HuksOptions.inData = exportKey; await importKey(keyAlias, HuksOptions) .then((data) => { console.log(`test ImportKey data: ${JSON.stringify(data)}`); @@ -79,7 +79,7 @@ async function publicExportKey(keyAlias, HuksOptions) { await exportkey(keyAlias, HuksOptions) .then((data) => { console.log(`test exportKey data: ${JSON.stringify(data)}`); - finishOutData = data.outData; + exportKey = data.outData; }) .catch((err) => { console.log('test exportKey err information: ' + JSON.stringify(err)); @@ -127,13 +127,8 @@ function init(srcKeyAlies, HuksOptions) { }); } -async function publicUpdateFunc(HuksOptions, isBigData) { - let dateSize = 0; - if (isBigData) { - dateSize = 64 * 1024; - } else { - dateSize = 64; - } +async function publicUpdateFunc(HuksOptions) { + let dateSize = 64; let tempHuksOptionsInData = HuksOptions.inData; let inDataArray = HuksOptions.inData; if (uint8ArrayToString(inDataArray).length < dateSize) { @@ -194,7 +189,7 @@ async function publicFinishFunc(HuksOptions) { await finish(handle, HuksOptions) .then((data) => { console.log(`test finish data: ${JSON.stringify(data)}`); - exportKey = data.outData; + finishOutData = data.outData; expect(data.errorCode == 0).assertTrue(); }) .catch((err) => { @@ -272,66 +267,52 @@ async function publicSignVerifyFunc( HuksOptions, thirdInderfaceName, isSING, - isBigData + rawData ) { try { let keyAlias = srcKeyAlies; + let purposeSignVerigy = HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY; + let purposeSign = HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN; + let PurposeVerify = HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY; if (isSING) { - HuksOptions.properties.splice( - 1, - 1, - HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY - ); + HuksOptions.properties.splice(1, 1, purposeSignVerigy); if (HuksOptions.properties[0].value == HksKeyAlg.HKS_ALG_DSA) { HuksOptions.properties.splice(2, 0, HuksSignVerifyDSA.HuksKeySIZE1024); } await publicGenerateKeyFunc(keyAlias, HuksOptions); - HuksOptions.properties.splice( - 1, - 1, - HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN - ); + HuksOptions.properties.splice(1, 1, purposeSign); if (HuksOptions.properties[0].value == HksKeyAlg.HKS_ALG_DSA) { HuksOptions.properties.splice(2, 1); } } else { keyAlias = newSrcKeyAlies; + finishOutData = HuksOptions.inData; await publicImportKey(keyAlias, HuksOptions); } await publicInitFunc(keyAlias, HuksOptions); - await publicUpdateFunc(HuksOptions, isBigData); + HuksOptions.inData = rawData; + await publicUpdateFunc(HuksOptions); if (thirdInderfaceName == 'finish') { if (isSING) { - HuksOptions.outData = new Uint8Array(new Array(1024)); + HuksOptions.inData = new Uint8Array(new Array()); await publicFinishFunc(HuksOptions); - HuksOptions.properties.splice( - 1, - 1, - HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY - ); + HuksOptions.properties.splice(1, 1, purposeSignVerigy); await publicExportKey(keyAlias, HuksOptions); } else { - HuksOptions.outData = exportKey; + HuksOptions.inData = finishOutData; await publicFinishFunc(HuksOptions); } } else { await publicAbortFucn(HuksOptions); } if (isSING && thirdInderfaceName == 'abort') { - HuksOptions.properties.splice( - 1, - 1, - HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY - ); + HuksOptions.properties.splice(1, 1, purposeSignVerigy); await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); } else if (!isSING) { - HuksOptions.properties.splice( - 1, - 1, - HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY - ); + HuksOptions.properties.splice(1, 1, PurposeVerify); await publicDeleteKeyFunc(newSrcKeyAlies, HuksOptions); } + return finishOutData; } catch (e) { expect(null).assertFail(); } diff --git a/security/security_huks_basic/utils/param/signverify/publicSignverifyPromise.js b/security/security_huks_basic/utils/param/signverify/publicSignverifyPromise.js index 2f3f8ec53..9e4080458 100644 --- a/security/security_huks_basic/utils/param/signverify/publicSignverifyPromise.js +++ b/security/security_huks_basic/utils/param/signverify/publicSignverifyPromise.js @@ -36,7 +36,7 @@ async function publicGenerateKeyFunc(keyAlias, HuksOptions) { async function publicImportKey(keyAlias, HuksOptions) { let _InData = HuksOptions.inData; - HuksOptions.inData = finishOutData; + HuksOptions.inData = exportKey; await huks .importKey(keyAlias, HuksOptions) .then((data) => { @@ -54,7 +54,7 @@ async function publicExportKey(keyAlias, HuksOptions) { .exportKey(keyAlias, HuksOptions) .then((data) => { console.log(`test exportKey data: ${JSON.stringify(data)}`); - finishOutData = data.outData; + exportKey = data.outData; }) .catch((err) => { console.log('test exportKey err information: ' + JSON.stringify(err)); @@ -76,13 +76,8 @@ async function publicInitFunc(keyAlias, HuksOptions) { }); } -async function publicUpdateFunc(HuksOptions, isBigData) { - let dateSize = 0; - if (isBigData) { - dateSize = 64 * 1024; - } else { - dateSize = 64; - } +async function publicUpdateFunc(HuksOptions) { + let dateSize = 64; let tempHuksOptionsInData = HuksOptions.inData; let inDataArray = HuksOptions.inData; if (uint8ArrayToString(inDataArray).length < dateSize) { @@ -132,7 +127,7 @@ async function publicFinishFunc(HuksOptions) { .finish(handle, HuksOptions) .then((data) => { console.log(`test finish data: ${JSON.stringify(data)}`); - exportKey = data.outData; + finishOutData = data.outData; expect(data.errorCode == 0).assertTrue(); }) .catch((err) => { @@ -173,66 +168,52 @@ async function publicSignVerifyFunc( HuksOptions, thirdInderfaceName, isSING, - isBigData + rawData ) { try { let keyAlias = srcKeyAlies; + let purposeSignVerigy = HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY; + let purposeSign = HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN; + let PurposeVerify = HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY; if (isSING) { - HuksOptions.properties.splice( - 1, - 1, - HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY - ); + HuksOptions.properties.splice(1, 1, purposeSignVerigy); if (HuksOptions.properties[0].value == HksKeyAlg.HKS_ALG_DSA) { HuksOptions.properties.splice(2, 0, HuksSignVerifyDSA.HuksKeySIZE1024); } await publicGenerateKeyFunc(keyAlias, HuksOptions); - HuksOptions.properties.splice( - 1, - 1, - HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN - ); + HuksOptions.properties.splice(1, 1, purposeSign); if (HuksOptions.properties[0].value == HksKeyAlg.HKS_ALG_DSA) { HuksOptions.properties.splice(2, 1); } } else { keyAlias = newSrcKeyAlies; + finishOutData = HuksOptions.inData; await publicImportKey(keyAlias, HuksOptions); } await publicInitFunc(keyAlias, HuksOptions); - await publicUpdateFunc(HuksOptions, isBigData); + HuksOptions.inData = rawData; + await publicUpdateFunc(HuksOptions); if (thirdInderfaceName == 'finish') { if (isSING) { - HuksOptions.outData = new Uint8Array(new Array(1024).fill('')); + HuksOptions.inData = new Uint8Array(new Array()); await publicFinishFunc(HuksOptions); - HuksOptions.properties.splice( - 1, - 1, - HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY - ); + HuksOptions.properties.splice(1, 1, purposeSignVerigy); await publicExportKey(keyAlias, HuksOptions); } else { - HuksOptions.outData = exportKey; + HuksOptions.inData = finishOutData; await publicFinishFunc(HuksOptions); } } else { await publicAbortFucn(HuksOptions); } if (isSING && thirdInderfaceName == 'abort') { - HuksOptions.properties.splice( - 1, - 1, - HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY - ); + HuksOptions.properties.splice(1, 1, purposeSignVerigy); await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); } else if (!isSING) { - HuksOptions.properties.splice( - 1, - 1, - HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY - ); + HuksOptions.properties.splice(1, 1, PurposeVerify); await publicDeleteKeyFunc(newSrcKeyAlies, HuksOptions); } + return finishOutData; } catch (e) { expect(null).assertFail(); } -- GitLab