diff --git a/security/huks_napi_BasicTest/BUILD.gn b/security/huks_napi_BasicTest/BUILD.gn index 552b598e13aa7b9286d6af63049995908c8a603e..5d31e36a9fff90412e4a4224e8a9e5bd747c2ef8 100644 --- a/security/huks_napi_BasicTest/BUILD.gn +++ b/security/huks_napi_BasicTest/BUILD.gn @@ -37,7 +37,6 @@ ohos_moduletest_suite("ActsHuksNAPITest") { part_name = "huks" sources = [ - "src/huks_agree_dh_test.cpp", "src/huks_agree_ecdh_test.cpp", "src/huks_agree_ecdh_test_common.cpp", "src/huks_agree_x25519_test.cpp", @@ -71,6 +70,7 @@ ohos_moduletest_suite("ActsHuksNAPITest") { "src/huks_attest_test.cpp", "src/huks_attest_test_common.cpp", "src/huks_signverify_dsa_test.cpp", + "src/huks_agree_dh_test.cpp", ] } diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js index f066bdcc7c8beb643272419851ad7fe616c0ee94..e745a48f4fcdbca60b5b7c2881ea2f2ab495eebf 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js @@ -13,44 +13,52 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it,beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreeCallback'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); +let useSoftware = true; let HuksOptions63kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData63Kb, }; export default function SecurityHuksDHBasicAbort63KBCallbackJsunit() { -describe('SecurityHuksDHBasicAbort63KBCallbackJsunit', function () { - it('testAgreeDH002', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_001'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData63Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); - done(); + describe('SecurityHuksDHBasicAbort63KBCallbackJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + + it('testAgreeDH002', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_001'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData63Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js index 972f8634f5222ff1b946f662b6d6afcc189a74aa..38d8b6930686b0a56051df23824bb6f193a9e0b2 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js @@ -13,44 +13,53 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it,beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreeCallback'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); +let useSoftware = true; + let HuksOptions65kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, }; export default function SecurityHuksDHBasicAbort65KBCallbackJsunit() { -describe('SecurityHuksDHBasicAbort65KBCallbackJsunit', function () { - it('testAgreeDH004', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_001'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData65Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); - done(); + describe('SecurityHuksDHBasicAbort65KBCallbackJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + + it('testAgreeDH004', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_001'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData65Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js index 961d3057503f5648527c5f16f7093c127f11aea3..2e5606aa2bbdc32e7c3624db09f727cbd944f10d 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js @@ -13,44 +13,52 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it,beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreeCallback'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); +let useSoftware = true; let HuksOptions63kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData63Kb, }; export default function SecurityHuksDHBasicFinish63KBCallbackJsunit() { -describe('SecurityHuksDHBasicFinish63KBCallbackJsunit', function () { - it('testAgreeDH001', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_001'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData63Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); - done(); + describe('SecurityHuksDHBasicFinish63KBCallbackJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + + it('testAgreeDH001', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_001'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData63Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js index 57dccdde4580901ff45082918792c2b0cecc8374..41bd3af01432b0c32ecd9ff7c362df0ae3d08cbc 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js @@ -13,44 +13,52 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it,beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreeCallback'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); +let useSoftware = true; let HuksOptions65kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, }; export default function SecurityHuksDHBasicFinish65KBCallbackJsunit() { -describe('SecurityHuksDHBasicFinish65KBCallbackJsunit', function () { - it('testAgreeDH003', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_001'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData65Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'finish'); - done(); + describe('SecurityHuksDHBasicFinish65KBCallbackJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + + it('testAgreeDH003', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_001'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData65Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'finish'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js index d782297b4ce4088c2564cba4ac381fcdd5693bf5..86680e023e61f95ac35248b295a13894761a9f34 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js @@ -13,14 +13,15 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it, beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreePromise'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); +let useSoftware = true; let HuksOptions63kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), @@ -28,29 +29,35 @@ let HuksOptions63kb = { }; export default function SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit() { -describe('SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit', function () { - it('testAgreeDH102', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_101'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData63Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); - done(); + describe('SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + it('testAgreeDH102', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_101'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData63Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js index 652368a20b939c64c372997368e51723f0a33c81..b330ce41a7f28dec86b6277a4b05452b0ba706d7 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js @@ -13,44 +13,50 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it, beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreePromise'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); - +let useSoftware = true; let HuksOptions65kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, }; export default function SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit() { -describe('SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit', function () { - it('testAgreeDH104', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_101'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData65Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); - done(); + describe('SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + it('testAgreeDH104', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_101'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData65Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js index 9fca85d6012145a836c449af58a8b1cc33d2ba2f..9803fb2892e087011d5ebb5ea4bbb02fb0430489 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js @@ -13,44 +13,50 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it, beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreePromise'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); - +let useSoftware = true; let HuksOptions63kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData63Kb, }; export default function SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit() { -describe('SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit', function () { - it('testAgreeDH101', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_101'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData63Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); - done(); + describe('SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + it('testAgreeDH101', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_101'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData63Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js index adbdd73a05bcdfa474d319e8585550dcf06704d2..b18dd4a1b83b52512d26dc382bf62d0e1101a94b 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js @@ -13,44 +13,51 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it, beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreePromise'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); +let useSoftware = true; let HuksOptions65kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, }; export default function SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit() { -describe('SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit', function () { - it('testAgreeDH103', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_101'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData65Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'finish'); - done(); + describe('SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + it('testAgreeDH103', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_101'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData65Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'finish'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js b/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js index 0181b281b7ab2d08b61be7c1a7235c2cb64f814b..d389231b6bcefee8f282d22a7caa2c85ec6fbf77 100644 --- a/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js +++ b/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js @@ -13,44 +13,52 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it ,beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreeCallback'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); +let useSoftware = true; let HuksOptions63kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData63Kb, }; export default function SecurityHuksDHBasicAbort63KBCallbackJsunit() { -describe('SecurityHuksDHBasicAbort63KBCallbackJsunit', function () { - it('testReformedAgreeDH002', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_001'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData63Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); - done(); + describe('SecurityHuksDHBasicAbort63KBCallbackJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + + it('testReformedAgreeDH002', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_001'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData63Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js b/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js index e4f69c96e08af7673ff0ce179072e72ae65966c1..107b7f973a4ac7456b6074c285690156ae4ed9f9 100644 --- a/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js +++ b/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js @@ -13,44 +13,52 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it,beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreeCallback'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); +let useSoftware = true; let HuksOptions65kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, }; export default function SecurityHuksDHBasicAbort65KBCallbackJsunit() { -describe('SecurityHuksDHBasicAbort65KBCallbackJsunit', function () { - it('testReformedAgreeDH004', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_001'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData65Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); - done(); + describe('SecurityHuksDHBasicAbort65KBCallbackJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + + it('testReformedAgreeDH004', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_001'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData65Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js b/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js index 80e8dec30bc60d15bd8b376d500fab4fb1710dd2..dfcba98c98b7d0c9535c5c0e6c0b1ec8dce510fb 100644 --- a/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js +++ b/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js @@ -13,44 +13,52 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it,beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreeCallback'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); +let useSoftware = true; let HuksOptions63kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData63Kb, }; export default function SecurityHuksDHBasicFinish63KBCallbackJsunit() { -describe('SecurityHuksDHBasicFinish63KBCallbackJsunit', function () { - it('testReformedAgreeDH001', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_001'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData63Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); - done(); + describe('SecurityHuksDHBasicFinish63KBCallbackJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + + it('testReformedAgreeDH001', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_001'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData63Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js b/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js index 498abb07bbab69b6ad87a019f6eba44f412c174f..d0af1800acb632235f441478adb0447faf0e456c 100644 --- a/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js +++ b/security/security_huks_reformed_test/huks_agree_callback_BasicTest/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js @@ -23,6 +23,7 @@ let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); let useSoftware = true; + let HuksOptions2048 = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, @@ -69,7 +70,9 @@ export default function SecurityHuksDHBasicFinish65KBCallbackJsunit() { const srcKeyAliesFirst = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_001'; const srcKeyAliesSecond = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_001'; let huksOptionsFinish = makehuksOptionsFinish(srcKeyAliesFirst); - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions2048, huksOptionsFinish, 'finish'); + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions2048, huksOptionsFinish, 'finish'); + }; done(); }); diff --git a/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js b/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js index 9c443853f990b86c1baf2ab18f2ca60dec9b0e31..c4e76f08b24628ce79e90b5a65414c7f1158f9d1 100644 --- a/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js +++ b/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js @@ -13,44 +13,53 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it,beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreePromise'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); +let useSoftware = true; + let HuksOptions63kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData63Kb, }; export default function SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit() { -describe('SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit', function () { - it('testReformedAgreeDH102', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_101'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData63Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); - done(); + describe('SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + + it('testReformedAgreeDH102', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_101'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData63Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js b/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js index d841df504f03ce610cc5fa4204f1adf72cf96933..55ec40c0c0184d2230ba9774d086613493297610 100644 --- a/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js +++ b/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js @@ -13,44 +13,50 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it, beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreePromise'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); - +let useSoftware = true; let HuksOptions65kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, }; export default function SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit() { -describe('SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit', function () { - it('testReformedAgreeDH104', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_101'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData65Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); - done(); + describe('SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + it('testReformedAgreeDH104', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_101'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData65Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js b/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js index 26a2632bd6def2430f423f7b9147556d14b2c9ba..c53ded7dace857700cda3f39744aabf58fb8b5ca 100644 --- a/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js +++ b/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js @@ -13,44 +13,50 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it,beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreePromise'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); - +let useSoftware = true; let HuksOptions63kb = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData63Kb, }; export default function SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit() { -describe('SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit', function () { - it('testReformedAgreeDH101', 0, async function (done) { - const srcKeyAliesFirst = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_101'; - let huksOptionsFinish = { - properties: new Array( - HuksAgreeDH.HuksKeySTORAGE, - HuksAgreeDH.HuksKeyISKEYALIAS, - HuksAgreeDH.HuksKeyALGORITHMAES, - HuksAgreeDH.HuksKeySIZE256, - HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, - HuksAgreeDH.HuksKeyDIGESTNONE, - { - tag: HksTag.HKS_TAG_KEY_ALIAS, - value: stringToUint8Array(srcKeyAliesFirst), - }, - HuksAgreeDH.HuksKeyPADDINGNONE, - HuksAgreeDH.HuksKeyBLOCKMODEECB - ), - inData: srcData63Kb, - }; - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); - done(); + describe('SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) + it('testReformedAgreeDH101', 0, async function (done) { + const srcKeyAliesFirst = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_101'; + let huksOptionsFinish = { + properties: new Array( + HuksAgreeDH.HuksKeySTORAGE, + HuksAgreeDH.HuksKeyISKEYALIAS, + HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeySIZE256, + HuksAgreeDH.HuksKeyPurposeENCRYPTDECRYPT, + HuksAgreeDH.HuksKeyDIGESTNONE, + { + tag: HksTag.HKS_TAG_KEY_ALIAS, + value: stringToUint8Array(srcKeyAliesFirst), + }, + HuksAgreeDH.HuksKeyPADDINGNONE, + HuksAgreeDH.HuksKeyBLOCKMODEECB + ), + inData: srcData63Kb, + }; + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); + }; + done(); + }); }); -}); } diff --git a/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js b/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js index 417ddfc22de5357f4b32cc56a4e3445665b3cba5..57e46ff6391ec52b623e032239b524078b508fe3 100644 --- a/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js +++ b/security/security_huks_reformed_test/huks_agree_promise_BasicTest/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js @@ -13,21 +13,22 @@ * limitations under the License. */ -import { describe, it } from '@ohos/hypium'; +import { describe, it,beforeAll } from '@ohos/hypium'; import * as Data from '../../../../../../utils/data.json'; -import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc'; import { HuksAgreeDH } from '../../../../../../utils/param/agree/publicAgreeParam'; import { publicAgreeFunc } from '../../../../../../utils/param/agree/publicAgreePromise'; import { HksTag } from '../../../../../../utils/param/publicParam'; let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); +let useSoftware = true; let HuksOptions2048 = { properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, }; -function makehuksOptionsFinish(srcKeyAliesFirst){ +function makehuksOptionsFinish(srcKeyAliesFirst) { let huksOptionsFinish = { properties: new Array( HuksAgreeDH.HuksKeySTORAGE, @@ -48,10 +49,10 @@ function makehuksOptionsFinish(srcKeyAliesFirst){ return huksOptionsFinish; } -function makehuksOptionsDerive(srcKeyAliesFirst){ +function makehuksOptionsDerive(srcKeyAliesFirst) { let huksOptionsFinish = { properties: new Array( - HuksAgreeDH.HuksKeyALGORITHMAES, + HuksAgreeDH.HuksKeyALGORITHMAES, HuksAgreeDH.HuksKeyPurposeDERIVE, HuksAgreeDH.HuksKeyDIGESTSHA256, HuksAgreeDH.HuksKeySIZE256, @@ -69,7 +70,7 @@ function makehuksOptionsDerive(srcKeyAliesFirst){ return huksOptionsFinish; } -function makehuksOptionsHmac(srcKeyAliesFirst){ +function makehuksOptionsHmac(srcKeyAliesFirst) { let huksOptionsFinish = { properties: new Array( HuksAgreeDH.HuksKeyALGORITHMHMAC, @@ -92,11 +93,17 @@ function makehuksOptionsHmac(srcKeyAliesFirst){ export default function SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit() { describe('SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit', function () { + beforeAll(async function (done) { + useSoftware = await checkSoftware(); + done(); + }) it('testReformedAgreeDH103', 0, async function (done) { const srcKeyAliesFirst = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_101'; const srcKeyAliesSecond = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_101'; let huksOptionsFinish = makehuksOptionsFinish(srcKeyAliesFirst); - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions2048, huksOptionsFinish, 'finish'); + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions2048, huksOptionsFinish, 'finish'); + }; done(); }); @@ -104,7 +111,9 @@ export default function SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit() { const srcKeyAliesFirst = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_108'; const srcKeyAliesSecond = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_108'; let huksOptionsFinish = makehuksOptionsDerive(srcKeyAliesFirst); - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions2048, huksOptionsFinish, 'finish'); + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions2048, huksOptionsFinish, 'finish'); + }; done(); }); @@ -112,7 +121,9 @@ export default function SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit() { const srcKeyAliesFirst = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_130'; const srcKeyAliesSecond = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_130'; let huksOptionsFinish = makehuksOptionsHmac(srcKeyAliesFirst); - await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions2048, huksOptionsFinish, 'finish'); + if (useSoftware) { + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions2048, huksOptionsFinish, 'finish'); + }; done(); }); });