diff --git a/security/cipher/datacipher/BUILD.gn b/security/cipher/datacipher/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..32f35557b9a384aec8ed9136e9b9b084db3263dc --- /dev/null +++ b/security/cipher/datacipher/BUILD.gn @@ -0,0 +1,20 @@ +# 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") + +group("datacipher") { + testonly = true + if (is_standard_system) { + deps = [ "cipher:HitsSecurityCipherTest" ] + } +} diff --git a/security/cipher/datacipher/cipher/BUILD.gn b/security/cipher/datacipher/cipher/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e1115ea2ae452141d3c42702b57d9bbc3898f901 --- /dev/null +++ b/security/cipher/datacipher/cipher/BUILD.gn @@ -0,0 +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("HitsSecurityCipherTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":huks_js_assets", + ":huks_js_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "HitsSecurityCipherTest" +} +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/cipher/datacipher/cipher/Test.json b/security/cipher/datacipher/cipher/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..39fcb66ab4eb025bc3db87807c60b1b37aefddda --- /dev/null +++ b/security/cipher/datacipher/cipher/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for keystoretest js api Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "4200000", + "package": "com.huawei.keystoretest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "HitsSecurityCipherTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/security/cipher/datacipher/cipher/entry/src/main/config.json b/security/cipher/datacipher/cipher/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a533ea4d2dcad1d3aa1442781245cf1d816e8884 --- /dev/null +++ b/security/cipher/datacipher/cipher/entry/src/main/config.json @@ -0,0 +1,64 @@ +{ + "app": { + "bundleName": "com.huawei.keystoretest", + "vendor": "huawei", + "version": { + "code": 1, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 6, + "target": 6, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.keystoretest", + "name": ".MyApplication", + "mainAbility": "com.huawei.keystoretest.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.huawei.keystoretest.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard", + "visible": true, + "isVisible": "true" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/app.js b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..bd5ae64a246945132c418cb72c795d5ba12c8f8a --- /dev/null +++ b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/app.js @@ -0,0 +1,23 @@ +/* + * 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. + */ + +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + }, +}; diff --git a/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/i18n/en-US.json b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..7f21065f105c8ff8fabc971f5e5161ab30c73d2d --- /dev/null +++ b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,7 @@ +{ + "strings": { + "hello": "Hello", + "world": "world", + "start": "test start" + } +} \ No newline at end of file diff --git a/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/i18n/zh-CN.json b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..29bea0fd91faa67602a08572d6feea8b79a0067b --- /dev/null +++ b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,7 @@ +{ + "strings": { + "hello": "您好", + "world": "世界", + "start": "测试开始" + } +} \ No newline at end of file diff --git a/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/pages/index/index.css b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..50637f89ac7ae3d1ce45a4ad565eb4eab743709e --- /dev/null +++ b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,46 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #ffffff; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url('/common/images/Wallpaper.png'); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #ffffff; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} diff --git a/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/pages/index/index.hml b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..201249a906e694fc042d0e967049a3eff15edfe2 --- /dev/null +++ b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
\ No newline at end of file diff --git a/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/pages/index/index.js b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..764001cef986c1922056a382084c79e9017ca814 --- /dev/null +++ b/security/cipher/datacipher/cipher/entry/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,40 @@ +/* + * 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 { Core, ExpectExtend } from 'deccjsunit/index'; + +export default { + data: { + title: '', + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + id: 'extend', + }); + core.addService('expect', expectExtend); + core.init(); + const configService = core.getDefaultService('config'); + this.timeout = 1500000; + configService.setConfig(this); + console.log('test start'); + require('../../../test/List.test'); + core.execute(); + }, + onReady() {}, +}; diff --git a/security/cipher/datacipher/cipher/entry/src/main/js/resources/base/element/string.json b/security/cipher/datacipher/cipher/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c0dd3a09e5dcefc69f22b5e00e92296f1c3f55a5 --- /dev/null +++ b/security/cipher/datacipher/cipher/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/security/cipher/datacipher/cipher/entry/src/main/js/resources/base/media/icon.png b/security/cipher/datacipher/cipher/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/security/cipher/datacipher/cipher/entry/src/main/js/resources/base/media/icon.png differ diff --git a/security/cipher/datacipher/cipher/entry/src/main/js/test/Agree/hitscipher.test.js b/security/cipher/datacipher/cipher/entry/src/main/js/test/Agree/hitscipher.test.js new file mode 100644 index 0000000000000000000000000000000000000000..82e9b69d7f9f1cfa33a6ef81d5aceb62af2b6b84 --- /dev/null +++ b/security/cipher/datacipher/cipher/entry/src/main/js/test/Agree/hitscipher.test.js @@ -0,0 +1,240 @@ +/* + * Copyright (C) 2022 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import cipher from '@system.cipher'; +describe('hitscipher.test.js', function () { + let plainTextRsa; + let cipherTextRsa; + let rsaPublicKey; + let rsaPrivateKey; + let plainTestAes; + let cipherTextAes; + let aesKey; + let cipherResultFail; + beforeAll(function () { + plainTextRsa = 'Hello,World! 123 rsa key2###'; + cipherTextRsa = 'EGyJbxPvBjX4m+hxfbFxojT9KjjLII7Sz8NmjWiy/K+F4WvlGhSOQS9RME2hu208EjvaLvKTgv7Ijo2\n' + + 'dGKO0OD4UlEI3LiNFT+cFhfXIVYs16vKQhWtkJEfkJIPjmO5NekxpelYcqmdxUqq5T/7+uq4vRbVyK1/4P57VWLyMTM='; + rsaPublicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCU9YGbkTHKMi6iFFiPC8fYQkrt\n' + + 'jG9Y3gwmQkhDD31MtqvaMZyIus2eKZcAiSIGE8Yt3j0Y5Yej6m5OYxICB9oZ88T4\n' + + 'SoaaUsh/hb7HyUFEWWcGHQEFXNLWtRXs+LCPE6/VETbY66o+BcALlUxyQeq8AqK7\n' + + 'ahs3QFPDo5+CSwxIoQIDAQAB'; + rsaPrivateKey = 'MIICXQIBAAKBgQCU9YGbkTHKMi6iFFiPC8fYQkrtjG9Y3gwmQkhQQ31MtqvaMZyI\n' + + 'us2eKZcAiSIGE8Yt3j0Y5Yej6m5OYxICB9oZ88T4SoaaUsh/hb7HyUFEWWcGHQEF\n' + + 'XNLWtRXs+LCPE6/VETbY66o+BcALlUxyQeq8AqK7ahs3QFPDo5+CSwxIoQIDAQAB\n' + + 'AoGAAPIIfDotgfIbExLfsG3G5fEe9ZbM7kVH25JOuF3ycUIrQnk81RJTDJbxItJw\n' + + 'JbKKzZTWTVNylvw7JzkHdLZvrNzsI8c/0abMrl64ZUugtumhkmrn6xW6H6z4GQnR\n' + + 'havHgRlFL2giWX99J/bMRntMzGCXH8elwIwuPZrYCcdQ5PECQQDw+qsWqTGJyGXr\n' + + 'SGyR5Djn+ZAuqFQvfH6vj6b2ridSbZ0RKgRGTXgH4JsaNnqnVpGilWjUHVbSRvPD\n' + + 'lZu28qpNAkEAnj52PkGPG9tvG4eaC4Y+LNDKOcU4Ybn07Jz+mZwOGkxb8sgw/kw6\n' + + 'H8xPV/7F7GWLjopUsaHnWuWIegzxQY8ZpQJBAKdmGm+VfRovoc099F2sYnOTA7vF\n' + + 'pvWNoBuo+N0nwZ0bFB8WRv3nVthyCIy/B5kzI9wvz7B56RQNwcxqmM8P54kCQAbY\n' + + 'Zt8MkPdAh87mD8jdlsSzh3v2RxkbJTgzFmRotsd2dCfNdykYtRN5EBmbYM54GhBh\n' + + 'dYZlnX92HHBDLRCL8y0CQQDuKZNoBooqVUwcrCFqpeAX/bGYiVmFxcIqyu5vYzVJ\n' + + 'Ff5Fpkxm4FLmrjhiGwL1CKIm5RRL9kT6tsv4do6ALylb'; + plainTestAes = '%%%%Hello,World! 123 aes key2###(^^^)'; + cipherTextAes = 'IclkeCOt6pPODqNyprSZizYdJLBFLwXsEFJo34IJwZp7JmfQJXDbqGpexINBMke4'; + aesKey = 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjMONTY3ODkwMzI='; + cipherResultFail = false; + }); + beforeEach(function () {console.log('xxx')}); + afterEach(function () {}); + + /** + * @tc.number SUB_SEC_DataPro_cipher_2400 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_2400', 4, function () { + for (var j = 0; j < 1000; j++) + { + cipher.rsa({ + action: 'encrypt', + text: plainTextRsa, + key: rsaPublicKey, + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + }, + fail: (data, code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.rsa encrypt fail: ${code}: ${data}`); + expect(cipherResultFail).asset(false); + }, + complete: () => { + } + }); + cipher.rsa({ + action: 'decrypt', + text: cipherTextRsa, + key: rsaPrivateKey, + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + }, + fail: (data, code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.rsa encrypt fail: ${code}: ${data}`); + expect(cipherResultFail).asset(false); + }, + complete: () => { + } + }); + } + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_2500 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_2500', 4, function () { + for (var i = 0; i < 1000; i++) + { + cipher.aes({ + action: 'encrypt', + text: plainTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.rsa encrypt fail: ${code}: ${data}`); + expect(cipherResultFail).asset(false); + }, + complete: () => { + } + }); + cipher.aes({ + action: 'decrypt', + text: cipherTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.rsa encrypt fail: ${code}: ${data}`); + expect(cipherResultFail).asset(false); + }, + complete: () => { + } + }); + } + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_2600 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_2600', 3, function () { + var timestamp1 = new Date().getTime(); + for (var j = 0; j < 10; j++) + { + cipher.rsa({ + action: 'encrypt', + text: plainTextRsa, + key: rsaPublicKey, + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.rsa encrypt fail: ${code}: ${data}`); + }, + complete: () => { + } + }); + cipher.rsa({ + action: 'decrypt', + text: cipherTextRsa, + key: rsaPrivateKey, + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + }, + fail: (data, code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.rsa encrypt fail: ${code}: ${data}`); + }, + complete: () => { + } + }); + } + var timestamp2 = new Date().getTime(); + if ((timestamp2-timestamp1) < 600){ + cipherResultFail = true; + } + expect(cipherResultFail).assertTrue(); + console.log(`cipher.rsa performance time: ${timestamp2-timestamp1}`); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_2700 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_2700', 3, function () { + var timestamp1 = new Date().getTime(); + for (var i = 0; i < 10; i++) + { + cipher.aes({ + action: 'encrypt', + text: plainTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.aes encrypt fail: ${code}: ${data}`); + }, + complete: () => { + } + }); + cipher.aes({ + action: 'decrypt', + text: cipherTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + }, + fail: (data, code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.aes decrypt fail: ${code}: ${data}`); + }, + complete: () => { + } + }); + } + var timestamp2 = new Date().getTime(); + if ((timestamp2-timestamp1) < 20){ + cipherResultFail = true; + } + expect(cipherResultFail).assertTrue(); + console.log(`cipher.rsa performance time: ${timestamp2-timestamp1}`); + }); +}); \ No newline at end of file diff --git a/security/cipher/datacipher/cipher/entry/src/main/js/test/List.test.js b/security/cipher/datacipher/cipher/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..57e03c70fc02c37cb874554e06a39f9f2672b3e6 --- /dev/null +++ b/security/cipher/datacipher/cipher/entry/src/main/js/test/List.test.js @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2022 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. + */ + +require('./Agree/hitscipher.test.js'); diff --git a/security/cipher/datacipher/cipher/signature/openharmony_sx.p7b b/security/cipher/datacipher/cipher/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/security/cipher/datacipher/cipher/signature/openharmony_sx.p7b differ diff --git a/security/cipher/datacipher2/BUILD.gn b/security/cipher/datacipher2/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c927b93e6abf39ea6d7aea03cf6f0cf7aeff8c7c --- /dev/null +++ b/security/cipher/datacipher2/BUILD.gn @@ -0,0 +1,20 @@ +# 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") + +group("datacipher2") { + testonly = true + if (is_standard_system) { + deps = [ "cipher:HitsSecurityCipherTest2" ] + } +} diff --git a/security/cipher/datacipher2/cipher/BUILD.gn b/security/cipher/datacipher2/cipher/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d4c7ad0706fc5b8cb2762a0ccffe7f45f55c1a70 --- /dev/null +++ b/security/cipher/datacipher2/cipher/BUILD.gn @@ -0,0 +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("HitsSecurityCipherTest2") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":huks_js_assets", + ":huks_js_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "HitsSecurityCipherTest2" +} +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/cipher/datacipher2/cipher/Test.json b/security/cipher/datacipher2/cipher/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b47091c77cdeefc67555d5ca693c7673dcbee3a1 --- /dev/null +++ b/security/cipher/datacipher2/cipher/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for keystoretest js api Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "4200000", + "package": "com.huawei.keystoretest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "HitsSecurityCipherTest2.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/security/cipher/datacipher2/cipher/entry/src/main/config.json b/security/cipher/datacipher2/cipher/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a533ea4d2dcad1d3aa1442781245cf1d816e8884 --- /dev/null +++ b/security/cipher/datacipher2/cipher/entry/src/main/config.json @@ -0,0 +1,64 @@ +{ + "app": { + "bundleName": "com.huawei.keystoretest", + "vendor": "huawei", + "version": { + "code": 1, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 6, + "target": 6, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.keystoretest", + "name": ".MyApplication", + "mainAbility": "com.huawei.keystoretest.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.huawei.keystoretest.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard", + "visible": true, + "isVisible": "true" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/app.js b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..bd5ae64a246945132c418cb72c795d5ba12c8f8a --- /dev/null +++ b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/app.js @@ -0,0 +1,23 @@ +/* + * 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. + */ + +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + }, +}; diff --git a/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/i18n/en-US.json b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..7f21065f105c8ff8fabc971f5e5161ab30c73d2d --- /dev/null +++ b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,7 @@ +{ + "strings": { + "hello": "Hello", + "world": "world", + "start": "test start" + } +} \ No newline at end of file diff --git a/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/i18n/zh-CN.json b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..29bea0fd91faa67602a08572d6feea8b79a0067b --- /dev/null +++ b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,7 @@ +{ + "strings": { + "hello": "您好", + "world": "世界", + "start": "测试开始" + } +} \ No newline at end of file diff --git a/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/pages/index/index.css b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..50637f89ac7ae3d1ce45a4ad565eb4eab743709e --- /dev/null +++ b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,46 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #ffffff; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url('/common/images/Wallpaper.png'); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #ffffff; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} diff --git a/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/pages/index/index.hml b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..201249a906e694fc042d0e967049a3eff15edfe2 --- /dev/null +++ b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
\ No newline at end of file diff --git a/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/pages/index/index.js b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..764001cef986c1922056a382084c79e9017ca814 --- /dev/null +++ b/security/cipher/datacipher2/cipher/entry/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,40 @@ +/* + * 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 { Core, ExpectExtend } from 'deccjsunit/index'; + +export default { + data: { + title: '', + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + id: 'extend', + }); + core.addService('expect', expectExtend); + core.init(); + const configService = core.getDefaultService('config'); + this.timeout = 1500000; + configService.setConfig(this); + console.log('test start'); + require('../../../test/List.test'); + core.execute(); + }, + onReady() {}, +}; diff --git a/security/cipher/datacipher2/cipher/entry/src/main/js/resources/base/element/string.json b/security/cipher/datacipher2/cipher/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c0dd3a09e5dcefc69f22b5e00e92296f1c3f55a5 --- /dev/null +++ b/security/cipher/datacipher2/cipher/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/security/cipher/datacipher2/cipher/entry/src/main/js/resources/base/media/icon.png b/security/cipher/datacipher2/cipher/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/security/cipher/datacipher2/cipher/entry/src/main/js/resources/base/media/icon.png differ diff --git a/security/cipher/datacipher2/cipher/entry/src/main/js/test/Agree/cipher1.test.js b/security/cipher/datacipher2/cipher/entry/src/main/js/test/Agree/cipher1.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f03b7ea075929c5912aa76c883c65716f4ff6d00 --- /dev/null +++ b/security/cipher/datacipher2/cipher/entry/src/main/js/test/Agree/cipher1.test.js @@ -0,0 +1,436 @@ +/* + * Copyright (C) 2022 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/lite/interface' +import cipher from '@system.cipher'; +describe('hitscipher.test.js', function () { + let plainTextRsa; + let cipherTextRsa; + let rsaPublicKey; + let rsaPrivateKey; + let plainTextAes; + let cipherTextAes; + let aesKey; + let cipherResult; + let cipherResultFail; + beforeAll(function () { + plainTextRsa = 'Hello,World! 123 rsa key2###'; + cipherTextRsa = 'EGyJbxPvBjX4m+hxfbFxojT9KjjLII7Sz8NmjWiy/K+F4WvlGhSOQS9RME2hu208EjvaLvKTgv7Ijo2\n' + + 'dGKO0OD4UlEI3LiNFT+cFhfXIVYs16vKQhWtkJEfkJIPjmO5NekxpelYcqmdxUqq5T/7+uq4vRbVyK1/4P57VWLyMTM='; + rsaPublicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCU9YGbkTHKMi6iFFiPC8fYQkrt\n' + + 'jG9Y3gwmQkhDD31MtqvaMZyIus2eKZcAiSIGE8Yt3j0Y5Yej6m5OYxICB9oZ88T4\n' + + 'SoaaUsh/hb7HyUFEWWcGHQEFXNLWtRXs+LCPE6/VETbY66o+BcALlUxyQeq8AqK7\n' + + 'ahs3QFPDo5+CSwxIoQIDAQAB'; + rsaPrivateKey = 'MIICXQIBAAKBgQCU9YGbkTHKMi6iFFiPC8fYQkrtjG9Y3gwmQkhQQ31MtqvaMZyI\n' + + 'us2eKZcAiSIGE8Yt3j0Y5Yej6m5OYxICB9oZ88T4SoaaUsh/hb7HyUFEWWcGHQEF\n' + + 'XNLWtRXs+LCPE6/VETbY66o+BcALlUxyQeq8AqK7ahs3QFPDo5+CSwxIoQIDAQAB\n' + + 'AoGAAPIIfDotgfIbExLfsG3G5fEe9ZbM7kVH25JOuF3ycUIrQnk81RJTDJbxItJw\n' + + 'JbKKzZTWTVNylvw7JzkHdLZvrNzsI8c/0abMrl64ZUugtumhkmrn6xW6H6z4GQnR\n' + + 'havHgRlFL2giWX99J/bMRntMzGCXH8elwIwuPZrYCcdQ5PECQQDw+qsWqTGJyGXr\n' + + 'SGyR5Djn+ZAuqFQvfH6vj6b2ridSbZ0RKgRGTXgH4JsaNnqnVpGilWjUHVbSRvPD\n' + + 'lZu28qpNAkEAnj52PkGPG9tvG4eaC4Y+LNDKOcU4Ybn07Jz+mZwOGkxb8sgw/kw6\n' + + 'H8xPV/7F7GWLjopUsaHnWuWIegzxQY8ZpQJBAKdmGm+VfRovoc099F2sYnOTA7vF\n' + + 'pvWNoBuo+N0nwZ0bFB8WRv3nVthyCIy/B5kzI9wvz7B56RQNwcxqmM8P54kCQAbY\n' + + 'Zt8MkPdAh87mD8jdlsSzh3v2RxkbJTgzFmRotsd2dCfNdykYtRN5EBmbYM54GhBh\n' + + 'dYZlnX92HHBDLRCL8y0CQQDuKZNoBooqVUwcrCFqpeAX/bGYiVmFxcIqyu5vYzVJ\n' + + 'Ff5Fpkxm4FLmrjhiGwL1CKIm5RRL9kT6tsv4do6ALylb'; + plainTextAes = '%%%%Hello,World! 123 aes key2###(^^^)'; + cipherTextAes = 'IclkeCOt6pPODqNyprSZizYdJLBFLwXsEFJo34IJwZp7JmfQJXDbqGpexINBMke4'; + aesKey = 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjMONTY3ODkwMzI='; + cipherResult = true; + cipherResultFail = false; + }); + beforeEach(function () {}); + afterEach(function () {}); + + /** + * @tc.number SUB_SEC_DataPro_cipher_1300 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_1300', 2, function () { + cipher.aes({ + action: 'encrypt123', + text: plainTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes encrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data, code) => { + this.err = `${code}: ${data}`; + console.log(`action is invalid, cipher.aes encrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_1400 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_1400', 2, function () { + cipher.aes({ + action: 'encrypt', + text: plainTextAes, + key: '439B96R030A475BF9E2D0BEF8W56C5BD', + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes encrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`action is invalid, cipher.aes encrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_1500 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_1500', 2, function () { + cipher.aes({ + action: 'encrypt', + text: '~!@#$%^&*()_+<>?:"~,./183456789012345678901234567890123456789', + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes encrypt success: ${data.text}`); + expect(cipherResult).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.aes encrypt fail: ${code}: ${data}`); + expect(cipherResultFail).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_1600 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_1600', 2, function () { + cipher.aes({ + action: 'encrypt', + text: plainTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 15, + success: data => { + console.log(`cipher.aes encrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`action is invalid, cipher.aes encrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + cipher.aes({ + action: 'encrypt', + text: plainTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes encrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data, code) => { + this.err = `${code}: ${data}`; + console.log(`iv is invalid, cipher.aes encrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_1700 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_1700', 2, function () { + cipher.aes({ + action: 'encrypt', + text: plainTextAes, + key: aesKey, + transformation: 'AES', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes encrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`transformation is invalid, cipher.aes encrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_1800 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_1800', 2, function () { + cipher.aes({ + action: 'decrypt123', + text: cipherTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes encrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`ation is invalid, cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_1900 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_1900', 3, function () { + cipher.aes({ + action: 'decrypt', + text: cipherTextAes, + key: '439B96R030A475BF9E2D0BEF8W56C5BD', + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes decrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`key is invalid, cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_2000 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_2000', 3, function () { + cipher.aes({ + action: 'decrypt', + text: '~!@#$%^&*()_+<>?:"~,./183456789012345678901234567890123456789', + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes decrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_2100 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_2100', 3, function () { + cipher.aes({ + action: 'decrypt', + text: cipherTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes decrypt success: ${data.text}`); + expect(cipherResult).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResultFail).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + cipher.aes({ + action: 'decrypt', + text: cipherTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Njc4', + ivOffset: 2, + ivLen: 18, + success: data => { + console.log(`cipher.aes decrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`ivlen is invalid,cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_2200 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_2200', 3, function () { + cipher.aes({ + action: 'decrypt', + text: cipherTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + ivOffset: -1, + ivLen: 16, + success: data => { + console.log(`cipher.aes decrypt success: ${data.text}`); + expect(cipherResult).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`ivOffset is invalid, cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + cipher.aes({ + action: 'decrypt', + text: cipherTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Njc4', + ivOffset: 2, + ivLen: 16, + success: data => { + console.log(`cipher.aes decrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResultFail).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_2300 + * @tc.name Pressure test on the RSA algorithm encryption and decryption interface + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_2300', 3, function () { + cipher.aes({ + action: 'decrypt', + text: cipherTextAes, + key: aesKey, + transformation: 'AES', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes decrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`transformation is invalid, cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); +}); \ No newline at end of file diff --git a/security/cipher/datacipher2/cipher/entry/src/main/js/test/Agree/cipher2.test.js b/security/cipher/datacipher2/cipher/entry/src/main/js/test/Agree/cipher2.test.js new file mode 100644 index 0000000000000000000000000000000000000000..315052b78be750592159bc245371ee8661363555 --- /dev/null +++ b/security/cipher/datacipher2/cipher/entry/src/main/js/test/Agree/cipher2.test.js @@ -0,0 +1,418 @@ +/* + * Copyright (C) 2022 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/lite/interface' +import cipher from '@system.cipher'; +describe('hitscipher.test.js', function () { + let plainTextRsa; + let cipherTextRsa; + let rsaPublicKey; + let rsaPrivateKey; + let plainTextAes; + let cipherTextAes; + let aesKey; + let cipherResult; + let cipherResultFail; + beforeAll(function () { + plainTextRsa = 'Hello,World! 123 rsa key2###'; + cipherTextRsa = 'EGyJbxPvBjX4m+hxfbFxojT9KjjLII7Sz8NmjWiy/K+F4WvlGhSOQS9RME2hu208EjvaLvKTgv7Ijo2\n'+ + 'dGKO0OD4UlEI3LiNFT+cFhfXIVYs16vKQhWtkJEfkJIPjmO5NekxpelYcqmdxUqq5T/7+uq4vRbVyK1/4P57VWLyMTM='; + rsaPublicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCU9YGbkTHKMi6iFFiPC8fYQkrt\n' + + 'jG9Y3gwmQkhDD31MtqvaMZyIus2eKZcAiSIGE8Yt3j0Y5Yej6m5OYxICB9oZ88T4\n' + + 'SoaaUsh/hb7HyUFEWWcGHQEFXNLWtRXs+LCPE6/VETbY66o+BcALlUxyQeq8AqK7\n' + + 'ahs3QFPDo5+CSwxIoQIDAQAB'; + rsaPrivateKey = 'MIICXQIBAAKBgQCU9YGbkTHKMi6iFFiPC8fYQkrtjG9Y3gwmQkhQQ31MtqvaMZyI\n' + + 'us2eKZcAiSIGE8Yt3j0Y5Yej6m5OYxICB9oZ88T4SoaaUsh/hb7HyUFEWWcGHQEF\n' + + 'XNLWtRXs+LCPE6/VETbY66o+BcALlUxyQeq8AqK7ahs3QFPDo5+CSwxIoQIDAQAB\n' + + 'AoGAAPIIfDotgfIbExLfsG3G5fEe9ZbM7kVH25JOuF3ycUIrQnk81RJTDJbxItJw\n' + + 'JbKKzZTWTVNylvw7JzkHdLZvrNzsI8c/0abMrl64ZUugtumhkmrn6xW6H6z4GQnR\n' + + 'havHgRlFL2giWX99J/bMRntMzGCXH8elwIwuPZrYCcdQ5PECQQDw+qsWqTGJyGXr\n' + + 'SGyR5Djn+ZAuqFQvfH6vj6b2ridSbZ0RKgRGTXgH4JsaNnqnVpGilWjUHVbSRvPD\n' + + 'lZu28qpNAkEAnj52PkGPG9tvG4eaC4Y+LNDKOcU4Ybn07Jz+mZwOGkxb8sgw/kw6\n' + + 'H8xPV/7F7GWLjopUsaHnWuWIegzxQY8ZpQJBAKdmGm+VfRovoc099F2sYnOTA7vF\n' + + 'pvWNoBuo+N0nwZ0bFB8WRv3nVthyCIy/B5kzI9wvz7B56RQNwcxqmM8P54kCQAbY\n' + + 'Zt8MkPdAh87mD8jdlsSzh3v2RxkbJTgzFmRotsd2dCfNdykYtRN5EBmbYM54GhBh\n' + + 'dYZlnX92HHBDLRCL8y0CQQDuKZNoBooqVUwcrCFqpeAX/bGYiVmFxcIqyu5vYzVJ\n' + + 'Ff5Fpkxm4FLmrjhiGwL1CKIm5RRL9kT6tsv4do6ALylb'; + plainTextAes = '%%%%Hello,World! 123 aes key2###(^^^)'; + cipherTextAes = 'IclkeCOt6pPODqNyprSZizYdJLBFLwXsEFJo34IJwZp7JmfQJXDbqGpexINBMke4'; + aesKey = 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjMONTY3ODkwMzI='; + cipherResult = true; + cipherResultFail = false; + }); + beforeEach(function () {}); + afterEach(function () {}); + + /** + * @tc.number SUB_SEC_DataPro_cipher_0100 + * @tc.name RSA algorithm encryption succeeded + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_0100', 0, function () { + cipher.rsa({ + action: 'encrypt', + text: plainTextRsa, + key: rsaPublicKey, + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + console.log(`cipher.rsa encrypt success: ${data.text}`); + expect(cipherResult).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.rsa encrypt fail: ${code}: ${data}`); + expect(cipherResultFail).toBeTrue(); + }, + complete: () => { + console.log(`Rsa encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_0200 + * @tc.name RSA algorithm decryption succeeded + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_0200', 1, function () { + cipher.rsa({ + action: 'decrypt', + text: plainTextRsa, + key: rsaPrivateKey, + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + console.log(`cipher.aes encrypt success: ${data.text}`); + expect(cipherResult).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`action is invalid, cipher.aes encrypt fail: ${code}: ${data}`); + expect(cipherResultFail).toBeTrue(); + }, + complete: () => { + console.log(`Rsa encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_0300 + * @tc.name RSA encryption test when the value of action is abnormal + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_0300', 2, function () { + cipher.rsa({ + action: 'encrypt123', + text: plainTextRsa, + key: rsaPublicKey, + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + console.log(`cipher.rsa encrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`action is invalid,cipher.rsa encrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Rsa encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_0400 + * @tc.name RSA encryption test when the value of action is abnormal + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_0400', 2, function () { + cipher.rsa({ + action: 'encrypt', + text: plainTextRsa, + key: '1234560GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCU9YGbkTHKMi6iFFiPC8fYQkrt\n' + + 'jG9Y3gwmQkhDD31MtqvaMZyIus2eKZcAiSIGE8Yt3j0Y5Yej6m5OYxICB9oZ88T4\n' + + 'SoaaUsh/hb7HyUFEWWcGHQEFXNLWtRXs+LCPE6/VETbY66o+BcALlUxyQeq8AqK7\n' + + 'ahs3QFPDo5+CSwxIoQIDAQAB', + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + console.log(`cipher.rsa encrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`key is invalid, cipher.rsa encrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Rsa encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_0500 + * @tc.name RSA encryption test when the value of action is abnormal + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_0500', 2, function () { + cipher.rsa({ + action: 'encrypt', + text: '~!@#$%^&*()_+<>?:"~,./183456789012345678901234567890123456789', + key: rsaPublicKey, + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + console.log(`cipher.rsa encrypt success: ${data.text}`); + expect(cipherResult).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.rsa encrypt fail: ${code}: ${data}`); + expect(cipherResultFail).toBeTrue(); + }, + complete: () => { + console.log(`Rsa encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_0600 + * @tc.name RSA encryption test when the value of action is abnormal + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_0600', 2, function () { + cipher.rsa({ + action: 'decrypt', + text: plainTextRsa, + key: rsaPublicKey, + transformation: 'RSA', + success: data => { + console.log(`cipher.rsa encrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`transformation is invalid, cipher.rsa decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Rsa encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_0700 + * @tc.name RSA encryption test when the value of action is abnormal + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_0700', 2, function () { + cipher.rsa({ + action: 'decrypt123', + text: cipherTextRsa, + key: rsaPublicKey, + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + console.log(`cipher.rsa decrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`action is invalid, cipher.rsa decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Rsa encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_0800 + * @tc.name RSA encryption test when the value of action is abnormal + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_0800', 3, function () { + cipher.rsa({ + action: 'decrypt', + text: cipherTextRsa, + key: '123456IBAAKBgQCU9YGbkTHKMi6iFFiPC8fYQkrtjG9Y3gwmQkhQQ31MtqvaMZyI\n' + + 'us2eKZcAiSIGE8Yt3j0Y5Yej6m5OYxICB9oZ88T4SoaaUsh/hb7HyUFEWWcGHQEF\n' + + 'XNLWtRXs+LCPE6/VETbY66o+BcALlUxyQeq8AqK7ahs3QFPDo5+CSwxIoQIDAQAB\n' + + 'AoGAAPIIfDotgfIbExLfsG3G5fEe9ZbM7kVH25JOuF3ycUIrQnk81RJTDJbxItJw\n' + + 'JbKKzZTWTVNylvw7JzkHdLZvrNzsI8c/0abMrl64ZUugtumhkmrn6xW6H6z4GQnR\n' + + 'havHgRlFL2giWX99J/bMRntMzGCXH8elwIwuPZrYCcdQ5PECQQDw+qsWqTGJyGXr\n' + + 'SGyR5Djn+ZAuqFQvfH6vj6b2ridSbZ0RKgRGTXgH4JsaNnqnVpGilWjUHVbSRvPD\n' + + 'lZu28qpNAkEAnj52PkGPG9tvG4eaC4Y+LNDKOcU4Ybn07Jz+mZwOGkxb8sgw/kw6\n' + + 'H8xPV/7F7GWLjopUsaHnWuWIegzxQY8ZpQJBAKdmGm+VfRovoc099F2sYnOTA7vF\n' + + 'pvWNoBuo+N0nwZ0bFB8WRv3nVthyCIy/B5kzI9wvz7B56RQNwcxqmM8P54kCQAbY\n' + + 'Zt8MkPdAh87mD8jdlsSzh3v2RxkbJTgzFmRotsd2dCfNdykYtRN5EBmbYM54GhBh\n' + + 'dYZlnX92HHBDLRCL8y0CQQDuKZNoBooqVUwcrCFqpeAX/bGYiVmFxcIqyu5vYzVJ\n' + + 'Ff5Fpkxm4FLmrjhiGwL1CKIm5RRL9kT6tsv4do6ALylb', + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + console.log(`cipher.rsa decrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`key is invalid,cipher.rsa decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Rsa encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_0900 + * @tc.name RSA encryption test when the value of action is abnormal + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_0900', 3, function () { + cipher.rsa({ + action: 'decrypt', + text: '~!@#$%^&*()_+<>?:"~,./183456789012345678901234567890123456789', + key: rsaPrivateKey, + transformation: 'RSA/None/OAEPWithSHA256AndMGF1Padding', + success: data => { + console.log(`cipher.rsa decrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.rsa decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Rsa encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_1000 + * @tc.name RSA encryption test when the value of action is abnormal + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_1000', 3, function () { + cipher.rsa({ + action: 'decrypt', + text: cipherTextRsa, + key: rsaPrivateKey, + transformation: 'RSA', + success: data => { + console.log(`cipher.rsa decrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`transformation is invalid, cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Rsa encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_1100 + * @tc.name The AES algorithm is successfully encrypted + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_1100', 3, function () { + cipher.aes({ + action: 'decrypt', + text: cipherTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes encrypt success: ${data.text}`); + expect(data.text).toEqual(cipherTextAes); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResultFail).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_1200 + * @tc.name The AES algorithm is successfully encrypted + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_1200', 3, function () { + cipher.aes({ + action: 'decrypt', + text: cipherTextAes, + key: aesKey, + transformation: 'AES/CBC/PKCS5Padding', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes encrypt success: ${data.text}`); + expect(data.text).toEqual(plainTextAes); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResultFail).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); + + /** + * @tc.number SUB_SEC_DataPro_cipher_2300 + * @tc.name The AES algorithm is successfully encrypted + * @tc.desc [C-SECURITY-1800] + */ + it('SUB_SEC_DataPro_cipher_2300', 3, function () { + cipher.aes({ + action: 'decrypt', + text: cipherTextAes, + key: aesKey, + transformation: 'AES', + iv: 'MTIzNDU2Nzg5MDEyMzQ1Ng==', + ivOffset: 0, + ivLen: 16, + success: data => { + console.log(`cipher.aes encrypt success: ${data.text}`); + expect(cipherResultFail).toBeTrue(); + }, + fail: (data,code) => { + this.err = `${code}: ${data}`; + console.log(`transformation is invalid,cipher.aes decrypt fail: ${code}: ${data}`); + expect(cipherResult).toBeTrue(); + }, + complete: () => { + console.log(`Aes encrypt end...`); + } + }); + }); +}); \ No newline at end of file diff --git a/security/cipher/datacipher2/cipher/entry/src/main/js/test/List.test.js b/security/cipher/datacipher2/cipher/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..15dd148ff2b25d174a8a095d8e2985d4eb9f1ac8 --- /dev/null +++ b/security/cipher/datacipher2/cipher/entry/src/main/js/test/List.test.js @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2022 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. + */ + +require('./Agree/cipher1.test.js'); diff --git a/security/cipher/datacipher2/cipher/signature/openharmony_sx.p7b b/security/cipher/datacipher2/cipher/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/security/cipher/datacipher2/cipher/signature/openharmony_sx.p7b differ diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/BUILD.gn b/security/security_huks_basic/huks_agree_callback_BasicTest/BUILD.gn index 206be2a3fa9695cb2e06e197cba8a2a97ddb7329..416564fb1c24d63d6e1a660ee324487336d6e2e3 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/BUILD.gn @@ -19,7 +19,7 @@ ohos_js_hap_suite("huksagree_callback_basic_js_test") { ":huks_js_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksAgreeBasicCallbackJSApiTest" + hap_name = "huksAgreeBasicCallbackJSApiTest" } ohos_js_assets("huks_js_assets") { source_dir = "./entry/src/main/js/MainAbility" diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/Test.json b/security/security_huks_basic/huks_agree_callback_BasicTest/Test.json index d339724ca113ad6a3b1d1d67e7f49ba9237091a6..e6919e6d47e8bd91850c34ada1030755f4630770 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/Test.json +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/Test.json @@ -2,14 +2,14 @@ "description": "Configuration for huksAgreeBasicCallback js api Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "4200000", "package": "com.example.huksagreebasiccallback", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsHuksAgreeBasicCallbackJSApiTest.hap" + "huksAgreeBasicCallbackJSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js index 75924499c3b9994ae6258cbc8f59642e0ac59a32..147986e2058fee50f19712a5c105b4fcc08928ad 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicAbort63KBCallbackJsunit.test.js @@ -23,19 +23,14 @@ let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); let HuksOptions63kb = { - properties: new Array( - HuksAgreeDH.HuksKeyAlgDH, - HuksAgreeDH.HuksKeyPurposeDH, - HuksAgreeDH.HuksKeyDHSize2048 - ), + properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData63Kb, }; describe('SecurityHuksAgreeDHCallbackJsunit', function () { it('testAgreeDH102', 0, async function (done) { const srcKeyAliesFirst = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_001'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksAgreeDH.HuksKeySTORAGE, @@ -53,13 +48,7 @@ describe('SecurityHuksAgreeDHCallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js index 86daf43fe5a3eaaa7bbf57c5abb5aea863942550..01e09fecc2416c61d4621ea2758430a58e2cb57a 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicAbort65KBCallbackJsunit.test.js @@ -23,19 +23,14 @@ let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); let HuksOptions65kb = { - properties: new Array( - HuksAgreeDH.HuksKeyAlgDH, - HuksAgreeDH.HuksKeyPurposeDH, - HuksAgreeDH.HuksKeyDHSize2048 - ), + properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, }; describe('SecurityHuksAgreeDHCallbackJsunit', function () { it('testAgreeDH004', 0, async function (done) { const srcKeyAliesFirst = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_001'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksAgreeDH.HuksKeySTORAGE, @@ -53,13 +48,7 @@ describe('SecurityHuksAgreeDHCallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js index 70fb1e0de7bd46d5a62b69d333df33299ffce0d9..de8264feb312da20d1c00c00fff987955b63c482 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicFinish63KBCallbackJsunit.test.js @@ -23,20 +23,14 @@ let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); let HuksOptions63kb = { - properties: new Array( - HuksAgreeDH.HuksKeyAlgDH, - HuksAgreeDH.HuksKeyPurposeDH, - HuksAgreeDH.HuksKeyDHSize2048 - ), + properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData63Kb, }; describe('SecurityHuksAgreeDHCallbackJsunit', function () { it('testAgreeDH101', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_001'; + const srcKeyAliesFirst = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksAgreeDH.HuksKeySTORAGE, @@ -54,13 +48,7 @@ describe('SecurityHuksAgreeDHCallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js index 356ed9664a79fbe44840210ecc6c1a6d5338c28d..50c98dcf1ec6dc6b43450385575de01d98e19db8 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksDHBasicFinish65KBCallbackJsunit.test.js @@ -23,20 +23,14 @@ let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); let HuksOptions65kb = { - properties: new Array( - HuksAgreeDH.HuksKeyAlgDH, - HuksAgreeDH.HuksKeyPurposeDH, - HuksAgreeDH.HuksKeyDHSize2048 - ), + properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, }; describe('SecurityHuksAgreeDHCallbackJsunit', function () { it('testAgreeDH003', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_001'; + const srcKeyAliesFirst = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksAgreeDH.HuksKeySTORAGE, @@ -54,13 +48,7 @@ describe('SecurityHuksAgreeDHCallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicAbort63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicAbort63KBCallbackJsunit.test.js index 53f3c9ac24b6c756e0ff83ef2210b99438fa1e36..dce3771c69856ffde2e40c7f152dd368c3df2a88 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicAbort63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicAbort63KBCallbackJsunit.test.js @@ -36,10 +36,8 @@ let HuksOptions63kb = { describe('SecurityHuksAgreeECDHCallbackJsunit', function () { it('testAgreeEDCH102', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_02_001'; + const srcKeyAliesFirst = 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksAgreeECDH.HuksKeySTORAGE, @@ -57,13 +55,7 @@ describe('SecurityHuksAgreeECDHCallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicAbort65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicAbort65KBCallbackJsunit.test.js index 7244b476b38f9945dc5811d460564512ae7be2d4..8c014a5ad4fb0ea2f124b200d2e483e8eb611822 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicAbort65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicAbort65KBCallbackJsunit.test.js @@ -36,10 +36,8 @@ let HuksOptions65kb = { describe('SecurityHuksAgreeECDHCallbackJsunit', function () { it('testAgreeEDCH104', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_02_001'; + const srcKeyAliesFirst = 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksAgreeECDH.HuksKeySTORAGE, @@ -57,13 +55,7 @@ describe('SecurityHuksAgreeECDHCallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicFinish63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicFinish63KBCallbackJsunit.test.js index be603de603a36720cf11b22991033438bb22acf4..02740ab3a4475ff98f8f42d6868fd4b758b7e4b5 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicFinish63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicFinish63KBCallbackJsunit.test.js @@ -36,10 +36,8 @@ let HuksOptions63kb = { describe('SecurityHuksAgreeECDHCallbackJsunit', function () { it('testAgreeEDCH101', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_02_001'; + const srcKeyAliesFirst = 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksAgreeECDH.HuksKeySTORAGE, @@ -57,13 +55,7 @@ describe('SecurityHuksAgreeECDHCallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicFinish65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicFinish65KBCallbackJsunit.test.js index 8090ead916d2defed12bfe4cccb3c27b301fc6c8..7ee11418b16a78ba545c414c720bee80da81f9bd 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicFinish65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksECDHBasicFinish65KBCallbackJsunit.test.js @@ -36,10 +36,8 @@ let HuksOptions65kb = { describe('SecurityHuksAgreeECDHCallbackJsunit', function () { it('testAgreeEDCH103', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_02_001'; + const srcKeyAliesFirst = 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksAgreeECDH.HuksKeySTORAGE, @@ -57,13 +55,7 @@ describe('SecurityHuksAgreeECDHCallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicAbort63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicAbort63KBCallbackJsunit.test.js index e3dbe5cebeca9d87f2f3e85b1395234b8465a109..4780616f950e0a82e20fd88c98359e2da9f5d32f 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicAbort63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicAbort63KBCallbackJsunit.test.js @@ -36,10 +36,8 @@ let HuksOptions63kb = { describe('SecurityHuksAgreeX25519CallbackJsunit', function () { it('testAgreeX25519102', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeX25519Size256Abort63KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeX25519Size256Abort63KBAgreeKeyAlias_02_001'; + const srcKeyAliesFirst = 'testAgreeX25519Size256Abort63KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeX25519Size256Abort63KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksKeyAlgX25519.HuksKeySTORAGE, @@ -57,13 +55,7 @@ describe('SecurityHuksAgreeX25519CallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicAbort65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicAbort65KBCallbackJsunit.test.js index d1b11f3cd77bc57294090bcf6243ae69722b4b32..d7272ac3536e85cfc64b79bb681154fced94c4da 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicAbort65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicAbort65KBCallbackJsunit.test.js @@ -36,10 +36,8 @@ let HuksOptions65kb = { describe('SecurityHuksAgreeX25519CallbackJsunit', function () { it('testAgreeX25519004', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeX25519Size256Abort65KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeX25519Size256Abort65KBAgreeKeyAlias_02_001'; + const srcKeyAliesFirst = 'testAgreeX25519Size256Abort65KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeX25519Size256Abort65KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksKeyAlgX25519.HuksKeySTORAGE, @@ -57,13 +55,7 @@ describe('SecurityHuksAgreeX25519CallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicFinish63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicFinish63KBCallbackJsunit.test.js index 6e5e538cec56449141b841b775da95ef8901d22f..0f48e9ac0fc0b7de0fc7ac7db685c524f081ef23 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicFinish63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicFinish63KBCallbackJsunit.test.js @@ -36,10 +36,8 @@ let HuksOptions63kb = { describe('SecurityHuksAgreeX25519CallbackJsunit', function () { it('testAgreeX25519001', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeX25519Size256Finish63KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeX25519Size256Finish63KBAgreeKeyAlias_02_001'; + const srcKeyAliesFirst = 'testAgreeX25519Size256Finish63KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeX25519Size256Finish63KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksKeyAlgX25519.HuksKeySTORAGE, @@ -57,13 +55,7 @@ describe('SecurityHuksAgreeX25519CallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicFinish65KBCallbackJsunit.test.js b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicFinish65KBCallbackJsunit.test.js index 9eed987822b1d211ac78db434ca5278f98b446ea..a34c7322c007066d925e8714c26a112b01861e89 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicFinish65KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/entry/src/main/js/test/Agree/SecurityHuksX25519BasicFinish65KBCallbackJsunit.test.js @@ -36,10 +36,8 @@ let HuksOptions65kb = { describe('SecurityHuksAgreeX25519CallbackJsunit', function () { it('testAgreeX25519003', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeX25519Size256Finish65KBAgreeKeyAlias_01_001'; - const srcKeyAliesSecond = - 'testAgreeX25519Size256Finish65KBAgreeKeyAlias_02_001'; + const srcKeyAliesFirst = 'testAgreeX25519Size256Finish65KBAgreeKeyAlias_01_001'; + const srcKeyAliesSecond = 'testAgreeX25519Size256Finish65KBAgreeKeyAlias_02_001'; let huksOptionsFinish = { properties: new Array( HuksKeyAlgX25519.HuksKeySTORAGE, @@ -57,13 +55,7 @@ describe('SecurityHuksAgreeX25519CallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/BUILD.gn b/security/security_huks_basic/huks_agree_promise_BasicTest/BUILD.gn index 092ba9199d5f4e9d761754e68767b6b9721b471c..58b425fe98a71d7418f3f44a1729097ba2506e39 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/BUILD.gn @@ -19,7 +19,7 @@ ohos_js_hap_suite("huksagree_promise_basic_js_test") { ":huks_js_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksAgreeBasicPromiseJSApiTest" + hap_name = "huksAgreeBasicPromiseJSApiTest" } ohos_js_assets("huks_js_assets") { source_dir = "./entry/src/main/js/MainAbility" diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/Test.json b/security/security_huks_basic/huks_agree_promise_BasicTest/Test.json index 3aca2b28171a9fcba3a5b902d1d117ab2dff7ec0..223c56d5f35856b88ace23fd187d60c43e0f4a39 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/Test.json +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/Test.json @@ -2,14 +2,14 @@ "description": "Configuration for huksAgreeBasicPromise js api Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "4200000", "package": "com.example.huksagreebasicpromise", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsHuksAgreeBasicPromiseJSApiTest.hap" + "huksAgreeBasicPromiseJSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js index 37fcfbc58b5879980f4af9f48fe9eb14f514fb5a..538b79db556e187188e2b8329c36bce2aea3277f 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort63KBPromiseJsunit.test.js @@ -23,19 +23,14 @@ let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); let HuksOptions63kb = { - properties: new Array( - HuksAgreeDH.HuksKeyAlgDH, - HuksAgreeDH.HuksKeyPurposeDH, - HuksAgreeDH.HuksKeyDHSize2048 - ), + properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData63Kb, }; describe('SecurityHuksAgreeDHPromiseJsunit', function () { it('testAgreeDHSize2048Abort63KBAgree101', 0, async function (done) { const srcKeyAliesFirst = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_101'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort63KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksAgreeDH.HuksKeySTORAGE, @@ -53,13 +48,7 @@ describe('SecurityHuksAgreeDHPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js index 1d4fc7c475cb6e2cb42b19fc799ccbbbaa0a12a3..2960b4ad7cd70ef32f9c419b8b432ccc9f418ff3 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicAbort65KBPromiseJsunit.test.js @@ -23,19 +23,14 @@ let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); let HuksOptions65kb = { - properties: new Array( - HuksAgreeDH.HuksKeyAlgDH, - HuksAgreeDH.HuksKeyPurposeDH, - HuksAgreeDH.HuksKeyDHSize2048 - ), + properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, }; describe('SecurityHuksAgreeDHPromiseJsunit', function () { it('testAgreeDH104', 0, async function (done) { const srcKeyAliesFirst = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_101'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Abort65KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksAgreeDH.HuksKeySTORAGE, @@ -53,13 +48,7 @@ describe('SecurityHuksAgreeDHPromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js index e8415d016f302fcf527310274cafb2229bdacb49..960fd958574ceab03204fa101f2597980da3518e 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish63KBPromiseJsunit.test.js @@ -23,20 +23,14 @@ let srcData63 = Data.Date63KB; let srcData63Kb = stringToUint8Array(srcData63); let HuksOptions63kb = { - properties: new Array( - HuksAgreeDH.HuksKeyAlgDH, - HuksAgreeDH.HuksKeyPurposeDH, - HuksAgreeDH.HuksKeyDHSize2048 - ), + properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData63Kb, }; describe('SecurityHuksAgreeDHPromiseJsunit', function () { it('testAgreeDHSize2048Finish63KBAgree101', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_101'; + const srcKeyAliesFirst = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Finish63KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksAgreeDH.HuksKeySTORAGE, @@ -54,13 +48,7 @@ describe('SecurityHuksAgreeDHPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js index 408eb7a2a7beff0857ed4d852f7c1b8fb325a6ef..b694043a289c8868841a1573d66d84a45117bb13 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeDHBasicFinish65KBPromiseJsunit.test.js @@ -23,20 +23,14 @@ let srcData65 = Data.Date65KB; let srcData65Kb = stringToUint8Array(srcData65); let HuksOptions65kb = { - properties: new Array( - HuksAgreeDH.HuksKeyAlgDH, - HuksAgreeDH.HuksKeyPurposeDH, - HuksAgreeDH.HuksKeyDHSize2048 - ), + properties: new Array(HuksAgreeDH.HuksKeyAlgDH, HuksAgreeDH.HuksKeyPurposeDH, HuksAgreeDH.HuksKeyDHSize2048), inData: srcData65Kb, }; describe('SecurityHuksAgreeDHPromiseJsunit', function () { it('testAgreeDH103', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_101'; + const srcKeyAliesFirst = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeDHSize2048Finish65KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksAgreeDH.HuksKeySTORAGE, @@ -54,13 +48,7 @@ describe('SecurityHuksAgreeDHPromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicAbort63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicAbort63KBPromiseJsunit.test.js index 08c79594fc2f06e024c501acc4ff3e52c025ebe7..a4ad3e3a947cb74698fc95502286236522a4774f 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicAbort63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicAbort63KBPromiseJsunit.test.js @@ -40,10 +40,8 @@ describe('SecurityHuksAgreeECDHPromiseJsunit', function () { console.info('test beforeEach called'); }); it('testAgreeECDH102', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_02_101'; + const srcKeyAliesFirst = 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksAgreeECDH.HuksKeySTORAGE, @@ -61,13 +59,7 @@ describe('SecurityHuksAgreeECDHPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicAbort65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicAbort65KBPromiseJsunit.test.js index 9b0131fd6b54644cb9410f33a40b9a8c76725508..13c9b3b3b65f575c32552a167fa4f35c4bbd2499 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicAbort65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicAbort65KBPromiseJsunit.test.js @@ -41,10 +41,8 @@ describe('SecurityHuksAgreeECDHPromiseJsunit', function () { }); it('testAgreeECDH104', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_02_101'; + const srcKeyAliesFirst = 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksAgreeECDH.HuksKeySTORAGE, @@ -62,13 +60,7 @@ describe('SecurityHuksAgreeECDHPromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicFinish63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicFinish63KBPromiseJsunit.test.js index e3d13159ba76b345fca7bff90ad84bccf7e2d693..473c1a83c45d80d24bd061531faa96adaf27f452 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicFinish63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicFinish63KBPromiseJsunit.test.js @@ -52,10 +52,8 @@ describe('SecurityHuksAgreeECDHPromiseJsunit', function () { }); it('testAgreeECDH101', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_02_101'; + const srcKeyAliesFirst = 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksAgreeECDH.HuksKeySTORAGE, @@ -73,13 +71,7 @@ describe('SecurityHuksAgreeECDHPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicFinish65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicFinish65KBPromiseJsunit.test.js index 36f6cf18d7d3709f3b0fc4e17373c893f69c0621..fd56274f91c88967520671fc347f084f71352d96 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicFinish65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeECDHBasicFinish65KBPromiseJsunit.test.js @@ -41,10 +41,8 @@ describe('SecurityHuksAgreeECDHPromiseJsunit', function () { }); it('testAgreeECDH103', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_02_101'; + const srcKeyAliesFirst = 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksAgreeECDH.HuksKeySTORAGE, @@ -62,13 +60,7 @@ describe('SecurityHuksAgreeECDHPromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicAbort63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicAbort63KBPromiseJsunit.test.js index 6cf0fb1150aabb0f291fae6252c43b39d9b5ca03..ca792458e29bea3ea00f44e858e3c07eddaa88ca 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicAbort63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicAbort63KBPromiseJsunit.test.js @@ -37,10 +37,8 @@ let HuksOptions63kb = { describe('SecurityHuksAgreeX25519PromiseJsunit', function () { it('testAgreeX25519Abort63KBAgree101', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeX25519Size256Abort63KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeX25519Size256Abort63KBAgreeKeyAlias_02_101'; + const srcKeyAliesFirst = 'testAgreeX25519Size256Abort63KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeX25519Size256Abort63KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksKeyAlgX25519.HuksKeySTORAGE, @@ -58,13 +56,7 @@ describe('SecurityHuksAgreeX25519PromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicAbort65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicAbort65KBPromiseJsunit.test.js index ff4d5fc1a3217104409584cf1a6c82a4c97685b8..4f4cf4a37cbd01812ccfb16b2b4df17c0001ae0b 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicAbort65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicAbort65KBPromiseJsunit.test.js @@ -36,10 +36,8 @@ let HuksOptions65kb = { describe('SecurityHuksAgreeX25519PromiseJsunit', function () { it('testAgreeX25519104', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeX25519Size256Abort65KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeX25519Size256Abort65KBAgreeKeyAlias_02_101'; + const srcKeyAliesFirst = 'testAgreeX25519Size256Abort65KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeX25519Size256Abort65KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksKeyAlgX25519.HuksKeySTORAGE, @@ -57,13 +55,7 @@ describe('SecurityHuksAgreeX25519PromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'abort' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicFinish63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicFinish63KBPromiseJsunit.test.js index f296b922dd2fa21c77f43a4bbcce3c293db4e56e..141081e46d0b90de50f4e6675c13972143140e10 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicFinish63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicFinish63KBPromiseJsunit.test.js @@ -36,10 +36,8 @@ let HuksOptions63kb = { }; describe('SecurityHuksAgreeX25519PromiseJsunit', function () { it('testAgreeX25519101', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeX25519Size256Finish63KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeX25519Size256Finish63KBAgreeKeyAlias_02_101'; + const srcKeyAliesFirst = 'testAgreeX25519Size256Finish63KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeX25519Size256Finish63KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksKeyAlgX25519.HuksKeySTORAGE, @@ -57,13 +55,7 @@ describe('SecurityHuksAgreeX25519PromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions63kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicFinish65KBPromiseJsunit.test.js b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicFinish65KBPromiseJsunit.test.js index f670c97f188de394c62b4ab0c564de4a55455109..6e02f284fc8c96eaab4c17bce1939a6a0a6fe563 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicFinish65KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/entry/src/main/js/test/Agree/SecurityHuksAgreeX25519BasicFinish65KBPromiseJsunit.test.js @@ -36,10 +36,8 @@ let HuksOptions65kb = { describe('SecurityHuksAgreeX25519PromiseJsunit', function () { it('testAgreeX25519103', 0, async function (done) { - const srcKeyAliesFirst = - 'testAgreeX25519Size256Finish65KBAgreeKeyAlias_01_101'; - const srcKeyAliesSecond = - 'testAgreeX25519Size256Finish65KBAgreeKeyAlias_02_101'; + const srcKeyAliesFirst = 'testAgreeX25519Size256Finish65KBAgreeKeyAlias_01_101'; + const srcKeyAliesSecond = 'testAgreeX25519Size256Finish65KBAgreeKeyAlias_02_101'; let huksOptionsFinish = { properties: new Array( HuksKeyAlgX25519.HuksKeySTORAGE, @@ -57,13 +55,7 @@ describe('SecurityHuksAgreeX25519PromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicAgreeFunc( - srcKeyAliesFirst, - srcKeyAliesSecond, - HuksOptions65kb, - huksOptionsFinish, - 'finish' - ); + await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions65kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_cipher_callback_BasicTest/BUILD.gn b/security/security_huks_basic/huks_cipher_callback_BasicTest/BUILD.gn index 12730c2d9d832c6854f57643ecdcd6e9b0233546..16b45d101359a3cc81ab306dae33aee47fbbe8f4 100644 --- a/security/security_huks_basic/huks_cipher_callback_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_cipher_callback_BasicTest/BUILD.gn @@ -19,7 +19,7 @@ ohos_js_hap_suite("hukscipher_callback_basic_js_test") { ":huks_js_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksCipherBasicCallbackJSApiTest" + hap_name = "huksCipherBasicCallbackJSApiTest" } ohos_js_assets("huks_js_assets") { source_dir = "./entry/src/main/js/MainAbility" diff --git a/security/security_huks_basic/huks_cipher_callback_BasicTest/Test.json b/security/security_huks_basic/huks_cipher_callback_BasicTest/Test.json index f63b998e18bd166ee5f725863f2e7dfc6ece8562..2b45fe6f637bf5e6c05ea0fc604bce411330732c 100644 --- a/security/security_huks_basic/huks_cipher_callback_BasicTest/Test.json +++ b/security/security_huks_basic/huks_cipher_callback_BasicTest/Test.json @@ -2,14 +2,14 @@ "description": "Configuration for huksCipherBasicCallback js api Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "2700000", "package": "com.example.hukscipherbasiccallback", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsHuksCipherBasicCallbackJSApiTest.hap" + "huksCipherBasicCallbackJSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true 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 e75b1a1f99c8dac7f573376e6fc17726424c415d..64150fc82cb3fd9a688c7f8523f717f2414f3353 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 @@ -16,10 +16,7 @@ import { describe, it, expect } from 'deccjsunit/index'; import huks from '@ohos.security.huks'; import { HuksCipherAES } from '../../../../../../../utils/param/cipher/publicCipherParam'; import { HksTag } from '../../../../../../../utils/param/publicParam'; -import { - stringToUint8Array, - uint8ArrayToString, -} from '../../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, uint8ArrayToString } from '../../../../../../../utils/param/publicFunc'; let IV = '0000000000000000'; let defaultData = '0'; @@ -31,10 +28,7 @@ let encryptedData; var handle; let genHuksOptions = { - properties: new Array( - HuksCipherAES.HuksKeyAlgAES, - HuksCipherAES.HuksKeyPurpose - ), + properties: new Array(HuksCipherAES.HuksKeyAlgAES, HuksCipherAES.HuksKeyPurpose), inData: new Uint8Array(defaultData), }; @@ -101,18 +95,13 @@ async function publicUpdateFunc(HuksOptions, thirdInderfaceName, isEncrypt) { let count = Math.floor(Array.from(inDataArray).length / dateSize); let remainder = Array.from(inDataArray).length % dateSize; for (let i = 0; i < count; i++) { - HuksOptions.inData = new Uint8Array( - Array.from(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1)) - ); + HuksOptions.inData = new Uint8Array(Array.from(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1))); await update(handle, HuksOptions); } HuksOptions.inData = huksOptionsInData; if (remainder !== 0) { HuksOptions.inData = new Uint8Array( - Array.from(huksOptionsInData).slice( - dateSize * count, - uint8ArrayToString(inDataArray).length - ) + Array.from(huksOptionsInData).slice(dateSize * count, uint8ArrayToString(inDataArray).length) ); } await publicFinishAbortFunc(HuksOptions, thirdInderfaceName, isEncrypt); @@ -149,11 +138,7 @@ function updateCallback(handle, HuksOptions) { }); } -async function publicFinishAbortFunc( - HuksOptions, - thirdInderfaceName, - isEncrypt -) { +async function publicFinishAbortFunc(HuksOptions, thirdInderfaceName, isEncrypt) { if (thirdInderfaceName == 'finish') { await finish(HuksOptions, isEncrypt); } else if (thirdInderfaceName == 'abort') { @@ -167,9 +152,7 @@ async function finish(HuksOptions, isEncrypt) { console.log(`test finish data: ${JSON.stringify(data)}`); let finishData; if (encryptedData.length > 64) { - finishData = uint8ArrayToString( - updateResult.concat(Array.from(data.outData)) - ); + finishData = uint8ArrayToString(updateResult.concat(Array.from(data.outData))); updateResult = updateResult.concat(Array.from(data.outData)); } else { finishData = uint8ArrayToString(updateResult); @@ -258,13 +241,7 @@ function deleteKey(srcKeyAlies, HuksOptions) { }); } -async function publicCipherFunc( - srcKeyAlies, - genHuksOptionsNONECBC, - HuksOptions, - thirdInderfaceName, - isEncrypt -) { +async function publicCipherFunc(srcKeyAlies, genHuksOptionsNONECBC, HuksOptions, thirdInderfaceName, isEncrypt) { try { updateResult = new Array(); if (isEncrypt) { @@ -299,13 +276,7 @@ describe('SecurityHuksCipherAESCallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - true - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'finish', true); HuksOptions = { properties: new Array( HuksCipherAES.HuksKeyAlgAES, @@ -318,13 +289,7 @@ describe('SecurityHuksCipherAESCallbackJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - false - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'finish', false); done(); }); @@ -342,13 +307,7 @@ describe('SecurityHuksCipherAESCallbackJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'abort', - true - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'abort', true); done(); }); @@ -366,13 +325,7 @@ describe('SecurityHuksCipherAESCallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - true - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'finish', true); HuksOptions = { properties: new Array( HuksCipherAES.HuksKeyAlgAES, @@ -385,13 +338,7 @@ describe('SecurityHuksCipherAESCallbackJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - false - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'finish', false); done(); }); @@ -409,13 +356,7 @@ describe('SecurityHuksCipherAESCallbackJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'abort', - true - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'abort', true); done(); }); }); diff --git a/security/security_huks_basic/huks_cipher_callback_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksRSABasicCallbackJsunit.test.js b/security/security_huks_basic/huks_cipher_callback_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksRSABasicCallbackJsunit.test.js index 022ca6b5251f8ba61800e0d951443059249437a3..064cc420b5e61969f151b8e6f261ef2180afb230 100644 --- a/security/security_huks_basic/huks_cipher_callback_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksRSABasicCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_cipher_callback_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksRSABasicCallbackJsunit.test.js @@ -16,12 +16,8 @@ import { describe, it, expect } from 'deccjsunit/index'; import huks from '@ohos.security.huks'; import { HuksCipherRSA } from '../../../../../../../utils/param/cipher/publicCipherParam'; -import { - stringToUint8Array, - uint8ArrayToString, -} from '../../../../../../../utils/param/publicFunc'; -let gInData64 = - 'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'; +import { stringToUint8Array, uint8ArrayToString } from '../../../../../../../utils/param/publicFunc'; +let gInData64 = 'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'; let gInData64Array = stringToUint8Array(gInData64); let encryptedData; @@ -31,11 +27,7 @@ let updateResult = new Array(); let exportKey; let genHuksOptions = { - properties: new Array( - HuksCipherRSA.HuksKeyAlgRSA, - HuksCipherRSA.HuksKeyPurpose, - HuksCipherRSA.HuksKeyRSASize512 - ), + properties: new Array(HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyPurpose, HuksCipherRSA.HuksKeyRSASize512), inData: new Uint8Array(new Array()), }; @@ -156,18 +148,13 @@ async function publicUpdateFunc(HuksOptions) { let count = Math.floor(Array.from(inDataArray).length / dateSize); let remainder = Array.from(inDataArray).length % dateSize; for (let i = 0; i < count; i++) { - HuksOptions.inData = new Uint8Array( - Array.from(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1)) - ); + HuksOptions.inData = new Uint8Array(Array.from(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1))); await update(handle, HuksOptions); HuksOptions.inData = huksOptionsInData; } if (remainder !== 0) { HuksOptions.inData = new Uint8Array( - Array.from(huksOptionsInData).slice( - dateSize * count, - uint8ArrayToString(inDataArray).length - ) + Array.from(huksOptionsInData).slice(dateSize * count, uint8ArrayToString(inDataArray).length) ); await update(handle, HuksOptions); } @@ -199,11 +186,7 @@ function updateCallback(handle, HuksOptions) { }); } -async function publicFinishAbortFunc( - HuksOptions, - thirdInderfaceName, - isEncrypt -) { +async function publicFinishAbortFunc(HuksOptions, thirdInderfaceName, isEncrypt) { if (thirdInderfaceName == 'finish') { HuksOptions.inData = new Uint8Array(new Array()); await finish(HuksOptions, isEncrypt); @@ -218,18 +201,14 @@ async function finish(HuksOptions, isEncrypt) { console.log(`test finish data: ${JSON.stringify(data)}`); if (isEncrypt) { updateResult = Array.from(data.outData); - if ( - uint8ArrayToString(data.outData) === uint8ArrayToString(encryptedData) - ) { + if (uint8ArrayToString(data.outData) === uint8ArrayToString(encryptedData)) { expect(null).assertFail(); } else { expect(data.errorCode == 0).assertTrue(); } } if (!isEncrypt) { - if ( - uint8ArrayToString(data.outData) === uint8ArrayToString(encryptedData) - ) { + if (uint8ArrayToString(data.outData) === uint8ArrayToString(encryptedData)) { expect(data.errorCode == 0).assertTrue(); } else { expect(null).assertFail(); @@ -339,19 +318,10 @@ async function publicCipherFunc( describe('SecurityHuksCipherRSACallbackJsunit', function () { it('testCipherRSA001', 0, async function (done) { const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias001'; - const newSrcKeyAlies = - 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias001'; - genHuksOptions.properties.splice( - 3, - 1, - HuksCipherRSA.HuksKeyRSABLOCKMODEECB - ); + const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias001'; + genHuksOptions.properties.splice(3, 1, HuksCipherRSA.HuksKeyRSABLOCKMODEECB); genHuksOptions.properties.splice(4, 1, HuksCipherRSA.HuksKeyRSAPADDINGNONE); - genHuksOptions.properties.splice( - 5, - 1, - HuksCipherRSA.HuksKeyRSADIGESTSHA256 - ); + genHuksOptions.properties.splice(5, 1, HuksCipherRSA.HuksKeyRSADIGESTSHA256); let HuksOptions = { properties: new Array( @@ -364,14 +334,7 @@ describe('SecurityHuksCipherRSACallbackJsunit', function () { ), inData: gInData64Array, }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - true - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', true); HuksOptions = { properties: new Array( HuksCipherRSA.HuksKeyAlgRSA, @@ -383,21 +346,13 @@ describe('SecurityHuksCipherRSACallbackJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - false - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', false); done(); }); it('testCipherRSA002', 0, async function (done) { const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias002'; - const newSrcKeyAlies = - 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias002'; + const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias002'; let HuksOptions = { properties: new Array( HuksCipherRSA.HuksKeyAlgRSA, @@ -409,21 +364,13 @@ describe('SecurityHuksCipherRSACallbackJsunit', function () { ), inData: gInData64Array, }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'abort', - true - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'abort', true); done(); }); it('testCipherRSA003', 0, async function (done) { const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias003'; - const newSrcKeyAlies = - 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias003'; + const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias003'; let HuksOptions = { properties: new Array( HuksCipherRSA.HuksKeyAlgRSA, @@ -435,14 +382,7 @@ describe('SecurityHuksCipherRSACallbackJsunit', function () { ), inData: gInData64Array, }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - true - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', true); HuksOptions = { properties: new Array( HuksCipherRSA.HuksKeyAlgRSA, @@ -454,21 +394,13 @@ describe('SecurityHuksCipherRSACallbackJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - false - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', false); done(); }); it('testCipherRSA004', 0, async function (done) { const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias004'; - const newSrcKeyAlies = - 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias004'; + const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias004'; let HuksOptions = { properties: new Array( HuksCipherRSA.HuksKeyAlgRSA, @@ -480,14 +412,7 @@ describe('SecurityHuksCipherRSACallbackJsunit', function () { ), inData: gInData64Array, }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'abort', - true - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'abort', true); done(); }); }); diff --git a/security/security_huks_basic/huks_cipher_promise_BasicTest/BUILD.gn b/security/security_huks_basic/huks_cipher_promise_BasicTest/BUILD.gn index bd1a2820fd4067551ce8d2af33d400cf4f3dee7a..b319404ac687872b27706081f06d8f8ce14b4e59 100644 --- a/security/security_huks_basic/huks_cipher_promise_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_cipher_promise_BasicTest/BUILD.gn @@ -19,7 +19,7 @@ ohos_js_hap_suite("hukscipher_promise_basic_js_test") { ":huks_js_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksCipherBasicPromiseJSApiTest" + hap_name = "huksCipherBasicPromiseJSApiTest" } ohos_js_assets("huks_js_assets") { source_dir = "./entry/src/main/js/MainAbility" diff --git a/security/security_huks_basic/huks_cipher_promise_BasicTest/Test.json b/security/security_huks_basic/huks_cipher_promise_BasicTest/Test.json index 5d0b830663ecdc611d66350ca576204a12cfe4e5..a3afe3e0a27af0a72998c4dc14023c30ba039d51 100644 --- a/security/security_huks_basic/huks_cipher_promise_BasicTest/Test.json +++ b/security/security_huks_basic/huks_cipher_promise_BasicTest/Test.json @@ -2,14 +2,14 @@ "description": "Configuration for huksCipherBasicPromise js api Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "2700000", "package": "com.example.hukscipherbasicpromise", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsHuksCipherBasicPromiseJSApiTest.hap" + "huksCipherBasicPromiseJSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true 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 1a834473fc49f53e271e73b6970fb49e580c5903..c3a97ab715998ebc9f8e5ee13c2b27416a737736 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 @@ -17,10 +17,7 @@ import { describe, it, expect } from 'deccjsunit/index'; import huks from '@ohos.security.huks'; import { HuksCipherAES } from '../../../../../../../utils/param/cipher/publicCipherParam'; import { HksTag } from '../../../../../../../utils/param/publicParam'; -import { - stringToUint8Array, - uint8ArrayToString, -} from '../../../../../../../utils/param/publicFunc'; +import { stringToUint8Array, uint8ArrayToString } from '../../../../../../../utils/param/publicFunc'; let IV = '0000000000000000'; let srcData63 = 'Hks_AES_Cipher_Test_000000000000000000000_string'; @@ -30,10 +27,7 @@ let encryptedData; var handle; let genHuksOptions = { - properties: new Array( - HuksCipherAES.HuksKeyAlgAES, - HuksCipherAES.HuksKeyPurpose - ), + properties: new Array(HuksCipherAES.HuksKeyAlgAES, HuksCipherAES.HuksKeyPurpose), inData: new Uint8Array(new Array()), }; @@ -76,18 +70,13 @@ async function publicUpdateFunc(HuksOptions, thirdInderfaceName, isEncrypt) { let count = Math.floor(Array.from(inDataArray).length / dateSize); let remainder = Array.from(inDataArray).length % dateSize; for (let i = 0; i < count; i++) { - HuksOptions.inData = new Uint8Array( - Array.from(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1)) - ); + HuksOptions.inData = new Uint8Array(Array.from(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1))); await update(handle, HuksOptions); } HuksOptions.inData = huksOptionsInData; if (remainder !== 0) { HuksOptions.inData = new Uint8Array( - Array.from(huksOptionsInData).slice( - dateSize * count, - uint8ArrayToString(inDataArray).length - ) + Array.from(huksOptionsInData).slice(dateSize * count, uint8ArrayToString(inDataArray).length) ); } else { HuksOptions.inData = new Uint8Array(new Array()); @@ -116,11 +105,7 @@ async function update(handle, HuksOptions) { }); } -async function publicFinishAbortFunc( - HuksOptions, - thirdInderfaceName, - isEncrypt -) { +async function publicFinishAbortFunc(HuksOptions, thirdInderfaceName, isEncrypt) { if (thirdInderfaceName == 'finish') { await finish(HuksOptions, isEncrypt); } else if (thirdInderfaceName == 'abort') { @@ -135,9 +120,7 @@ async function finish(HuksOptions, isEncrypt) { console.log(`test finish data: ${JSON.stringify(data)}`); let finishData; if (encryptedData.length > 64) { - finishData = uint8ArrayToString( - updateResult.concat(Array.from(data.outData)) - ); + finishData = uint8ArrayToString(updateResult.concat(Array.from(data.outData))); updateResult = updateResult.concat(Array.from(data.outData)); } else { finishData = uint8ArrayToString(updateResult); @@ -189,13 +172,7 @@ async function publicDeleteKeyFunc(srcKeyAlies, genHuksOptionsNONECBC) { }); } -async function publicCipherFunc( - srcKeyAlies, - genHuksOptionsNONECBC, - HuksOptions, - thirdInderfaceName, - isEncrypt -) { +async function publicCipherFunc(srcKeyAlies, genHuksOptionsNONECBC, HuksOptions, thirdInderfaceName, isEncrypt) { try { updateResult = new Array(); if (isEncrypt) { @@ -230,13 +207,7 @@ describe('SecurityHuksCipherAESPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - true - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'finish', true); HuksOptions = { properties: new Array( HuksCipherAES.HuksKeyAlgAES, @@ -249,13 +220,7 @@ describe('SecurityHuksCipherAESPromiseJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - false - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'finish', false); done(); }); @@ -273,13 +238,7 @@ describe('SecurityHuksCipherAESPromiseJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'abort', - true - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'abort', true); done(); }); @@ -297,13 +256,7 @@ describe('SecurityHuksCipherAESPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - true - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'finish', true); HuksOptions = { properties: new Array( HuksCipherAES.HuksKeyAlgAES, @@ -316,13 +269,7 @@ describe('SecurityHuksCipherAESPromiseJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - false - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'finish', false); done(); }); @@ -340,13 +287,7 @@ describe('SecurityHuksCipherAESPromiseJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - genHuksOptions, - HuksOptions, - 'abort', - true - ); + await publicCipherFunc(srcKeyAlies, genHuksOptions, HuksOptions, 'abort', true); done(); }); }); diff --git a/security/security_huks_basic/huks_cipher_promise_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksCipherRSABasicPromiseJsunit.test.js b/security/security_huks_basic/huks_cipher_promise_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksCipherRSABasicPromiseJsunit.test.js index 7a3ed915301fafa6e8a1470700ef9915738fd3a2..6130080a53d551d9bc7b84106ddb4993e381e759 100644 --- a/security/security_huks_basic/huks_cipher_promise_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksCipherRSABasicPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_cipher_promise_BasicTest/entry/src/main/js/test/Cipher/SecurityHuksCipherRSABasicPromiseJsunit.test.js @@ -16,12 +16,8 @@ import { describe, it, expect } from 'deccjsunit/index'; import huks from '@ohos.security.huks'; import { HuksCipherRSA } from '../../../../../../../utils/param/cipher/publicCipherParam'; -import { - stringToUint8Array, - uint8ArrayToString, -} from '../../../../../../../utils/param/publicFunc'; -let gInData64 = - 'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'; +import { stringToUint8Array, uint8ArrayToString } from '../../../../../../../utils/param/publicFunc'; +let gInData64 = 'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'; let defaultData = '0'; @@ -34,11 +30,7 @@ let updateResult = new Array(); let exportKey; let genHuksOptions = { - properties: new Array( - HuksCipherRSA.HuksKeyAlgRSA, - HuksCipherRSA.HuksKeyPurpose, - HuksCipherRSA.HuksKeyRSASize512 - ), + properties: new Array(HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyPurpose, HuksCipherRSA.HuksKeyRSASize512), inData: new Uint8Array(defaultData), }; @@ -109,18 +101,13 @@ async function publicUpdateFunc(HuksOptions) { let count = Math.floor(Array.from(inDataArray).length / dateSize); let remainder = Array.from(inDataArray).length % dateSize; for (let i = 0; i < count; i++) { - HuksOptions.inData = new Uint8Array( - Array.from(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1)) - ); + HuksOptions.inData = new Uint8Array(Array.from(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1))); await update(handle, HuksOptions); HuksOptions.inData = huksOptionsInData; } if (remainder !== 0) { HuksOptions.inData = new Uint8Array( - Array.from(huksOptionsInData).slice( - dateSize * count, - uint8ArrayToString(inDataArray).length - ) + Array.from(huksOptionsInData).slice(dateSize * count, uint8ArrayToString(inDataArray).length) ); await update(handle, HuksOptions); } @@ -140,11 +127,7 @@ async function update(handle, HuksOptions) { }); } -async function publicFinishAbortFunc( - HuksOptions, - thirdInderfaceName, - isEncrypt -) { +async function publicFinishAbortFunc(HuksOptions, thirdInderfaceName, isEncrypt) { if (thirdInderfaceName == 'finish') { HuksOptions.inData = new Uint8Array(new Array()); await finish(HuksOptions, isEncrypt); @@ -160,18 +143,14 @@ async function finish(HuksOptions, isEncrypt) { console.log(`test finish data: ${JSON.stringify(data)}`); if (isEncrypt) { updateResult = Array.from(data.outData); - if ( - uint8ArrayToString(data.outData) === uint8ArrayToString(encryptedData) - ) { + if (uint8ArrayToString(data.outData) === uint8ArrayToString(encryptedData)) { expect(null).assertFail(); } else { expect(data.errorCode == 0).assertTrue(); } } if (!isEncrypt) { - if ( - uint8ArrayToString(data.outData) === uint8ArrayToString(encryptedData) - ) { + if (uint8ArrayToString(data.outData) === uint8ArrayToString(encryptedData)) { expect(data.errorCode == 0).assertTrue(); } else { expect(null).assertFail(); @@ -245,19 +224,10 @@ async function publicCipherFunc( describe('SecurityHuksCipherRSAPromiseJsunit', function () { it('testCipherRSA101', 0, async function (done) { const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias101'; - const newSrcKeyAlies = - 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias101'; - genHuksOptions.properties.splice( - 3, - 1, - HuksCipherRSA.HuksKeyRSABLOCKMODEECB - ); + const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias101'; + genHuksOptions.properties.splice(3, 1, HuksCipherRSA.HuksKeyRSABLOCKMODEECB); genHuksOptions.properties.splice(4, 1, HuksCipherRSA.HuksKeyRSAPADDINGNONE); - genHuksOptions.properties.splice( - 5, - 1, - HuksCipherRSA.HuksKeyRSADIGESTSHA256 - ); + genHuksOptions.properties.splice(5, 1, HuksCipherRSA.HuksKeyRSADIGESTSHA256); let HuksOptions = { properties: new Array( @@ -270,14 +240,7 @@ describe('SecurityHuksCipherRSAPromiseJsunit', function () { ), inData: gInData64Array, }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - true - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', true); HuksOptions = { properties: new Array( HuksCipherRSA.HuksKeyAlgRSA, @@ -289,21 +252,13 @@ describe('SecurityHuksCipherRSAPromiseJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - false - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', false); done(); }); it('testCipherRSA102', 0, async function (done) { const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias102'; - const newSrcKeyAlies = - 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias101'; + const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias101'; let HuksOptions = { properties: new Array( HuksCipherRSA.HuksKeyAlgRSA, @@ -315,21 +270,13 @@ describe('SecurityHuksCipherRSAPromiseJsunit', function () { ), inData: gInData64Array, }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'abort', - true - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'abort', true); done(); }); it('testCipherRSA103', 0, async function (done) { const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias103'; - const newSrcKeyAlies = - 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias103'; + const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias103'; let HuksOptions = { properties: new Array( HuksCipherRSA.HuksKeyAlgRSA, @@ -341,14 +288,7 @@ describe('SecurityHuksCipherRSAPromiseJsunit', function () { ), inData: gInData64Array, }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - true - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', true); HuksOptions = { properties: new Array( HuksCipherRSA.HuksKeyAlgRSA, @@ -360,21 +300,13 @@ describe('SecurityHuksCipherRSAPromiseJsunit', function () { ), inData: new Uint8Array(updateResult), }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'finish', - false - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', false); done(); }); it('testCipherRSA104', 0, async function (done) { const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias104'; - const newSrcKeyAlies = - 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias104'; + const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias104'; let HuksOptions = { properties: new Array( HuksCipherRSA.HuksKeyAlgRSA, @@ -386,14 +318,7 @@ describe('SecurityHuksCipherRSAPromiseJsunit', function () { ), inData: gInData64Array, }; - await publicCipherFunc( - srcKeyAlies, - newSrcKeyAlies, - genHuksOptions, - HuksOptions, - 'abort', - true - ); + await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'abort', true); done(); }); }); diff --git a/security/security_huks_basic/huks_derive_callback_BasicTest/BUILD.gn b/security/security_huks_basic/huks_derive_callback_BasicTest/BUILD.gn index 730187b2350f39a6963de2342b6b7c288778a80d..45bc3846e3623c3335f1b7d501d315a12aefcc2c 100644 --- a/security/security_huks_basic/huks_derive_callback_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_derive_callback_BasicTest/BUILD.gn @@ -19,7 +19,7 @@ ohos_js_hap_suite("huksderive_callback_basic_js_test") { ":huks_js_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksDeriveBasicCallbackJSApiTest" + hap_name = "huksDeriveBasicCallbackJSApiTest" } ohos_js_assets("huks_js_assets") { source_dir = "./entry/src/main/js/MainAbility" diff --git a/security/security_huks_basic/huks_derive_callback_BasicTest/Test.json b/security/security_huks_basic/huks_derive_callback_BasicTest/Test.json index 182fb0f29ad790e0a380b8518d9ebb5f3982288c..2acedaf047551188ef2f7a74010e9b3f989b4ff3 100644 --- a/security/security_huks_basic/huks_derive_callback_BasicTest/Test.json +++ b/security/security_huks_basic/huks_derive_callback_BasicTest/Test.json @@ -2,14 +2,14 @@ "description": "Configuration for huksDeriveBasicCallback js api Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "4200000", "package": "com.example.huksderivebasiccallback", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsHuksDeriveBasicCallbackJSApiTest.hap" + "huksDeriveBasicCallbackJSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksHKDFBasicAbort63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksHKDFBasicAbort63KBCallbackJsunit.test.js index d8d528ba56cf7f0f5737d5aff34a2c47fe0a453f..1703377fbf3b6a54183eaec7a0fec40b554bcd52 100644 --- a/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksHKDFBasicAbort63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksHKDFBasicAbort63KBCallbackJsunit.test.js @@ -34,8 +34,7 @@ let HuksOptions63kb = { describe('SecurityHuksDeriveHKDFCallbackJsunit', function () { it('testDeriveHKDF002', 0, async function (done) { - const srcKeyAliesFirst = - 'testDeriveHKDFSize128SHA256Abort63KBDeriveKeyAlias_01_001'; + const srcKeyAliesFirst = 'testDeriveHKDFSize128SHA256Abort63KBDeriveKeyAlias_01_001'; let huksOptionsFinish = { properties: new Array( HuksDeriveHKDF.HuksKeySTORAGE, @@ -53,12 +52,7 @@ describe('SecurityHuksDeriveHKDFCallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicDeriveFunc( - srcKeyAliesFirst, - HuksOptions63kb, - huksOptionsFinish, - 'abort' - ); + await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksHKDFBasicFinish63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksHKDFBasicFinish63KBCallbackJsunit.test.js index 350a89588a20293ae28845182a624388358e9ef0..b0c94dd5c69986fd01815f975a33ca25e6c4e676 100644 --- a/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksHKDFBasicFinish63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksHKDFBasicFinish63KBCallbackJsunit.test.js @@ -34,8 +34,7 @@ let HuksOptions63kb = { describe('SecurityHuksDeriveHKDFCallbackJsunit', function () { it('testDeriveHKDF001', 0, async function (done) { - const srcKeyAliesFirst = - 'testDeriveHKDFSize128SHA256Finish63KBDeriveKeyAlias_01_001'; + const srcKeyAliesFirst = 'testDeriveHKDFSize128SHA256Finish63KBDeriveKeyAlias_01_001'; let huksOptionsFinish = { properties: new Array( HuksDeriveHKDF.HuksKeySTORAGE, @@ -53,12 +52,7 @@ describe('SecurityHuksDeriveHKDFCallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicDeriveFunc( - srcKeyAliesFirst, - HuksOptions63kb, - huksOptionsFinish, - 'finish' - ); + await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit.test.js index 3691dd9a0b14711c22720b7cc436050929cd5ec2..14343864dde58c34ce391bf8b09729b92797956e 100644 --- a/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit.test.js @@ -34,8 +34,7 @@ let HuksOptions63kb = { describe('SecurityHuksDerivePBKDF2CallbackJsunit', function () { it('testDerivePBKDF2002', 0, async function (done) { - const srcKeyAliesFirst = - 'testDerivePBKDF2Size128SHA256Abort63KBDeriveKeyAlias_01_001'; + const srcKeyAliesFirst = 'testDerivePBKDF2Size128SHA256Abort63KBDeriveKeyAlias_01_001'; let huksOptionsFinish = { properties: new Array( HuksDerivePBKDF2.HuksKeySTORAGE, @@ -53,12 +52,7 @@ describe('SecurityHuksDerivePBKDF2CallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicDeriveFunc( - srcKeyAliesFirst, - HuksOptions63kb, - huksOptionsFinish, - 'abort' - ); + await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit.test.js b/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit.test.js index c5b411f57c052a01fb52521ec0298d44e4a0d522..09189c45919b9ca383aaf9e4471d89eb19ea0417 100644 --- a/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_derive_callback_BasicTest/entry/src/main/js/test/Derive/SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit.test.js @@ -34,8 +34,7 @@ let HuksOptions63kb = { describe('SecurityHuksDerivePBKDF2CallbackJsunit', function () { it('testDerivePBKDF2001', 0, async function (done) { - const srcKeyAliesFirst = - 'testDerivePBKDF2Size128SHA256Finish63KBDeriveKeyAlias_01_001'; + const srcKeyAliesFirst = 'testDerivePBKDF2Size128SHA256Finish63KBDeriveKeyAlias_01_001'; let huksOptionsFinish = { properties: new Array( HuksDerivePBKDF2.HuksKeySTORAGE, @@ -53,12 +52,7 @@ describe('SecurityHuksDerivePBKDF2CallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicDeriveFunc( - srcKeyAliesFirst, - HuksOptions63kb, - huksOptionsFinish, - 'finish' - ); + await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_derive_promise_BasicTest/BUILD.gn b/security/security_huks_basic/huks_derive_promise_BasicTest/BUILD.gn index c1212c5cc110a6bf23c1646e3a559eb4f78e11b6..a3dc56b788d5bb4d72e6ffb485f9de6625ebb238 100644 --- a/security/security_huks_basic/huks_derive_promise_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_derive_promise_BasicTest/BUILD.gn @@ -19,7 +19,7 @@ ohos_js_hap_suite("huksderive_promise_basic_js_test") { ":huks_js_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksDeriveBasicPromiseJSApiTest" + hap_name = "huksDeriveBasicPromiseJSApiTest" } ohos_js_assets("huks_js_assets") { source_dir = "./entry/src/main/js/MainAbility" diff --git a/security/security_huks_basic/huks_derive_promise_BasicTest/Test.json b/security/security_huks_basic/huks_derive_promise_BasicTest/Test.json index dc27c0af8a857b2d345e68f738cea27a4e414257..e77b6d92d46acfd59f54e365cc6a0b3a249a200c 100644 --- a/security/security_huks_basic/huks_derive_promise_BasicTest/Test.json +++ b/security/security_huks_basic/huks_derive_promise_BasicTest/Test.json @@ -2,14 +2,14 @@ "description": "Configuration for huksDeriveBasicPromise js api Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "4200000", "package": "com.example.huksderivebasicpromise", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsHuksDeriveBasicPromiseJSApiTest.hap" + "huksDeriveBasicPromiseJSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit.test.js index 09d8f352e4aacb4666501bef814d27e67e8e5824..1901ef8580bb2368f36f222e2e69b2496e028865 100644 --- a/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit.test.js @@ -35,8 +35,7 @@ let HuksOptions63kb = { describe('SecurityHuksDeriveHKDFPromiseJsunit', function () { it('testDeriveHKDF102', 0, async function (done) { - const srcKeyAliesFirst = - 'testDeriveHKDFSize128SHA256Abort63KBDeriveKeyAlias_01_101'; + const srcKeyAliesFirst = 'testDeriveHKDFSize128SHA256Abort63KBDeriveKeyAlias_01_101'; let huksOptionsFinish = { properties: new Array( HuksDeriveHKDF.HuksKeySTORAGE, @@ -54,12 +53,7 @@ describe('SecurityHuksDeriveHKDFPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicDeriveFunc( - srcKeyAliesFirst, - HuksOptions63kb, - huksOptionsFinish, - 'abort' - ); + await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit.test.js index 5e6d487d69a17824053ff6acac8f5656e6724ef0..38f71e9938ce099cae87c1b8c8ef95d339e59631 100644 --- a/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit.test.js @@ -34,8 +34,7 @@ let HuksOptions63kb = { describe('SecurityHuksDeriveHKDFPromiseJsunit', function () { it('testDeriveHKDF101', 0, async function (done) { - const srcKeyAliesFirst = - 'testDeriveHKDFSize128SHA256Finish63KBDeriveKeyAlias_01_101'; + const srcKeyAliesFirst = 'testDeriveHKDFSize128SHA256Finish63KBDeriveKeyAlias_01_101'; let huksOptionsFinish = { properties: new Array( HuksDeriveHKDF.HuksKeySTORAGE, @@ -53,12 +52,7 @@ describe('SecurityHuksDeriveHKDFPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicDeriveFunc( - srcKeyAliesFirst, - HuksOptions63kb, - huksOptionsFinish, - 'finish' - ); + await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); done(); }); }); diff --git a/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit.test.js index 44d89c650f74a43b04d140a5b7999bc4373d127e..4e903c6fc1465a36a01696aec36f45067cbeefcf 100644 --- a/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit.test.js @@ -34,8 +34,7 @@ let HuksOptions63kb = { }; describe('SecurityHuksDerivePBKDF2PromiseJsunit', function () { it('testDerivePBKDF2102', 0, async function (done) { - const srcKeyAliesFirst = - 'testDerivePBKDF2Size128SHA256Abort63KBDeriveKeyAlias_01_101'; + const srcKeyAliesFirst = 'testDerivePBKDF2Size128SHA256Abort63KBDeriveKeyAlias_01_101'; let huksOptionsFinish = { properties: new Array( HuksDerivePBKDF2.HuksKeySTORAGE, @@ -53,12 +52,7 @@ describe('SecurityHuksDerivePBKDF2PromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicDeriveFunc( - srcKeyAliesFirst, - HuksOptions63kb, - huksOptionsFinish, - 'abort' - ); + await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); done(); }); }); diff --git a/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit.test.js b/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit.test.js index f2e9908e449779420f0a9f0c89c9e1be56440214..279f55425a082751700dd89c4067680a02a9da17 100644 --- a/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_derive_promise_BasicTest/entry/src/main/js/test/Derive/SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit.test.js @@ -35,8 +35,7 @@ let HuksOptions63kb = { describe('SecurityHuksDerivePBKDF2PromiseJsunit', function () { it('testDerivePBKDF2101', 0, async function (done) { - const srcKeyAliesFirst = - 'testDerivePBKDF2Size128SHA256Finish63KBDeriveKeyAlias_01_101'; + const srcKeyAliesFirst = 'testDerivePBKDF2Size128SHA256Finish63KBDeriveKeyAlias_01_101'; let huksOptionsFinish = { properties: new Array( HuksDerivePBKDF2.HuksKeySTORAGE, @@ -54,12 +53,7 @@ describe('SecurityHuksDerivePBKDF2PromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicDeriveFunc( - srcKeyAliesFirst, - HuksOptions63kb, - huksOptionsFinish, - 'finish' - ); + await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); done(); }); }); 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 27a317886e976732b199126fe7761c2c864dc510..d860b7d3268e3ffbd13d3122c69b3a9bc3e71098 100644 --- a/security/security_huks_basic/huks_hmac_callback_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_hmac_callback_BasicTest/BUILD.gn @@ -19,7 +19,7 @@ ohos_js_hap_suite("hukshmac_callback_basic_js_test") { ":huks_js_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksHmacBasicCallbackJSApiTest" + hap_name = "huksHmacBasicCallbackJSApiTest" } ohos_js_assets("huks_js_assets") { source_dir = "./entry/src/main/js/MainAbility" diff --git a/security/security_huks_basic/huks_hmac_callback_BasicTest/Test.json b/security/security_huks_basic/huks_hmac_callback_BasicTest/Test.json index 14b835e98c90ae4fbceaac4e13e5bfcb28751540..21c4f375f9cbe0e7644c6bb2d7cb30c2d48acf68 100644 --- a/security/security_huks_basic/huks_hmac_callback_BasicTest/Test.json +++ b/security/security_huks_basic/huks_hmac_callback_BasicTest/Test.json @@ -2,14 +2,14 @@ "description": "Configuration for huksHmacBasicCallback js api Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "600000", "package": "com.example.huksHmacbasiccallback", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsHuksHmacBasicCallbackJSApiTest.hap" + "huksHmacBasicCallbackJSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js b/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js index 472dc6bef50e073ac5d42f28a3ef7028b4aa95d4..8e842faa52c5512cdfb6fce7af6fef4c40110060 100644 --- a/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js @@ -28,9 +28,7 @@ function generateKey(srcKeyAlies, HuksOptions) { huks.generateKey(srcKeyAlies, HuksOptions, function (err, data) { try { if (err.code !== 0) { - console.log( - 'test generateKey err information: ' + JSON.stringify(err) - ); + console.log('test generateKey err information: ' + JSON.stringify(err)); reject(err); } else { resolve(data); @@ -154,9 +152,7 @@ async function publicHmacUpdate(HuksOptions) { let count = Math.floor(inDataArray.length / dateSize); let remainder = inDataArray.length % dateSize; for (let i = 0; i < count; i++) { - HuksOptions.inData = new Uint8Array( - stringToArray(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1)) - ); + HuksOptions.inData = new Uint8Array(stringToArray(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1))); await update(handle, HuksOptions) .then((data) => { console.log(`test update data: ${data}`); @@ -167,12 +163,7 @@ async function publicHmacUpdate(HuksOptions) { }); } if (remainder !== 0) { - HuksOptions.inData = new Uint8Array( - stringToArray(huksOptionsInData).slice( - dateSize * count, - inDataArray.length - ) - ); + HuksOptions.inData = new Uint8Array(stringToArray(huksOptionsInData).slice(dateSize * count, inDataArray.length)); console.log(`test update HuksOptions.inData ${HuksOptions.inData}`); await update(handle, HuksOptions) .then((data) => { @@ -244,11 +235,7 @@ describe('SecurityHuksHmacCallbackJsunit', function () { it('testHmacSHA1001', 0, async function (done) { let srcKeyAlies = 'testHmacDigestSHA1KeyAlias001'; let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), + properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), inData: srcData63Kb, }; @@ -259,11 +246,7 @@ describe('SecurityHuksHmacCallbackJsunit', function () { it('testHmacSHA1002', 0, async function (done) { let srcKeyAlies = 'testHmacDigestSHA1KeyAlias002'; let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), + properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), inData: srcData63Kb, }; await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort'); @@ -272,11 +255,7 @@ describe('SecurityHuksHmacCallbackJsunit', function () { it('testHmacSHA1003', 0, async function (done) { let srcKeyAlies = 'testHmacDigestSHA1KeyAlias003'; let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), + properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), inData: srcData65Kb, }; await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'finish'); @@ -285,11 +264,7 @@ describe('SecurityHuksHmacCallbackJsunit', function () { it('testHmacSHA1004', 0, async function (done) { let srcKeyAlies = 'testHmacDigestSHA1KeyAlias004'; let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), + properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), inData: srcData65Kb, }; await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort'); 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 6b5f3b70c4f491dbaabc9ce165c42e6e927e1096..b67b9dc46d595edfb9cfac8e2506eafb6c1fd3aa 100644 --- a/security/security_huks_basic/huks_hmac_promise_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_hmac_promise_BasicTest/BUILD.gn @@ -19,7 +19,7 @@ ohos_js_hap_suite("hukshmac_promise_basic_js_test") { ":huks_js_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksHmacBasicPromiseJSApiTest" + hap_name = "huksHmacBasicPromiseJSApiTest" } ohos_js_assets("huks_js_assets") { source_dir = "./entry/src/main/js/MainAbility" diff --git a/security/security_huks_basic/huks_hmac_promise_BasicTest/Test.json b/security/security_huks_basic/huks_hmac_promise_BasicTest/Test.json index ce4accfe9ba41aea3da5847cb58b6111c327473a..e4b6fac847975649555fe6901a81de1944ab7529 100644 --- a/security/security_huks_basic/huks_hmac_promise_BasicTest/Test.json +++ b/security/security_huks_basic/huks_hmac_promise_BasicTest/Test.json @@ -2,14 +2,14 @@ "description": "Configuration for huksHmacBasicPromise js api Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "600000", "package": "com.example.huksHmacbasicpromise", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsHuksHmacBasicPromiseJSApiTest.hap" + "huksHmacBasicPromiseJSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/security/security_huks_basic/huks_hmac_promise_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js b/security/security_huks_basic/huks_hmac_promise_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js index 64ecab027206cf868e994b5e3b5f0fe4391c860e..8deee00b0ef102bbdc60a82601dec6ea6510d31b 100644 --- a/security/security_huks_basic/huks_hmac_promise_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_hmac_promise_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js @@ -63,18 +63,11 @@ async function publicHmacUpdateFunc(HuksOptions) { let count = Math.floor(inDataArray.length / dateSize); let remainder = inDataArray.length % dateSize; for (let i = 0; i < count; i++) { - HuksOptions.inData = new Uint8Array( - stringToArray(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1)) - ); + HuksOptions.inData = new Uint8Array(stringToArray(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1))); await update(handle, HuksOptions); } if (remainder !== 0) { - HuksOptions.inData = new Uint8Array( - stringToArray(huksOptionsInData).slice( - dateSize * count, - inDataArray.length - ) - ); + HuksOptions.inData = new Uint8Array(stringToArray(huksOptionsInData).slice(dateSize * count, inDataArray.length)); await update(handle, HuksOptions); } } @@ -150,11 +143,7 @@ describe('SecurityHuksHmacBasicPromiseJsunit', function () { it('testHmac101', 0, async function (done) { const srcKeyAlies = 'testHmacDigestSHA1KeyAlias101'; let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), + properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), inData: srcData63Kb, }; await publicHmacFunc(srcKeyAlies, HuksOptions, 'finish'); @@ -164,11 +153,7 @@ describe('SecurityHuksHmacBasicPromiseJsunit', function () { it('testHmac102', 0, async function (done) { const srcKeyAlies = 'testHmacDigestSHA1KeyAlias102'; let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), + properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), inData: srcData63Kb, }; await publicHmacFunc(srcKeyAlies, HuksOptions, 'abort'); @@ -178,11 +163,7 @@ describe('SecurityHuksHmacBasicPromiseJsunit', function () { it('testHmac103', 0, async function (done) { const srcKeyAlies = 'testHmacDigestSHA1KeyAlias103'; let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), + properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), inData: srcData65Kb, }; await publicHmacFunc(srcKeyAlies, HuksOptions, 'finish'); @@ -192,11 +173,7 @@ describe('SecurityHuksHmacBasicPromiseJsunit', function () { it('testHmac104', 0, async function (done) { const srcKeyAlies = 'testHmacDigestSHA1KeyAlias104'; let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), + properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), inData: srcData65Kb, }; await publicHmacFunc(srcKeyAlies, HuksOptions, 'abort'); diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/BUILD.gn b/security/security_huks_basic/huks_signverify_callback_BasicTest/BUILD.gn index 6563049b7e1183d172acfd4045a7b09ec2246dcc..5a09b250796ad1768803257d3bad781b67758d08 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/BUILD.gn @@ -19,7 +19,7 @@ ohos_js_hap_suite("hukssignverify_callback_basic_js_test") { ":huks_js_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksSignVerifyBasicCallbackJSApiTest" + hap_name = "huksSignVerifyBasicCallbackJSApiTest" } ohos_js_assets("huks_js_assets") { source_dir = "./entry/src/main/js/MainAbility" diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/Test.json b/security/security_huks_basic/huks_signverify_callback_BasicTest/Test.json index c33854cb2e6d9b9b88553b4d79f9581f037169db..943a70d0e8683ad011bd617d75604bde4617c43b 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/Test.json +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/Test.json @@ -2,14 +2,14 @@ "description": "Configuration for huksSignVerifyBasicCallback js api Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "12600000", "package": "com.example.hukssignverifybasiccallback", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsHuksSignVerifyBasicCallbackJSApiTest.hap" + "huksSignVerifyBasicCallbackJSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true 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 dec2af574d863e4cf59a1b877c6d930c33b42fb6..b0ca97fe203bba679f6c8c1333c966744bc7219d 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 @@ -22,7 +22,6 @@ let srcData63Kb = stringToUint8Array(srcData63); describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { it('testSignVerifyDSA002', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias002'; - const NewSrcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAliasNew002'; let HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -31,14 +30,7 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - NewSrcKeyAlies, - HuksOptions, - 'abort', - true, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 ae814fc709e2db2a5dfa786acbabdace050e3ce5..cb938331de627ae11834572954c6abef9481bb7b 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 @@ -23,7 +23,6 @@ let srcData65Kb = stringToUint8Array(srcData65); describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { it('testSignVerifyDSA004', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias004'; - const NewSrcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAliasNew004'; let HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -32,14 +31,7 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - NewSrcKeyAlies, - HuksOptions, - 'abort', - true, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 79e956bcd4313671523aee66a56a09d59496c9ce..2806e5c5ec3e42ed8636f3ce7561002e900e8cea 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 @@ -23,7 +23,6 @@ let finishOutData; describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { it('testSignVerifyDSA001', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias001'; - const newSrcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAliasNew001'; let HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -32,14 +31,7 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { ), inData: srcData63Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - newSrcKeyAlies, - HuksOptions, - 'finish', - true, - srcData63Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData63Kb); HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -49,14 +41,7 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - newSrcKeyAlies, - HuksOptions, - 'finish', - false, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', 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 d1c2003dd99320f880e1ceefe9f4d986c05c2915..381a143b455900b6dedb39f5d3cae059a7cf1d76 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 @@ -23,7 +23,6 @@ let finishOutData; describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { it('testSignVerifyDSA003', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias003'; - const newSrcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAliasNew003'; let HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -32,14 +31,7 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { ), inData: srcData65Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - newSrcKeyAlies, - HuksOptions, - 'finish', - true, - srcData65Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData65Kb); HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -49,14 +41,7 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - newSrcKeyAlies, - HuksOptions, - 'finish', - false, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', 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 a9339076018bc456a1dccd521ef6c05adeaef2a6..534d47c78c489f721eccef4f9577b747d9d909fc 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 @@ -31,14 +31,7 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 42cf30e6d1c911298400aa0c8a0860350a9a6ab4..a7658ee1fcafbe59bd8ef614283ddabccfcda23e 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 @@ -31,14 +31,7 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 73aded4023d7e22327e998db466894a9114765ce..cc3a39acf2545aab6c73b1cf1a4e3167e6f6da62 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 @@ -32,14 +32,7 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { ), inData: srcData63Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData63Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData63Kb); HuksOptions = { properties: new Array( HuksSignVerifyECC.HuksKeyAlgECC, @@ -49,14 +42,7 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', 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 1f2a03ee6c643aa02a2867d11e9299bc6fd396d8..750b6c1ccd4a66e5002987fdb78e8d6e5272b1db 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 @@ -32,14 +32,7 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { ), inData: srcData65Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData65Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData65Kb); HuksOptions = { properties: new Array( HuksSignVerifyECC.HuksKeyAlgECC, @@ -49,14 +42,7 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', 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 9e48412ff4687b05705a4fd99ffd3661aa147772..345023993ee674f646729a18d8fd511f0795a920 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 @@ -34,14 +34,7 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { ), inData: srcData63Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData63Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData63Kb); HuksOptions = { properties: new Array( @@ -52,14 +45,7 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', false, srcData63Kb); done(); }); @@ -74,14 +60,7 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', true, srcData63Kb); done(); }); @@ -96,14 +75,7 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { ), inData: srcData65Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData65Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData65Kb); HuksOptions = { properties: new Array( HuksSignVerifyED25519.HuksKeyAlgED25519, @@ -113,14 +85,7 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', false, srcData65Kb); done(); }); @@ -135,14 +100,7 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 667a1901bf882259855ae7a089a45eb09016e0e1..88edc35e5f01536436effff14c071263287657c4 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 @@ -35,14 +35,7 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 c978731df7d4676d8e75140eedaf952d944f657f..42efb1bda75e3a7bf4720ec9a75b4f14fe694603 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 @@ -32,14 +32,7 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 8380c0b581c4f0a664af193b5e6e57034952b593..d8e6d06251ee4a48c0855776314cd85f26a76dd6 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 @@ -33,14 +33,7 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { ), inData: srcData63Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData63Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData63Kb); HuksOptions = { properties: new Array( HuksSignVerifyRSA.HuksKeyAlgRSA, @@ -51,14 +44,7 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', 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 026203fab7f55ad24172245b324b3c58b8401a84..c49d46756d61b11cd341df02d40bd45a6229f2bb 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 @@ -33,14 +33,7 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { ), inData: srcData65Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData65Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData65Kb); HuksOptions = { properties: new Array( HuksSignVerifyRSA.HuksKeyAlgRSA, @@ -51,14 +44,7 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', false, srcData65Kb); done(); }); }); diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/BUILD.gn b/security/security_huks_basic/huks_signverify_promise_BasicTest/BUILD.gn index e4ae8d77e8936ebf243d42b9b68cf5bdb53669fa..4ad729db53c41f2010c7ed4eb70845390f3a50d4 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/BUILD.gn +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/BUILD.gn @@ -19,7 +19,7 @@ ohos_js_hap_suite("hukssignverify_promise_basic_js_test") { ":huks_js_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsHuksSignVerifyBasicPromiseJSApiTest" + hap_name = "huksSignVerifyBasicPromiseJSApiTest" } ohos_js_assets("huks_js_assets") { source_dir = "./entry/src/main/js/MainAbility" diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/Test.json b/security/security_huks_basic/huks_signverify_promise_BasicTest/Test.json index 8375b5d603eb47b8418a85d36c0f2c57697eb281..304d608ba16e8ea6b994e6c0e0655e45faafa186 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/Test.json +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/Test.json @@ -2,14 +2,14 @@ "description": "Configuration for huksSignVerifyBasicPromise js api Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "12600000", "package": "com.example.hukssignverifybasicpromise", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsHuksSignVerifyBasicPromiseJSApiTest.hap" + "huksSignVerifyBasicPromiseJSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true 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 6c942e3f5ae35f4c6f99dca208793a2f0ad06a92..89a30a1ace07eeaacb3e59b69b0b3cae03bb99df 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,11 +19,9 @@ 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'; - const NewSrcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAliasNew102'; let HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -32,14 +30,7 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { ), inData: srcData63Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - NewSrcKeyAlies, - HuksOptions, - 'abort', - true, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 c01a5e7f734d63b431453f49fd9782c2b11b206e..381a36171f00a5a7e7328276411053a7d2ad2ba6 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,11 +19,9 @@ 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'; - const NewSrcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAliasNew104'; let HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -32,14 +30,7 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - NewSrcKeyAlies, - HuksOptions, - 'abort', - true, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 31628987a1e8e6686cf23f5fbc318b402bd582ec..71472c80793552dff509888b61d98037c1cceca5 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 @@ -23,7 +23,6 @@ let finishOutData; describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { it('testSignVerifyDSA101', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias101'; - const newSrcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAliasNew101'; let HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -32,14 +31,7 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { ), inData: srcData63Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - newSrcKeyAlies, - HuksOptions, - 'finish', - true, - srcData63Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData63Kb); HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -49,14 +41,7 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - newSrcKeyAlies, - HuksOptions, - 'finish', - false, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', 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 cb19fdc526843a643b8a00e405f1a2c818a67cb7..48327069fa07d0eef17c0e7c754ae312d9bd3c91 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 @@ -23,7 +23,6 @@ let finishOutData; describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { it('testSignVerifyDSA103', 0, async function (done) { const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias103'; - const newSrcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAliasNew103'; let HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -32,14 +31,7 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { ), inData: srcData65Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - newSrcKeyAlies, - HuksOptions, - 'finish', - true, - srcData65Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData65Kb); HuksOptions = { properties: new Array( HuksSignVerifyDSA.HuksKeyAlgDSA, @@ -49,14 +41,7 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - newSrcKeyAlies, - HuksOptions, - 'finish', - false, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', 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 1900281c1c020d7941f7e1e679b08da3dd6059c9..bd90c5808b75009e30f34d9dfa1542567f0dfbf5 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 @@ -31,14 +31,7 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 d7000b4ed467afbe3725ff7e82de5391310177f9..c2e095cb57dc1d8027887f6075036d7065a78d28 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 @@ -31,14 +31,7 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 aabb456231cd8230dcb03fc384b54ecf04872cf7..af4af587e331ad03e51f83a76d40cf9cd939515a 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 @@ -32,14 +32,7 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { ), inData: srcData63Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData63Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData63Kb); HuksOptions = { properties: new Array( HuksSignVerifyECC.HuksKeyAlgECC, @@ -49,14 +42,7 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', 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 c3a673af571e9af0801b1801f26b446d5c4d55d7..15268465ca8ae94ab5eb63951a731728d1ff41fb 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 @@ -32,14 +32,7 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { ), inData: srcData65Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData65Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData65Kb); HuksOptions = { properties: new Array( HuksSignVerifyECC.HuksKeyAlgECC, @@ -49,14 +42,7 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', 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 f07216d6cc86ce4379e1284c6dfafdeb76ae572e..45105e754fba22c82986162caf39eb409d1bde6c 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 @@ -34,14 +34,7 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { ), inData: srcData63Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData63Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData63Kb); HuksOptions = { properties: new Array( @@ -52,14 +45,7 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', false, srcData63Kb); done(); }); @@ -74,14 +60,7 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', true, srcData63Kb); done(); }); @@ -96,14 +75,7 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { ), inData: srcData65Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData65Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData65Kb); HuksOptions = { properties: new Array( HuksSignVerifyED25519.HuksKeyAlgED25519, @@ -113,14 +85,7 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', false, srcData65Kb); done(); }); @@ -135,14 +100,7 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 09dbca4f166863336db44fe04f780c782cc0962b..422c9502a2a1aec795e0acba2d1004f48ba28303 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 @@ -32,14 +32,7 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { ), inData: srcData63Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 a500d3f51e49650a8f180f7f7c0c605878c547cf..c40a7c538dbb2a95686b1cff2a21603f23a3e35f 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 @@ -33,14 +33,7 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { ), inData: srcData65Kb, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'abort', - true, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', 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 408f9b1ed3a71a2696d9af60c0a1fc07fe259bae..4d0d36b1ed2aa1009f2305255c917f09ebf39c2e 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 @@ -33,14 +33,7 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { ), inData: srcData63Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData63Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData63Kb); HuksOptions = { properties: new Array( HuksSignVerifyRSA.HuksKeyAlgRSA, @@ -51,14 +44,7 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData63Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', 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 ead51dcaa0073c6d5cb652469449388e81adfe8d..36222e79c77c923335d38c3309c907457466ea80 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 @@ -33,14 +33,7 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { ), inData: srcData65Kb, }; - finishOutData = await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - true, - srcData65Kb - ); + finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData65Kb); HuksOptions = { properties: new Array( @@ -52,14 +45,7 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () { ), inData: finishOutData, }; - await publicSignVerifyFunc( - srcKeyAlies, - srcKeyAlies + 'New', - HuksOptions, - 'finish', - false, - srcData65Kb - ); + await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', false, srcData65Kb); done(); }); }); diff --git a/security/security_huks_basic/utils/param/agree/publicAgreeCallback.js b/security/security_huks_basic/utils/param/agree/publicAgreeCallback.js index 8c4931b2d2d1469bd1722e87c3a802f80f42180e..ff46f4992882c0489152aad0f64c2d7aa6d7db2c 100644 --- a/security/security_huks_basic/utils/param/agree/publicAgreeCallback.js +++ b/security/security_huks_basic/utils/param/agree/publicAgreeCallback.js @@ -135,10 +135,7 @@ function update(handle, HuksOptions) { }); } -async function publicAgreeFinishAbortFunc( - HuksOptionsFinish, - thirdInderfaceName -) { +async function publicAgreeFinishAbortFunc(HuksOptionsFinish, thirdInderfaceName) { if (thirdInderfaceName == 'finish') { await finish(handle, HuksOptionsFinish) .then((data) => { @@ -250,10 +247,7 @@ async function publicAgreeFunc( await publicAgreeInitFunc(srcKeyAliesSecond, HuksOptions); await publicAgreeUpdateFunc(HuksOptions, 2); - await publicAgreeFinishAbortFunc( - HuksOptionsFinishSecond, - thirdInderfaceName - ); + await publicAgreeFinishAbortFunc(HuksOptionsFinishSecond, thirdInderfaceName); await publicAgreeDeleteFunc(srcKeyAliesFrist, HuksOptions); if (thirdInderfaceName == 'finish') { diff --git a/security/security_huks_basic/utils/param/agree/publicAgreeParam.js b/security/security_huks_basic/utils/param/agree/publicAgreeParam.js index 73b72f03ba7f0393db363dca2dcb70629327617d..c7dc741d64151d89081f917b29e9d01fd21a358a 100644 --- a/security/security_huks_basic/utils/param/agree/publicAgreeParam.js +++ b/security/security_huks_basic/utils/param/agree/publicAgreeParam.js @@ -114,9 +114,7 @@ let HuksAgreeDH = { }, HuksKeyPurposeENCRYPTDECRYPT: { tag: param.HksTag.HKS_TAG_PURPOSE, - value: - param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | - param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, + value: param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, }, HuksKeyPurposeDH: { tag: param.HksTag.HKS_TAG_PURPOSE, @@ -276,9 +274,7 @@ let HuksAgreeECDH = { }, HuksKeyPurposeENCRYPTDECRYPT: { tag: param.HksTag.HKS_TAG_PURPOSE, - value: - param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | - param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, + value: param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, }, }; @@ -406,9 +402,7 @@ let HuksKeyAlgX25519 = { }, HuksKeyPurposeENCRYPTDECRYPT: { tag: param.HksTag.HKS_TAG_PURPOSE, - value: - param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | - param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, + value: param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, }, HuksKeyPurposeX25519: { tag: param.HksTag.HKS_TAG_PURPOSE, diff --git a/security/security_huks_basic/utils/param/agree/publicAgreePromise.js b/security/security_huks_basic/utils/param/agree/publicAgreePromise.js index bd8e04cae79f63ba1e3faee8ddd6281f9b69ddfc..77ac2679780d1099744ebb4d74b23c2c2b86e085 100644 --- a/security/security_huks_basic/utils/param/agree/publicAgreePromise.js +++ b/security/security_huks_basic/utils/param/agree/publicAgreePromise.js @@ -85,10 +85,7 @@ async function publicAgreeUpdateFunc(HuksOptions, exportKey) { HuksOptions.inData = _inData; } -async function publicAgreeFinishAbortFunc( - HuksOptionsFinish, - thirdInderfaceName -) { +async function publicAgreeFinishAbortFunc(HuksOptionsFinish, thirdInderfaceName) { if (thirdInderfaceName == 'finish') { await huks .finish(handle, HuksOptionsFinish) @@ -164,10 +161,7 @@ async function publicAgreeFunc( await publicAgreeInitFunc(srcKeyAliesSecond, HuksOptions); await publicAgreeUpdateFunc(HuksOptions, 2); - await publicAgreeFinishAbortFunc( - HuksOptionsFinishSecond, - thirdInderfaceName - ); + await publicAgreeFinishAbortFunc(HuksOptionsFinishSecond, thirdInderfaceName); await publicAgreeDeleteFunc(srcKeyAliesFrist, HuksOptions); if (thirdInderfaceName == 'finish') { diff --git a/security/security_huks_basic/utils/param/cipher/publicCipherParam.js b/security/security_huks_basic/utils/param/cipher/publicCipherParam.js index 7f453f3d888933a3d0ad029e5fbe7ac845447c70..d5f1d10af7d945729403f7952a35f113d561ecfb 100644 --- a/security/security_huks_basic/utils/param/cipher/publicCipherParam.js +++ b/security/security_huks_basic/utils/param/cipher/publicCipherParam.js @@ -22,9 +22,7 @@ let HuksCipherAES = { }, HuksKeyPurpose: { tag: param.HksTag.HKS_TAG_PURPOSE, - value: - param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | - param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, + value: param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, }, HuksKeyPurposeENCRYPT: { tag: param.HksTag.HKS_TAG_PURPOSE, @@ -79,9 +77,7 @@ let HuksCipherRSA = { }, HuksKeyPurpose: { tag: param.HksTag.HKS_TAG_PURPOSE, - value: - param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | - param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, + value: param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, }, HuksKeyPurposeENCRYPT: { tag: param.HksTag.HKS_TAG_PURPOSE, diff --git a/security/security_huks_basic/utils/param/derive/publicDeriveCallback.js b/security/security_huks_basic/utils/param/derive/publicDeriveCallback.js index 67874818f2764d0e9b8c27465306838061c032a8..0659f2ae64c66c371a1248e6e96f33f0194e15be 100644 --- a/security/security_huks_basic/utils/param/derive/publicDeriveCallback.js +++ b/security/security_huks_basic/utils/param/derive/publicDeriveCallback.js @@ -96,10 +96,7 @@ function update(handle, HuksOptions) { }); } -async function publicDeriveFinishAbortFunc( - huksOptionsFinish, - thirdInderfaceName -) { +async function publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName) { if (thirdInderfaceName == 'finish') { await finish(handle, huksOptionsFinish) .then((data) => { @@ -178,39 +175,18 @@ function deleteKey(srcKeyAlies, HuksOptions) { }); } -async function publicDeriveFunc( - srcKeyAlies, - HuksOptions, - huksOptionsFinish, - thirdInderfaceName -) { +async function publicDeriveFunc(srcKeyAlies, HuksOptions, huksOptionsFinish, thirdInderfaceName) { try { await publicDeriveGenFunc(srcKeyAlies, HuksOptions); - HuksOptions.properties.splice( - 0, - 1, - paramPublic.HuksDeriveHKDF.HuksKeyAlgHKDF - ); - HuksOptions.properties.splice( - 3, - 1, - paramPublic.HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE - ); + HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgHKDF); + HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE); await publicDeriveInitFunc(srcKeyAlies, HuksOptions); await publicDeriveUpdateFunc(HuksOptions); await publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName); - HuksOptions.properties.splice( - 0, - 1, - paramPublic.HuksDeriveHKDF.HuksKeyAlgAES - ); - HuksOptions.properties.splice( - 3, - 1, - paramPublic.HuksDeriveHKDF.HuksKeyHKDFSize128 - ); + HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgAES); + HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyHKDFSize128); await publicDeriveDeleteFunc(srcKeyAlies, HuksOptions); } catch (e) { expect(null).assertFail(); diff --git a/security/security_huks_basic/utils/param/derive/publicDeriveParam.js b/security/security_huks_basic/utils/param/derive/publicDeriveParam.js index 2bd05d7f1806bffc342d281afc5fe0cabb7dc0aa..98f49007c912fcc7b6a404ca548321dc27ef12ef 100644 --- a/security/security_huks_basic/utils/param/derive/publicDeriveParam.js +++ b/security/security_huks_basic/utils/param/derive/publicDeriveParam.js @@ -95,9 +95,7 @@ let HuksDeriveHKDF = { }, HuksKeyPurposeENCRYPTDECRYPT: { tag: param.HksTag.HKS_TAG_PURPOSE, - value: - param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | - param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, + value: param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, }, HuksKeyPADDINGNONE: { tag: param.HksTag.HKS_TAG_PADDING, @@ -234,9 +232,7 @@ let HuksDerivePBKDF2 = { }, HuksKeyPurposeENCRYPTDECRYPT: { tag: param.HksTag.HKS_TAG_PURPOSE, - value: - param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | - param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, + value: param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT, }, HuksKeyPADDINGNONE: { tag: param.HksTag.HKS_TAG_PADDING, diff --git a/security/security_huks_basic/utils/param/derive/publicDerivePromise.js b/security/security_huks_basic/utils/param/derive/publicDerivePromise.js index 2db56f097690f642639ddac7d6599f7947332879..86a4a3f065b888736f77ad0cc7fa1b7c7d0b0b33 100644 --- a/security/security_huks_basic/utils/param/derive/publicDerivePromise.js +++ b/security/security_huks_basic/utils/param/derive/publicDerivePromise.js @@ -57,10 +57,7 @@ async function publicDeriveUpdateFunc(HuksOptions) { }); } -async function publicDeriveFinishAbortFunc( - huksOptionsFinish, - thirdInderfaceName -) { +async function publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName) { if (thirdInderfaceName == 'finish') { await huks .finish(handle, huksOptionsFinish) @@ -103,39 +100,18 @@ async function publicDeriveDeleteFunc(srcKeyAlies, HuksOptions) { }); } -async function publicDeriveFunc( - srcKeyAlies, - HuksOptions, - huksOptionsFinish, - thirdInderfaceName -) { +async function publicDeriveFunc(srcKeyAlies, HuksOptions, huksOptionsFinish, thirdInderfaceName) { try { await publicDeriveGenFunc(srcKeyAlies, HuksOptions); - HuksOptions.properties.splice( - 0, - 1, - paramPublic.HuksDeriveHKDF.HuksKeyAlgHKDF - ); - HuksOptions.properties.splice( - 3, - 1, - paramPublic.HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE - ); + HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgHKDF); + HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE); await publicDeriveInitFunc(srcKeyAlies, HuksOptions); await publicDeriveUpdateFunc(HuksOptions); await publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName); - HuksOptions.properties.splice( - 0, - 1, - paramPublic.HuksDeriveHKDF.HuksKeyAlgAES - ); - HuksOptions.properties.splice( - 3, - 1, - paramPublic.HuksDeriveHKDF.HuksKeyHKDFSize128 - ); + HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgAES); + HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyHKDFSize128); await publicDeriveDeleteFunc(srcKeyAlies, HuksOptions); } catch (e) { expect(null).assertFail(); diff --git a/security/security_huks_basic/utils/param/signverify/publicSignverifyCallback.js b/security/security_huks_basic/utils/param/signverify/publicSignverifyCallback.js index 9ebc06986b4abf61e560bdf0c13748b23e9e0f25..0df9a704d1bfc90de2ae265273eaaf2ff7c9a4ef 100644 --- a/security/security_huks_basic/utils/param/signverify/publicSignverifyCallback.js +++ b/security/security_huks_basic/utils/param/signverify/publicSignverifyCallback.js @@ -139,20 +139,14 @@ async function publicUpdateFunc(HuksOptions) { let remainder = uint8ArrayToString(inDataArray).length % dateSize; for (let i = 0; i < count; i++) { HuksOptions.inData = stringToUint8Array( - uint8ArrayToString(tempHuksOptionsInData).slice( - dateSize * i, - dateSize * (i + 1) - ) + uint8ArrayToString(tempHuksOptionsInData).slice(dateSize * i, dateSize * (i + 1)) ); await update(handle, HuksOptions); HuksOptions.inData = tempHuksOptionsInData; } if (remainder !== 0) { HuksOptions.inData = stringToUint8Array( - uint8ArrayToString(tempHuksOptionsInData).slice( - dateSize * count, - uint8ArrayToString(inDataArray).length - ) + uint8ArrayToString(tempHuksOptionsInData).slice(dateSize * count, uint8ArrayToString(inDataArray).length) ); await update(handle, HuksOptions); HuksOptions.inData = tempHuksOptionsInData; @@ -261,14 +255,7 @@ function deleteKey(srcKeyAlies, HuksOptions) { }); } -async function publicSignVerifyFunc( - srcKeyAlies, - newSrcKeyAlies, - HuksOptions, - thirdInderfaceName, - isSING, - rawData -) { +async function publicSignVerifyFunc(srcKeyAlies, HuksOptions, thirdInderfaceName, isSING, rawData) { try { let keyAlias = srcKeyAlies; let purposeSignVerigy = HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY; @@ -285,7 +272,7 @@ async function publicSignVerifyFunc( HuksOptions.properties.splice(2, 1); } } else { - keyAlias = newSrcKeyAlies; + keyAlias = srcKeyAlies + 'New'; finishOutData = HuksOptions.inData; await publicImportKey(keyAlias, HuksOptions); } @@ -307,11 +294,10 @@ async function publicSignVerifyFunc( } if (isSING && thirdInderfaceName == 'abort') { HuksOptions.properties.splice(1, 1, purposeSignVerigy); - await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); } else if (!isSING) { HuksOptions.properties.splice(1, 1, PurposeVerify); - await publicDeleteKeyFunc(newSrcKeyAlies, HuksOptions); } + await publicDeleteKeyFunc(keyAlias, HuksOptions); return finishOutData; } catch (e) { expect(null).assertFail(); diff --git a/security/security_huks_basic/utils/param/signverify/publicSignverifyParam.js b/security/security_huks_basic/utils/param/signverify/publicSignverifyParam.js index 0eac5b2636ae86f6c3ea34b3f68a71d2f0e8099b..0e713a78faee0542743a86b28b5bf6241b8a6c54 100644 --- a/security/security_huks_basic/utils/param/signverify/publicSignverifyParam.js +++ b/security/security_huks_basic/utils/param/signverify/publicSignverifyParam.js @@ -61,9 +61,7 @@ let HuksSignVerifyDSA = { }, HuksKeyRSAPurposeSINGVERIFY: { tag: param.HksTag.HKS_TAG_PURPOSE, - value: - param.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | - param.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY, + value: param.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | param.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY, }, }; @@ -126,9 +124,7 @@ let HuksSignVerifyECC = { }, HuksKeyECCPurposeSINGVERIFY: { tag: param.HksTag.HKS_TAG_PURPOSE, - value: - param.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | - param.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY, + value: param.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | param.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY, }, }; @@ -155,9 +151,7 @@ let HuksSignVerifyED25519 = { }, HuksKeyRSAPurposeSINGVERIFY: { tag: param.HksTag.HKS_TAG_PURPOSE, - value: - param.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | - param.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY, + value: param.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | param.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY, }, HuksTagDigestSHA1: { tag: param.HksTag.HKS_TAG_DIGEST, @@ -208,9 +202,7 @@ let HuksSignVerifyRSA = { }, HuksKeyRSAPurposeSINGVERIFY: { tag: param.HksTag.HKS_TAG_PURPOSE, - value: - param.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | - param.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY, + value: param.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | param.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY, }, HuksKeyRSAPADDINGPKCS1V15: { tag: param.HksTag.HKS_TAG_PADDING, @@ -269,9 +261,4 @@ let HuksSignVerifyRSA = { value: param.HksKeyDigest.HKS_DIGEST_SHA512, }, }; -export { - HuksSignVerifyRSA, - HuksSignVerifyDSA, - HuksSignVerifyECC, - HuksSignVerifyED25519, -}; +export { HuksSignVerifyRSA, HuksSignVerifyDSA, HuksSignVerifyECC, HuksSignVerifyED25519 }; diff --git a/security/security_huks_basic/utils/param/signverify/publicSignverifyPromise.js b/security/security_huks_basic/utils/param/signverify/publicSignverifyPromise.js index 9e40804584a951503e39b43922066e2c222951ad..7f28bc2de2527bedac3af138fdc231b60669fdcd 100644 --- a/security/security_huks_basic/utils/param/signverify/publicSignverifyPromise.js +++ b/security/security_huks_basic/utils/param/signverify/publicSignverifyPromise.js @@ -88,20 +88,14 @@ async function publicUpdateFunc(HuksOptions) { let remainder = uint8ArrayToString(inDataArray).length % dateSize; for (let i = 0; i < count; i++) { HuksOptions.inData = stringToUint8Array( - uint8ArrayToString(tempHuksOptionsInData).slice( - dateSize * i, - dateSize * (i + 1) - ) + uint8ArrayToString(tempHuksOptionsInData).slice(dateSize * i, dateSize * (i + 1)) ); await update(handle, HuksOptions); HuksOptions.inData = tempHuksOptionsInData; } if (remainder !== 0) { HuksOptions.inData = stringToUint8Array( - uint8ArrayToString(tempHuksOptionsInData).slice( - dateSize * count, - uint8ArrayToString(inDataArray).length - ) + uint8ArrayToString(tempHuksOptionsInData).slice(dateSize * count, uint8ArrayToString(inDataArray).length) ); await update(handle, HuksOptions); HuksOptions.inData = tempHuksOptionsInData; @@ -162,14 +156,7 @@ async function publicDeleteKeyFunc(KeyAlias, HuksOptions) { }); } -async function publicSignVerifyFunc( - srcKeyAlies, - newSrcKeyAlies, - HuksOptions, - thirdInderfaceName, - isSING, - rawData -) { +async function publicSignVerifyFunc(srcKeyAlies, HuksOptions, thirdInderfaceName, isSING, rawData) { try { let keyAlias = srcKeyAlies; let purposeSignVerigy = HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY; @@ -186,7 +173,7 @@ async function publicSignVerifyFunc( HuksOptions.properties.splice(2, 1); } } else { - keyAlias = newSrcKeyAlies; + keyAlias = srcKeyAlies + 'New'; finishOutData = HuksOptions.inData; await publicImportKey(keyAlias, HuksOptions); } @@ -208,11 +195,10 @@ async function publicSignVerifyFunc( } if (isSING && thirdInderfaceName == 'abort') { HuksOptions.properties.splice(1, 1, purposeSignVerigy); - await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); } else if (!isSING) { HuksOptions.properties.splice(1, 1, PurposeVerify); - await publicDeleteKeyFunc(newSrcKeyAlies, HuksOptions); } + await publicDeleteKeyFunc(keyAlias, HuksOptions); return finishOutData; } catch (e) { expect(null).assertFail();