提交 aa21adad 编写于 作者: 伞木希美
上级 fc48ccb8
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//base/security/huks/build/config.gni")
import("//base/security/huks/huks.gni") import("//base/security/huks/huks.gni")
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
...@@ -39,8 +40,6 @@ ohos_moduletest_suite("ActsHuksNAPITest") { ...@@ -39,8 +40,6 @@ ohos_moduletest_suite("ActsHuksNAPITest") {
"src/huks_agree_ecdh_test.cpp", "src/huks_agree_ecdh_test.cpp",
"src/huks_agree_ecdh_test_common.cpp", "src/huks_agree_ecdh_test_common.cpp",
"src/huks_agree_x25519_test.cpp", "src/huks_agree_x25519_test.cpp",
"src/huks_attest_test.cpp",
"src/huks_attest_test_common.cpp",
"src/huks_cipher_aes_test.cpp", "src/huks_cipher_aes_test.cpp",
"src/huks_cipher_aes_test_common.cpp", "src/huks_cipher_aes_test_common.cpp",
"src/huks_cipher_rsa_test.cpp", "src/huks_cipher_rsa_test.cpp",
...@@ -55,7 +54,6 @@ ohos_moduletest_suite("ActsHuksNAPITest") { ...@@ -55,7 +54,6 @@ ohos_moduletest_suite("ActsHuksNAPITest") {
"src/huks_mem.cpp", "src/huks_mem.cpp",
"src/huks_misc_test.cpp", "src/huks_misc_test.cpp",
"src/huks_nullptr_test.cpp", "src/huks_nullptr_test.cpp",
"src/huks_signverify_dsa_test.cpp",
"src/huks_signverify_ecc_test.cpp", "src/huks_signverify_ecc_test.cpp",
"src/huks_signverify_ecc_test_common.cpp", "src/huks_signverify_ecc_test_common.cpp",
"src/huks_signverify_ed25519_test.cpp", "src/huks_signverify_ed25519_test.cpp",
...@@ -67,6 +65,14 @@ ohos_moduletest_suite("ActsHuksNAPITest") { ...@@ -67,6 +65,14 @@ ohos_moduletest_suite("ActsHuksNAPITest") {
"src/huks_wrapped_test_common.cpp", "src/huks_wrapped_test_common.cpp",
] ]
if (huks_security_level != "trusted_environment") {
sources += [
"src/huks_attest_test.cpp",
"src/huks_attest_test_common.cpp",
"src/huks_signverify_dsa_test.cpp",
]
}
include_dirs = [ include_dirs = [
"//test/xts/acts/security/security_huks_basic/huks_napi_BasicTest/include", "//test/xts/acts/security/security_huks_basic/huks_napi_BasicTest/include",
"include", "include",
......
...@@ -72,7 +72,7 @@ static struct OH_Huks_Param g_genParams001[] = { ...@@ -72,7 +72,7 @@ static struct OH_Huks_Param g_genParams001[] = {
.uint32Param = OH_HUKS_KEY_PURPOSE_AGREE .uint32Param = OH_HUKS_KEY_PURPOSE_AGREE
}, { }, {
.tag = OH_HUKS_TAG_KEY_SIZE, .tag = OH_HUKS_TAG_KEY_SIZE,
.uint32Param = OH_HUKS_ECC_KEY_SIZE_224 .uint32Param = OH_HUKS_ECC_KEY_SIZE_256
}, { }, {
.tag = OH_HUKS_TAG_DIGEST, .tag = OH_HUKS_TAG_DIGEST,
.uint32Param = OH_HUKS_DIGEST_NONE .uint32Param = OH_HUKS_DIGEST_NONE
...@@ -93,7 +93,7 @@ static struct OH_Huks_Param g_agreeParams01Init001[] = { ...@@ -93,7 +93,7 @@ static struct OH_Huks_Param g_agreeParams01Init001[] = {
.uint32Param = OH_HUKS_KEY_PURPOSE_AGREE .uint32Param = OH_HUKS_KEY_PURPOSE_AGREE
}, { }, {
.tag = OH_HUKS_TAG_KEY_SIZE, .tag = OH_HUKS_TAG_KEY_SIZE,
.uint32Param = OH_HUKS_ECC_KEY_SIZE_224 .uint32Param = OH_HUKS_ECC_KEY_SIZE_256
} }
}; };
static struct OH_Huks_Param g_agreeParams01Finish001[] = { static struct OH_Huks_Param g_agreeParams01Finish001[] = {
...@@ -135,7 +135,7 @@ static struct OH_Huks_Param g_agreeParams02Init001[] = { ...@@ -135,7 +135,7 @@ static struct OH_Huks_Param g_agreeParams02Init001[] = {
.uint32Param = OH_HUKS_KEY_PURPOSE_AGREE .uint32Param = OH_HUKS_KEY_PURPOSE_AGREE
}, { }, {
.tag = OH_HUKS_TAG_KEY_SIZE, .tag = OH_HUKS_TAG_KEY_SIZE,
.uint32Param = OH_HUKS_ECC_KEY_SIZE_224 .uint32Param = OH_HUKS_ECC_KEY_SIZE_256
} }
}; };
static struct OH_Huks_Param g_agreeParams02Finish001[] = { static struct OH_Huks_Param g_agreeParams02Finish001[] = {
...@@ -199,8 +199,8 @@ HWTEST_F(HuksAgreeECDHTest, Security_HUKS_NAPI_Agree_ECDH_0100, TestSize.Level0) ...@@ -199,8 +199,8 @@ HWTEST_F(HuksAgreeECDHTest, Security_HUKS_NAPI_Agree_ECDH_0100, TestSize.Level0)
ret1 = OH_Huks_GenerateKeyItem(&g_keyAlias02001, genParamSet, nullptr); ret1 = OH_Huks_GenerateKeyItem(&g_keyAlias02001, genParamSet, nullptr);
EXPECT_EQ(ret1.errorCode, (int32_t)OH_HUKS_SUCCESS) << "GenerateKey02 failed."; EXPECT_EQ(ret1.errorCode, (int32_t)OH_HUKS_SUCCESS) << "GenerateKey02 failed.";
struct OH_Huks_Blob publicKey01 = { .size = OH_HUKS_ECC_KEY_SIZE_224, .data = nullptr }; struct OH_Huks_Blob publicKey01 = { .size = OH_HUKS_ECC_KEY_SIZE_256, .data = nullptr };
struct OH_Huks_Blob publicKey02 = { .size = OH_HUKS_ECC_KEY_SIZE_224, .data = nullptr }; struct OH_Huks_Blob publicKey02 = { .size = OH_HUKS_ECC_KEY_SIZE_256, .data = nullptr };
ret = MallocAndCheckBlobData(&publicKey01, publicKey01.size); ret = MallocAndCheckBlobData(&publicKey01, publicKey01.size);
EXPECT_EQ(ret.errorCode, (int32_t)OH_HUKS_SUCCESS) << "Malloc publicKey01 failed."; EXPECT_EQ(ret.errorCode, (int32_t)OH_HUKS_SUCCESS) << "Malloc publicKey01 failed.";
ret = MallocAndCheckBlobData(&publicKey02, publicKey02.size); ret = MallocAndCheckBlobData(&publicKey02, publicKey02.size);
......
...@@ -60,7 +60,7 @@ static struct OH_Huks_Param g_genParams001[] = { ...@@ -60,7 +60,7 @@ static struct OH_Huks_Param g_genParams001[] = {
.uint32Param = OH_HUKS_SM4_KEY_SIZE_128 .uint32Param = OH_HUKS_SM4_KEY_SIZE_128
}, { }, {
.tag = OH_HUKS_TAG_PADDING, .tag = OH_HUKS_TAG_PADDING,
.uint32Param = OH_HUKS_PADDING_PKCS7 .uint32Param = OH_HUKS_PADDING_NONE
}, { }, {
.tag = OH_HUKS_TAG_BLOCK_MODE, .tag = OH_HUKS_TAG_BLOCK_MODE,
.uint32Param = OH_HUKS_MODE_CBC .uint32Param = OH_HUKS_MODE_CBC
...@@ -81,7 +81,7 @@ static struct OH_Huks_Param g_encryptParams001[] = { ...@@ -81,7 +81,7 @@ static struct OH_Huks_Param g_encryptParams001[] = {
.uint32Param = OH_HUKS_SM4_KEY_SIZE_128 .uint32Param = OH_HUKS_SM4_KEY_SIZE_128
}, { }, {
.tag = OH_HUKS_TAG_PADDING, .tag = OH_HUKS_TAG_PADDING,
.uint32Param = OH_HUKS_PADDING_PKCS7 .uint32Param = OH_HUKS_PADDING_NONE
}, { }, {
.tag = OH_HUKS_TAG_BLOCK_MODE, .tag = OH_HUKS_TAG_BLOCK_MODE,
.uint32Param = OH_HUKS_MODE_CBC .uint32Param = OH_HUKS_MODE_CBC
...@@ -106,7 +106,7 @@ static struct OH_Huks_Param g_decryptParams001[] = { ...@@ -106,7 +106,7 @@ static struct OH_Huks_Param g_decryptParams001[] = {
.uint32Param = OH_HUKS_SM4_KEY_SIZE_128 .uint32Param = OH_HUKS_SM4_KEY_SIZE_128
}, { }, {
.tag = OH_HUKS_TAG_PADDING, .tag = OH_HUKS_TAG_PADDING,
.uint32Param = OH_HUKS_PADDING_PKCS7 .uint32Param = OH_HUKS_PADDING_NONE
}, { }, {
.tag = OH_HUKS_TAG_BLOCK_MODE, .tag = OH_HUKS_TAG_BLOCK_MODE,
.uint32Param = OH_HUKS_MODE_CBC .uint32Param = OH_HUKS_MODE_CBC
......
...@@ -59,7 +59,7 @@ static struct OH_Huks_Param g_genParams001[] = { ...@@ -59,7 +59,7 @@ static struct OH_Huks_Param g_genParams001[] = {
.uint32Param = OH_HUKS_DIGEST_SHA256 .uint32Param = OH_HUKS_DIGEST_SHA256
}, { }, {
.tag = OH_HUKS_TAG_KEY_SIZE, .tag = OH_HUKS_TAG_KEY_SIZE,
.uint32Param = OH_HUKS_AES_KEY_SIZE_128 .uint32Param = OH_HUKS_AES_KEY_SIZE_256
} }
}; };
static struct OH_Huks_Param g_hkdfParams001[] = { static struct OH_Huks_Param g_hkdfParams001[] = {
......
...@@ -49,6 +49,9 @@ void HuksDerivePBKDFTest::TearDown() ...@@ -49,6 +49,9 @@ void HuksDerivePBKDFTest::TearDown()
} }
uint8_t g_saltdata1[16] = {0}; uint8_t g_saltdata1[16] = {0};
uint8_t g_saltgen[16] = {
0x14, 0x10, 0x11, 0x3a, 0x27, 0x9e, 0xc8, 0x5f, 0xe0, 0xf3, 0x36, 0x17, 0x57, 0x42, 0x8e, 0xff
};
static struct OH_Huks_Param g_genParams001[] = { static struct OH_Huks_Param g_genParams001[] = {
{ {
...@@ -62,7 +65,16 @@ static struct OH_Huks_Param g_genParams001[] = { ...@@ -62,7 +65,16 @@ static struct OH_Huks_Param g_genParams001[] = {
.uint32Param = OH_HUKS_DIGEST_SHA256 .uint32Param = OH_HUKS_DIGEST_SHA256
}, { }, {
.tag = OH_HUKS_TAG_KEY_SIZE, .tag = OH_HUKS_TAG_KEY_SIZE,
.uint32Param = 256 .uint32Param = OH_HUKS_AES_KEY_SIZE_256
}, {
.tag = OH_HUKS_TAG_ITERATION,
.uint32Param = 1000
}, {
.tag = OH_HUKS_TAG_SALT,
.blob = {
sizeof(g_saltgen),
(uint8_t *)g_saltgen
}
} }
}; };
static struct OH_Huks_Param g_pbkdf2Params001[] = { static struct OH_Huks_Param g_pbkdf2Params001[] = {
......
...@@ -56,7 +56,7 @@ static struct OH_Huks_Param g_genParams001[] = { ...@@ -56,7 +56,7 @@ static struct OH_Huks_Param g_genParams001[] = {
.uint32Param = OH_HUKS_KEY_PURPOSE_MAC .uint32Param = OH_HUKS_KEY_PURPOSE_MAC
}, { }, {
.tag = OH_HUKS_TAG_DIGEST, .tag = OH_HUKS_TAG_DIGEST,
.uint32Param = OH_HUKS_DIGEST_SHA1 .uint32Param = OH_HUKS_DIGEST_SHA384
}, { }, {
.tag = OH_HUKS_TAG_KEY_SIZE, .tag = OH_HUKS_TAG_KEY_SIZE,
.uint32Param = Unittest::Hmac::COMMON_SIZE .uint32Param = Unittest::Hmac::COMMON_SIZE
...@@ -71,7 +71,7 @@ static struct OH_Huks_Param g_hmacParams001[] = { ...@@ -71,7 +71,7 @@ static struct OH_Huks_Param g_hmacParams001[] = {
.uint32Param = OH_HUKS_KEY_PURPOSE_MAC .uint32Param = OH_HUKS_KEY_PURPOSE_MAC
}, { }, {
.tag = OH_HUKS_TAG_DIGEST, .tag = OH_HUKS_TAG_DIGEST,
.uint32Param = OH_HUKS_DIGEST_SHA1 .uint32Param = OH_HUKS_DIGEST_SHA384
} }
}; };
...@@ -141,7 +141,7 @@ static OH_Huks_Result HksHmacTestCase(const struct OH_Huks_Blob *keyAlias, struc ...@@ -141,7 +141,7 @@ static OH_Huks_Result HksHmacTestCase(const struct OH_Huks_Blob *keyAlias, struc
/** /**
* @tc.name: HksHmacTest.Security_HUKS_NAPI_HMAC_hmac_0100 * @tc.name: HksHmacTest.Security_HUKS_NAPI_HMAC_hmac_0100
* @tc.desc: alg-HMAC pur-MAC dig-SHA1. * @tc.desc: alg-HMAC pur-MAC dig-SHA384.
* @tc.type: FUNC * @tc.type: FUNC
*/ */
HWTEST_F(HksHmacTest, Security_HUKS_NAPI_HMAC_hmac_0100, TestSize.Level0) HWTEST_F(HksHmacTest, Security_HUKS_NAPI_HMAC_hmac_0100, TestSize.Level0)
......
...@@ -26,7 +26,7 @@ let HuksOptions63kb = { ...@@ -26,7 +26,7 @@ let HuksOptions63kb = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeyAlgECC, HuksAgreeECDH.HuksKeyAlgECC,
HuksAgreeECDH.HuksKeyPurposeECDH, HuksAgreeECDH.HuksKeyPurposeECDH,
HuksAgreeECDH.HuksKeyECCSize224, HuksAgreeECDH.HuksKeyECCSize256,
HuksAgreeECDH.HuksKeyECCDIGEST, HuksAgreeECDH.HuksKeyECCDIGEST,
HuksAgreeECDH.HuksKeyECCPADDING, HuksAgreeECDH.HuksKeyECCPADDING,
HuksAgreeECDH.HuksKeyECCBLOCKMODE HuksAgreeECDH.HuksKeyECCBLOCKMODE
...@@ -37,8 +37,8 @@ let HuksOptions63kb = { ...@@ -37,8 +37,8 @@ let HuksOptions63kb = {
export default function SecurityHuksECDHBasicAbort63KBCallbackJsunit() { export default function SecurityHuksECDHBasicAbort63KBCallbackJsunit() {
describe('SecurityHuksECDHBasicAbort63KBCallbackJsunit', function () { describe('SecurityHuksECDHBasicAbort63KBCallbackJsunit', function () {
it('testAgreeEDCH002', 0, async function (done) { it('testAgreeEDCH002', 0, async function (done) {
const srcKeyAliesFirst = 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_01_001'; const srcKeyAliesFirst = 'testAgreeECDHSize256Abort63KBAgreeKeyAlias_01_001';
const srcKeyAliesSecond = 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_02_001'; const srcKeyAliesSecond = 'testAgreeECDHSize256Abort63KBAgreeKeyAlias_02_001';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeySTORAGE, HuksAgreeECDH.HuksKeySTORAGE,
......
...@@ -26,7 +26,7 @@ let HuksOptions65kb = { ...@@ -26,7 +26,7 @@ let HuksOptions65kb = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeyAlgECC, HuksAgreeECDH.HuksKeyAlgECC,
HuksAgreeECDH.HuksKeyPurposeECDH, HuksAgreeECDH.HuksKeyPurposeECDH,
HuksAgreeECDH.HuksKeyECCSize224, HuksAgreeECDH.HuksKeyECCSize256,
HuksAgreeECDH.HuksKeyECCDIGEST, HuksAgreeECDH.HuksKeyECCDIGEST,
HuksAgreeECDH.HuksKeyECCPADDING, HuksAgreeECDH.HuksKeyECCPADDING,
HuksAgreeECDH.HuksKeyECCBLOCKMODE HuksAgreeECDH.HuksKeyECCBLOCKMODE
...@@ -37,8 +37,8 @@ let HuksOptions65kb = { ...@@ -37,8 +37,8 @@ let HuksOptions65kb = {
export default function SecurityHuksECDHBasicAbort65KBCallbackJsunit() { export default function SecurityHuksECDHBasicAbort65KBCallbackJsunit() {
describe('SecurityHuksECDHBasicAbort65KBCallbackJsunit', function () { describe('SecurityHuksECDHBasicAbort65KBCallbackJsunit', function () {
it('testAgreeEDCH004', 0, async function (done) { it('testAgreeEDCH004', 0, async function (done) {
const srcKeyAliesFirst = 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_01_001'; const srcKeyAliesFirst = 'testAgreeECDHSize256Abort65KBAgreeKeyAlias_01_001';
const srcKeyAliesSecond = 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_02_001'; const srcKeyAliesSecond = 'testAgreeECDHSize256Abort65KBAgreeKeyAlias_02_001';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeySTORAGE, HuksAgreeECDH.HuksKeySTORAGE,
......
...@@ -26,7 +26,7 @@ let HuksOptions63kb = { ...@@ -26,7 +26,7 @@ let HuksOptions63kb = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeyAlgECC, HuksAgreeECDH.HuksKeyAlgECC,
HuksAgreeECDH.HuksKeyPurposeECDH, HuksAgreeECDH.HuksKeyPurposeECDH,
HuksAgreeECDH.HuksKeyECCSize224, HuksAgreeECDH.HuksKeyECCSize256,
HuksAgreeECDH.HuksKeyECCDIGEST, HuksAgreeECDH.HuksKeyECCDIGEST,
HuksAgreeECDH.HuksKeyECCPADDING, HuksAgreeECDH.HuksKeyECCPADDING,
HuksAgreeECDH.HuksKeyECCBLOCKMODE HuksAgreeECDH.HuksKeyECCBLOCKMODE
...@@ -37,8 +37,8 @@ let HuksOptions63kb = { ...@@ -37,8 +37,8 @@ let HuksOptions63kb = {
export default function SecurityHuksECDHBasicFinish63KBCallbackJsunit() { export default function SecurityHuksECDHBasicFinish63KBCallbackJsunit() {
describe('SecurityHuksECDHBasicFinish63KBCallbackJsunit', function () { describe('SecurityHuksECDHBasicFinish63KBCallbackJsunit', function () {
it('testAgreeEDCH001', 0, async function (done) { it('testAgreeEDCH001', 0, async function (done) {
const srcKeyAliesFirst = 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_01_001'; const srcKeyAliesFirst = 'testAgreeECDHSize256Finish63KBAgreeKeyAlias_01_001';
const srcKeyAliesSecond = 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_02_001'; const srcKeyAliesSecond = 'testAgreeECDHSize256Finish63KBAgreeKeyAlias_02_001';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeySTORAGE, HuksAgreeECDH.HuksKeySTORAGE,
......
...@@ -26,7 +26,7 @@ let HuksOptions65kb = { ...@@ -26,7 +26,7 @@ let HuksOptions65kb = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeyAlgECC, HuksAgreeECDH.HuksKeyAlgECC,
HuksAgreeECDH.HuksKeyPurposeECDH, HuksAgreeECDH.HuksKeyPurposeECDH,
HuksAgreeECDH.HuksKeyECCSize224, HuksAgreeECDH.HuksKeyECCSize256,
HuksAgreeECDH.HuksKeyECCDIGEST, HuksAgreeECDH.HuksKeyECCDIGEST,
HuksAgreeECDH.HuksKeyECCPADDING, HuksAgreeECDH.HuksKeyECCPADDING,
HuksAgreeECDH.HuksKeyECCBLOCKMODE HuksAgreeECDH.HuksKeyECCBLOCKMODE
...@@ -37,8 +37,8 @@ let HuksOptions65kb = { ...@@ -37,8 +37,8 @@ let HuksOptions65kb = {
export default function SecurityHuksECDHBasicFinish65KBCallbackJsunit() { export default function SecurityHuksECDHBasicFinish65KBCallbackJsunit() {
describe('SecurityHuksECDHBasicFinish65KBCallbackJsunit', function () { describe('SecurityHuksECDHBasicFinish65KBCallbackJsunit', function () {
it('testAgreeEDCH003', 0, async function (done) { it('testAgreeEDCH003', 0, async function (done) {
const srcKeyAliesFirst = 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_01_001'; const srcKeyAliesFirst = 'testAgreeECDHSize256Finish65KBAgreeKeyAlias_01_001';
const srcKeyAliesSecond = 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_02_001'; const srcKeyAliesSecond = 'testAgreeECDHSize256Finish65KBAgreeKeyAlias_02_001';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeySTORAGE, HuksAgreeECDH.HuksKeySTORAGE,
......
...@@ -31,7 +31,7 @@ describe('SecurityHuksAgreeECDHBasicAbort63KBPromiseJsunit', function () { ...@@ -31,7 +31,7 @@ describe('SecurityHuksAgreeECDHBasicAbort63KBPromiseJsunit', function () {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeyAlgECC, HuksAgreeECDH.HuksKeyAlgECC,
HuksAgreeECDH.HuksKeyPurposeECDH, HuksAgreeECDH.HuksKeyPurposeECDH,
HuksAgreeECDH.HuksKeyECCSize224, HuksAgreeECDH.HuksKeyECCSize256,
HuksAgreeECDH.HuksKeyECCDIGEST, HuksAgreeECDH.HuksKeyECCDIGEST,
HuksAgreeECDH.HuksKeyECCPADDING, HuksAgreeECDH.HuksKeyECCPADDING,
HuksAgreeECDH.HuksKeyECCBLOCKMODE HuksAgreeECDH.HuksKeyECCBLOCKMODE
...@@ -41,8 +41,8 @@ describe('SecurityHuksAgreeECDHBasicAbort63KBPromiseJsunit', function () { ...@@ -41,8 +41,8 @@ describe('SecurityHuksAgreeECDHBasicAbort63KBPromiseJsunit', function () {
console.info('test beforeEach called'); console.info('test beforeEach called');
}); });
it('testAgreeECDH102', 0, async function (done) { it('testAgreeECDH102', 0, async function (done) {
const srcKeyAliesFirst = 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_01_101'; const srcKeyAliesFirst = 'testAgreeECDHSize256Abort63KBAgreeKeyAlias_01_101';
const srcKeyAliesSecond = 'testAgreeECDHSize224Abort63KBAgreeKeyAlias_02_101'; const srcKeyAliesSecond = 'testAgreeECDHSize256Abort63KBAgreeKeyAlias_02_101';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeySTORAGE, HuksAgreeECDH.HuksKeySTORAGE,
......
...@@ -31,7 +31,7 @@ describe('SecurityHuksAgreeECDHBasicAbort65KBPromiseJsunit', function () { ...@@ -31,7 +31,7 @@ describe('SecurityHuksAgreeECDHBasicAbort65KBPromiseJsunit', function () {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeyAlgECC, HuksAgreeECDH.HuksKeyAlgECC,
HuksAgreeECDH.HuksKeyPurposeECDH, HuksAgreeECDH.HuksKeyPurposeECDH,
HuksAgreeECDH.HuksKeyECCSize224, HuksAgreeECDH.HuksKeyECCSize256,
HuksAgreeECDH.HuksKeyECCDIGEST, HuksAgreeECDH.HuksKeyECCDIGEST,
HuksAgreeECDH.HuksKeyECCPADDING, HuksAgreeECDH.HuksKeyECCPADDING,
HuksAgreeECDH.HuksKeyECCBLOCKMODE HuksAgreeECDH.HuksKeyECCBLOCKMODE
...@@ -42,8 +42,8 @@ describe('SecurityHuksAgreeECDHBasicAbort65KBPromiseJsunit', function () { ...@@ -42,8 +42,8 @@ describe('SecurityHuksAgreeECDHBasicAbort65KBPromiseJsunit', function () {
}); });
it('testAgreeECDH104', 0, async function (done) { it('testAgreeECDH104', 0, async function (done) {
const srcKeyAliesFirst = 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_01_101'; const srcKeyAliesFirst = 'testAgreeECDHSize256Abort65KBAgreeKeyAlias_01_101';
const srcKeyAliesSecond = 'testAgreeECDHSize224Abort65KBAgreeKeyAlias_02_101'; const srcKeyAliesSecond = 'testAgreeECDHSize256Abort65KBAgreeKeyAlias_02_101';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeySTORAGE, HuksAgreeECDH.HuksKeySTORAGE,
......
...@@ -22,58 +22,47 @@ import { HksTag } from '../../../../../../utils/param/publicParam'; ...@@ -22,58 +22,47 @@ import { HksTag } from '../../../../../../utils/param/publicParam';
let srcData63 = Data.Date63KB; let srcData63 = Data.Date63KB;
let srcData63Kb = stringToUint8Array(srcData63); let srcData63Kb = stringToUint8Array(srcData63);
let HuksOptions63kb = {};
let HuksOptions63kb = {
properties: new Array(
HuksAgreeECDH.HuksKeyAlgECC,
HuksAgreeECDH.HuksKeyPurposeECDH,
HuksAgreeECDH.HuksKeyECCSize224,
HuksAgreeECDH.HuksKeyECCDIGEST,
HuksAgreeECDH.HuksKeyECCPADDING,
HuksAgreeECDH.HuksKeyECCBLOCKMODE
),
inData: srcData63Kb,
};
export default function SecurityHuksAgreeECDHBasicFinish63KBPromiseJsunit() { export default function SecurityHuksAgreeECDHBasicFinish63KBPromiseJsunit() {
describe('SecurityHuksAgreeECDHBasicFinish63KBPromiseJsunit', function () { describe('SecurityHuksAgreeECDHBasicFinish63KBPromiseJsunit', function () {
beforeEach(function () { beforeEach(function () {
HuksOptions63kb = { HuksOptions63kb = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeyAlgECC, HuksAgreeECDH.HuksKeyAlgECC,
HuksAgreeECDH.HuksKeyPurposeECDH, HuksAgreeECDH.HuksKeyPurposeECDH,
HuksAgreeECDH.HuksKeyECCSize224, HuksAgreeECDH.HuksKeyECCSize256,
HuksAgreeECDH.HuksKeyECCDIGEST, HuksAgreeECDH.HuksKeyECCDIGEST,
HuksAgreeECDH.HuksKeyECCPADDING, HuksAgreeECDH.HuksKeyECCPADDING,
HuksAgreeECDH.HuksKeyECCBLOCKMODE HuksAgreeECDH.HuksKeyECCBLOCKMODE
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
console.info('test beforeEach called'); console.info('test beforeEach called');
}); });
it('testAgreeECDH101', 0, async function (done) { it('testAgreeECDH101', 0, async function (done) {
const srcKeyAliesFirst = 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_01_101'; const srcKeyAliesFirst = 'testAgreeECDHSize256Finish63KBAgreeKeyAlias_01_101';
const srcKeyAliesSecond = 'testAgreeECDHSize224Finish63KBAgreeKeyAlias_02_101'; const srcKeyAliesSecond = 'testAgreeECDHSize256Finish63KBAgreeKeyAlias_02_101';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeySTORAGE, HuksAgreeECDH.HuksKeySTORAGE,
HuksAgreeECDH.HuksKeyISKEYALIAS, HuksAgreeECDH.HuksKeyISKEYALIAS,
HuksAgreeECDH.HuksKeyALGORITHMAES, HuksAgreeECDH.HuksKeyALGORITHMAES,
HuksAgreeECDH.HuksKeySIZE256, HuksAgreeECDH.HuksKeySIZE256,
HuksAgreeECDH.HuksKeyPurposeENCRYPTDECRYPT, HuksAgreeECDH.HuksKeyPurposeENCRYPTDECRYPT,
HuksAgreeECDH.HuksKeyDIGESTNONE, HuksAgreeECDH.HuksKeyDIGESTNONE,
{ {
tag: HksTag.HKS_TAG_KEY_ALIAS, tag: HksTag.HKS_TAG_KEY_ALIAS,
value: stringToUint8Array(srcKeyAliesFirst), value: stringToUint8Array(srcKeyAliesFirst),
}, },
HuksAgreeECDH.HuksKeyPADDINGNONE, HuksAgreeECDH.HuksKeyPADDINGNONE,
HuksAgreeECDH.HuksKeyBLOCKMODEECB HuksAgreeECDH.HuksKeyBLOCKMODEECB
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish'); await publicAgreeFunc(srcKeyAliesFirst, srcKeyAliesSecond, HuksOptions63kb, huksOptionsFinish, 'finish');
done(); done();
});
}); });
});
} }
...@@ -31,7 +31,7 @@ describe('SecurityHuksAgreeECDHBasicFinish65KBPromiseJsunit', function () { ...@@ -31,7 +31,7 @@ describe('SecurityHuksAgreeECDHBasicFinish65KBPromiseJsunit', function () {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeyAlgECC, HuksAgreeECDH.HuksKeyAlgECC,
HuksAgreeECDH.HuksKeyPurposeECDH, HuksAgreeECDH.HuksKeyPurposeECDH,
HuksAgreeECDH.HuksKeyECCSize224, HuksAgreeECDH.HuksKeyECCSize256,
HuksAgreeECDH.HuksKeyECCDIGEST, HuksAgreeECDH.HuksKeyECCDIGEST,
HuksAgreeECDH.HuksKeyECCPADDING, HuksAgreeECDH.HuksKeyECCPADDING,
HuksAgreeECDH.HuksKeyECCBLOCKMODE HuksAgreeECDH.HuksKeyECCBLOCKMODE
...@@ -42,8 +42,8 @@ describe('SecurityHuksAgreeECDHBasicFinish65KBPromiseJsunit', function () { ...@@ -42,8 +42,8 @@ describe('SecurityHuksAgreeECDHBasicFinish65KBPromiseJsunit', function () {
}); });
it('testAgreeECDH103', 0, async function (done) { it('testAgreeECDH103', 0, async function (done) {
const srcKeyAliesFirst = 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_01_101'; const srcKeyAliesFirst = 'testAgreeECDHSize256Finish65KBAgreeKeyAlias_01_101';
const srcKeyAliesSecond = 'testAgreeECDHSize224Finish65KBAgreeKeyAlias_02_101'; const srcKeyAliesSecond = 'testAgreeECDHSize256Finish65KBAgreeKeyAlias_02_101';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeySTORAGE, HuksAgreeECDH.HuksKeySTORAGE,
......
...@@ -17,7 +17,15 @@ import { describe, it, expect } from '@ohos/hypium'; ...@@ -17,7 +17,15 @@ import { describe, it, expect } from '@ohos/hypium';
import huks from '@ohos.security.huks'; import huks from '@ohos.security.huks';
import { HuksCipherRSA } from '../../../../../../utils/param/cipher/publicCipherParam'; import { HuksCipherRSA } from '../../../../../../utils/param/cipher/publicCipherParam';
import { stringToUint8Array, uint8ArrayToString } from '../../../../../../utils/param/publicFunc'; import { stringToUint8Array, uint8ArrayToString } from '../../../../../../utils/param/publicFunc';
let gInData64 = 'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'; let gInData64 =
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt';
let gInData64Array = stringToUint8Array(gInData64); let gInData64Array = stringToUint8Array(gInData64);
let encryptedData; let encryptedData;
...@@ -27,7 +35,11 @@ let updateResult = new Array(); ...@@ -27,7 +35,11 @@ let updateResult = new Array();
let exportKey; let exportKey;
let genHuksOptions = { let genHuksOptions = {
properties: new Array(HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyPurpose, HuksCipherRSA.HuksKeyRSASize512), properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurpose,
HuksCipherRSA.HuksKeyRSASize4096
),
inData: new Uint8Array(new Array()), inData: new Uint8Array(new Array()),
}; };
...@@ -319,105 +331,105 @@ async function publicCipherFunc( ...@@ -319,105 +331,105 @@ async function publicCipherFunc(
} }
export default function SecurityHuksRSABasicCallbackJsunit() { export default function SecurityHuksRSABasicCallbackJsunit() {
describe('SecurityHuksRSABasicCallbackJsunit', function () { describe('SecurityHuksRSABasicCallbackJsunit', function () {
it('testCipherRSA001', 0, async function (done) { it('testCipherRSA001', 0, async function (done) {
const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias001'; const srcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256KeyAlias001';
const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias001'; const newSrcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256NewKeyAlias001';
genHuksOptions.properties.splice(3, 1, HuksCipherRSA.HuksKeyRSABLOCKMODEECB); genHuksOptions.properties.splice(3, 1, HuksCipherRSA.HuksKeyRSABLOCKMODEECB);
genHuksOptions.properties.splice(4, 1, HuksCipherRSA.HuksKeyRSAPADDINGNONE); genHuksOptions.properties.splice(4, 1, HuksCipherRSA.HuksKeyRSAPADDINGNONE);
genHuksOptions.properties.splice(5, 1, HuksCipherRSA.HuksKeyRSADIGESTSHA256); genHuksOptions.properties.splice(5, 1, HuksCipherRSA.HuksKeyRSADIGESTSHA256);
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeENCRYPT, HuksCipherRSA.HuksKeyPurposeENCRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
), ),
inData: gInData64Array, inData: gInData64Array,
}; };
await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', true); await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', true);
HuksOptions = { HuksOptions = {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeDECRYPT, HuksCipherRSA.HuksKeyPurposeDECRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
), ),
inData: new Uint8Array(updateResult), inData: new Uint8Array(updateResult),
}; };
await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', false); await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', false);
done(); done();
}); });
it('testCipherRSA002', 0, async function (done) { it('testCipherRSA002', 0, async function (done) {
const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias002'; const srcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256KeyAlias002';
const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias002'; const newSrcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256NewKeyAlias002';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeENCRYPT, HuksCipherRSA.HuksKeyPurposeENCRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
), ),
inData: gInData64Array, inData: gInData64Array,
}; };
await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'abort', true); await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'abort', true);
done(); done();
}); });
it('testCipherRSA003', 0, async function (done) { it('testCipherRSA003', 0, async function (done) {
const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias003'; const srcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256KeyAlias003';
const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias003'; const newSrcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256NewKeyAlias003';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeENCRYPT, HuksCipherRSA.HuksKeyPurposeENCRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
), ),
inData: gInData64Array, inData: gInData64Array,
}; };
await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', true); await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', true);
HuksOptions = { HuksOptions = {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeDECRYPT, HuksCipherRSA.HuksKeyPurposeDECRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
), ),
inData: new Uint8Array(updateResult), inData: new Uint8Array(updateResult),
}; };
await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', false); await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'finish', false);
done(); done();
}); });
it('testCipherRSA004', 0, async function (done) { it('testCipherRSA004', 0, async function (done) {
const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias004'; const srcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256KeyAlias004';
const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias004'; const newSrcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256NewKeyAlias004';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeENCRYPT, HuksCipherRSA.HuksKeyPurposeENCRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
), ),
inData: gInData64Array, inData: gInData64Array,
}; };
await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'abort', true); await publicCipherFunc(srcKeyAlies, newSrcKeyAlies, genHuksOptions, HuksOptions, 'abort', true);
done(); done();
});
}); });
});
} }
...@@ -17,7 +17,15 @@ import { describe, it, expect } from '@ohos/hypium'; ...@@ -17,7 +17,15 @@ import { describe, it, expect } from '@ohos/hypium';
import huks from '@ohos.security.huks'; import huks from '@ohos.security.huks';
import { HuksCipherRSA } from '../../../../../../utils/param/cipher/publicCipherParam'; import { HuksCipherRSA } from '../../../../../../utils/param/cipher/publicCipherParam';
import { stringToUint8Array, uint8ArrayToString } from '../../../../../../utils/param/publicFunc'; import { stringToUint8Array, uint8ArrayToString } from '../../../../../../utils/param/publicFunc';
let gInData64 = 'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'; let gInData64 =
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt' +
'RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt';
let defaultData = '0'; let defaultData = '0';
...@@ -30,7 +38,7 @@ let updateResult = new Array(); ...@@ -30,7 +38,7 @@ let updateResult = new Array();
let exportKey; let exportKey;
let genHuksOptions = { let genHuksOptions = {
properties: new Array(HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyPurpose, HuksCipherRSA.HuksKeyRSASize512), properties: new Array(HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyPurpose, HuksCipherRSA.HuksKeyRSASize4096),
inData: new Uint8Array(defaultData), inData: new Uint8Array(defaultData),
}; };
...@@ -224,8 +232,8 @@ async function publicCipherFunc( ...@@ -224,8 +232,8 @@ async function publicCipherFunc(
export default function SecurityHuksCipherRSABasicPromiseJsunit() { export default function SecurityHuksCipherRSABasicPromiseJsunit() {
describe('SecurityHuksCipherRSABasicPromiseJsunit', function () { describe('SecurityHuksCipherRSABasicPromiseJsunit', function () {
it('testCipherRSA101', 0, async function (done) { it('testCipherRSA101', 0, async function (done) {
const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias101'; const srcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256KeyAlias101';
const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias101'; const newSrcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256NewKeyAlias101';
genHuksOptions.properties.splice(3, 1, HuksCipherRSA.HuksKeyRSABLOCKMODEECB); genHuksOptions.properties.splice(3, 1, HuksCipherRSA.HuksKeyRSABLOCKMODEECB);
genHuksOptions.properties.splice(4, 1, HuksCipherRSA.HuksKeyRSAPADDINGNONE); genHuksOptions.properties.splice(4, 1, HuksCipherRSA.HuksKeyRSAPADDINGNONE);
genHuksOptions.properties.splice(5, 1, HuksCipherRSA.HuksKeyRSADIGESTSHA256); genHuksOptions.properties.splice(5, 1, HuksCipherRSA.HuksKeyRSADIGESTSHA256);
...@@ -234,7 +242,7 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () { ...@@ -234,7 +242,7 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeENCRYPT, HuksCipherRSA.HuksKeyPurposeENCRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
...@@ -246,7 +254,7 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () { ...@@ -246,7 +254,7 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeDECRYPT, HuksCipherRSA.HuksKeyPurposeDECRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
...@@ -258,13 +266,13 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () { ...@@ -258,13 +266,13 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () {
}); });
it('testCipherRSA102', 0, async function (done) { it('testCipherRSA102', 0, async function (done) {
const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias102'; const srcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256KeyAlias102';
const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias101'; const newSrcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256NewKeyAlias101';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeENCRYPT, HuksCipherRSA.HuksKeyPurposeENCRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
...@@ -276,13 +284,13 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () { ...@@ -276,13 +284,13 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () {
}); });
it('testCipherRSA103', 0, async function (done) { it('testCipherRSA103', 0, async function (done) {
const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias103'; const srcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256KeyAlias103';
const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias103'; const newSrcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256NewKeyAlias103';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeENCRYPT, HuksCipherRSA.HuksKeyPurposeENCRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
...@@ -294,7 +302,7 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () { ...@@ -294,7 +302,7 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeDECRYPT, HuksCipherRSA.HuksKeyPurposeDECRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
...@@ -306,13 +314,13 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () { ...@@ -306,13 +314,13 @@ describe('SecurityHuksCipherRSABasicPromiseJsunit', function () {
}); });
it('testCipherRSA104', 0, async function (done) { it('testCipherRSA104', 0, async function (done) {
const srcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256KeyAlias104'; const srcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256KeyAlias104';
const newSrcKeyAlies = 'testCipherRSASize512PADDINGNONESHA256NewKeyAlias104'; const newSrcKeyAlies = 'testCipherRSASize4096PADDINGNONESHA256NewKeyAlias104';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksCipherRSA.HuksKeyAlgRSA, HuksCipherRSA.HuksKeyAlgRSA,
HuksCipherRSA.HuksKeyPurposeENCRYPT, HuksCipherRSA.HuksKeyPurposeENCRYPT,
HuksCipherRSA.HuksKeyRSASize512, HuksCipherRSA.HuksKeyRSASize4096,
HuksCipherRSA.HuksKeyRSAPADDINGNONE, HuksCipherRSA.HuksKeyRSAPADDINGNONE,
HuksCipherRSA.HuksKeyRSABLOCKMODEECB, HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
HuksCipherRSA.HuksKeyRSADIGESTSHA256 HuksCipherRSA.HuksKeyRSADIGESTSHA256
......
...@@ -27,7 +27,7 @@ let HuksOptions63kb = { ...@@ -27,7 +27,7 @@ let HuksOptions63kb = {
HuksDeriveHKDF.HuksKeyAlgAES, HuksDeriveHKDF.HuksKeyAlgAES,
HuksDeriveHKDF.HuksKeyPurposeHKDF, HuksDeriveHKDF.HuksKeyPurposeHKDF,
HuksDeriveHKDF.HuksTagHKDFDigestSHA256, HuksDeriveHKDF.HuksTagHKDFDigestSHA256,
HuksDeriveHKDF.HuksKeyHKDFSize128 HuksDeriveHKDF.HuksKeyHKDFSize256
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -35,7 +35,7 @@ let HuksOptions63kb = { ...@@ -35,7 +35,7 @@ let HuksOptions63kb = {
export default function SecurityHuksHKDFBasicAbort63KBCallbackJsunit() { export default function SecurityHuksHKDFBasicAbort63KBCallbackJsunit() {
describe('SecurityHuksHKDFBasicAbort63KBCallbackJsunit', function () { describe('SecurityHuksHKDFBasicAbort63KBCallbackJsunit', function () {
it('testDeriveHKDF002', 0, async function (done) { it('testDeriveHKDF002', 0, async function (done) {
const srcKeyAliesFirst = 'testDeriveHKDFSize128SHA256Abort63KBDeriveKeyAlias_01_001'; const srcKeyAliesFirst = 'testDeriveHKDFSize256SHA256Abort63KBDeriveKeyAlias_01_001';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksDeriveHKDF.HuksKeySTORAGE, HuksDeriveHKDF.HuksKeySTORAGE,
...@@ -49,7 +49,7 @@ describe('SecurityHuksHKDFBasicAbort63KBCallbackJsunit', function () { ...@@ -49,7 +49,7 @@ describe('SecurityHuksHKDFBasicAbort63KBCallbackJsunit', function () {
value: stringToUint8Array(srcKeyAliesFirst), value: stringToUint8Array(srcKeyAliesFirst),
}, },
HuksDeriveHKDF.HuksKeyPADDINGNONE, HuksDeriveHKDF.HuksKeyPADDINGNONE,
HuksDeriveHKDF.HuksKeyBLOCKMODEECB HuksDeriveHKDF.HuksKeyBLOCKMODEGCM
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
......
...@@ -27,7 +27,7 @@ let HuksOptions63kb = { ...@@ -27,7 +27,7 @@ let HuksOptions63kb = {
HuksDeriveHKDF.HuksKeyAlgAES, HuksDeriveHKDF.HuksKeyAlgAES,
HuksDeriveHKDF.HuksKeyPurposeHKDF, HuksDeriveHKDF.HuksKeyPurposeHKDF,
HuksDeriveHKDF.HuksTagHKDFDigestSHA256, HuksDeriveHKDF.HuksTagHKDFDigestSHA256,
HuksDeriveHKDF.HuksKeyHKDFSize128 HuksDeriveHKDF.HuksKeyHKDFSize256
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -35,7 +35,7 @@ let HuksOptions63kb = { ...@@ -35,7 +35,7 @@ let HuksOptions63kb = {
export default function SecurityHuksHKDFBasicFinish63KBCallbackJsunit() { export default function SecurityHuksHKDFBasicFinish63KBCallbackJsunit() {
describe('SecurityHuksHKDFBasicFinish63KBCallbackJsunit', function () { describe('SecurityHuksHKDFBasicFinish63KBCallbackJsunit', function () {
it('testDeriveHKDF001', 0, async function (done) { it('testDeriveHKDF001', 0, async function (done) {
const srcKeyAliesFirst = 'testDeriveHKDFSize128SHA256Finish63KBDeriveKeyAlias_01_001'; const srcKeyAliesFirst = 'testDeriveHKDFSize256SHA256Finish63KBDeriveKeyAlias_01_001';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksDeriveHKDF.HuksKeySTORAGE, HuksDeriveHKDF.HuksKeySTORAGE,
...@@ -49,7 +49,7 @@ describe('SecurityHuksHKDFBasicFinish63KBCallbackJsunit', function () { ...@@ -49,7 +49,7 @@ describe('SecurityHuksHKDFBasicFinish63KBCallbackJsunit', function () {
value: stringToUint8Array(srcKeyAliesFirst), value: stringToUint8Array(srcKeyAliesFirst),
}, },
HuksDeriveHKDF.HuksKeyPADDINGNONE, HuksDeriveHKDF.HuksKeyPADDINGNONE,
HuksDeriveHKDF.HuksKeyBLOCKMODEECB HuksDeriveHKDF.HuksKeyBLOCKMODEGCM
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
......
...@@ -27,7 +27,9 @@ let HuksOptions63kb = { ...@@ -27,7 +27,9 @@ let HuksOptions63kb = {
HuksDerivePBKDF2.HuksKeyAlgAES, HuksDerivePBKDF2.HuksKeyAlgAES,
HuksDerivePBKDF2.HuksKeyPurposePBKDF2, HuksDerivePBKDF2.HuksKeyPurposePBKDF2,
HuksDerivePBKDF2.HuksTagPBKDF2DigestSHA256, HuksDerivePBKDF2.HuksTagPBKDF2DigestSHA256,
HuksDerivePBKDF2.HuksKeyPBKDF2Size128 HuksDerivePBKDF2.HuksKeyPBKDF2Size256,
HuksDerivePBKDF2.HuksKeyPBKDF2Iteration,
HuksDerivePBKDF2.HuksKeyPBKDF2Salt
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -35,7 +37,7 @@ let HuksOptions63kb = { ...@@ -35,7 +37,7 @@ let HuksOptions63kb = {
export default function SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit() { export default function SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit() {
describe('SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit', function () { describe('SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit', function () {
it('testDerivePBKDF2002', 0, async function (done) { it('testDerivePBKDF2002', 0, async function (done) {
const srcKeyAliesFirst = 'testDerivePBKDF2Size128SHA256Abort63KBDeriveKeyAlias_01_001'; const srcKeyAliesFirst = 'testDerivePBKDF2Size256SHA256Abort63KBDeriveKeyAlias_01_001';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksDerivePBKDF2.HuksKeySTORAGE, HuksDerivePBKDF2.HuksKeySTORAGE,
...@@ -49,7 +51,7 @@ describe('SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit', function () { ...@@ -49,7 +51,7 @@ describe('SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit', function () {
value: stringToUint8Array(srcKeyAliesFirst), value: stringToUint8Array(srcKeyAliesFirst),
}, },
HuksDerivePBKDF2.HuksKeyPADDINGNONE, HuksDerivePBKDF2.HuksKeyPADDINGNONE,
HuksDerivePBKDF2.HuksKeyBLOCKMODEECB HuksDerivePBKDF2.HuksKeyBLOCKMODEGCM
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
......
...@@ -27,35 +27,37 @@ let HuksOptions63kb = { ...@@ -27,35 +27,37 @@ let HuksOptions63kb = {
HuksDerivePBKDF2.HuksKeyAlgAES, HuksDerivePBKDF2.HuksKeyAlgAES,
HuksDerivePBKDF2.HuksKeyPurposePBKDF2, HuksDerivePBKDF2.HuksKeyPurposePBKDF2,
HuksDerivePBKDF2.HuksTagPBKDF2DigestSHA256, HuksDerivePBKDF2.HuksTagPBKDF2DigestSHA256,
HuksDerivePBKDF2.HuksKeyPBKDF2Size128 HuksDerivePBKDF2.HuksKeyPBKDF2Size256,
HuksDerivePBKDF2.HuksKeyPBKDF2Iteration,
HuksDerivePBKDF2.HuksKeyPBKDF2Salt
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
export default function SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit() { export default function SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit() {
describe('SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit', function () { describe('SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit', function () {
it('testDerivePBKDF2001', 0, async function (done) { it('testDerivePBKDF2001', 0, async function (done) {
const srcKeyAliesFirst = 'testDerivePBKDF2Size128SHA256Finish63KBDeriveKeyAlias_01_001'; const srcKeyAliesFirst = 'testDerivePBKDF2Size256SHA256Finish63KBDeriveKeyAlias_01_001';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksDerivePBKDF2.HuksKeySTORAGE, HuksDerivePBKDF2.HuksKeySTORAGE,
HuksDerivePBKDF2.HuksKeyISKEYALIAS, HuksDerivePBKDF2.HuksKeyISKEYALIAS,
HuksDerivePBKDF2.HuksKeyALGORITHMAES, HuksDerivePBKDF2.HuksKeyALGORITHMAES,
HuksDerivePBKDF2.HuksKeySIZE256, HuksDerivePBKDF2.HuksKeySIZE256,
HuksDerivePBKDF2.HuksKeyPurposeENCRYPTDECRYPT, HuksDerivePBKDF2.HuksKeyPurposeENCRYPTDECRYPT,
HuksDerivePBKDF2.HuksKeyDIGESTNONE, HuksDerivePBKDF2.HuksKeyDIGESTNONE,
{ {
tag: HksTag.HKS_TAG_KEY_ALIAS, tag: HksTag.HKS_TAG_KEY_ALIAS,
value: stringToUint8Array(srcKeyAliesFirst), value: stringToUint8Array(srcKeyAliesFirst),
}, },
HuksDerivePBKDF2.HuksKeyPADDINGNONE, HuksDerivePBKDF2.HuksKeyPADDINGNONE,
HuksDerivePBKDF2.HuksKeyBLOCKMODEECB HuksDerivePBKDF2.HuksKeyBLOCKMODEGCM
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
let deriveArray = new Array(HuksDerivePBKDF2.HuksKeyAlgPBKDF2,HuksDerivePBKDF2.HuksKeyDERIVEKEYSIZE); let deriveArray = new Array(HuksDerivePBKDF2.HuksKeyAlgPBKDF2, HuksDerivePBKDF2.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'finish'); await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'finish');
done(); done();
});
}); });
});
} }
...@@ -28,7 +28,7 @@ let HuksOptions63kb = { ...@@ -28,7 +28,7 @@ let HuksOptions63kb = {
HuksDeriveHKDF.HuksKeyAlgAES, HuksDeriveHKDF.HuksKeyAlgAES,
HuksDeriveHKDF.HuksKeyPurposeHKDF, HuksDeriveHKDF.HuksKeyPurposeHKDF,
HuksDeriveHKDF.HuksTagHKDFDigestSHA256, HuksDeriveHKDF.HuksTagHKDFDigestSHA256,
HuksDeriveHKDF.HuksKeyHKDFSize128 HuksDeriveHKDF.HuksKeyHKDFSize256
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -36,7 +36,7 @@ let HuksOptions63kb = { ...@@ -36,7 +36,7 @@ let HuksOptions63kb = {
export default function SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit() { export default function SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit() {
describe('SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit', function () { describe('SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit', function () {
it('testDeriveHKDF102', 0, async function (done) { it('testDeriveHKDF102', 0, async function (done) {
const srcKeyAliesFirst = 'testDeriveHKDFSize128SHA256Abort63KBDeriveKeyAlias_01_101'; const srcKeyAliesFirst = 'testDeriveHKDFSize256SHA256Abort63KBDeriveKeyAlias_01_101';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksDeriveHKDF.HuksKeySTORAGE, HuksDeriveHKDF.HuksKeySTORAGE,
...@@ -50,7 +50,7 @@ describe('SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit', function () { ...@@ -50,7 +50,7 @@ describe('SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit', function () {
value: stringToUint8Array(srcKeyAliesFirst), value: stringToUint8Array(srcKeyAliesFirst),
}, },
HuksDeriveHKDF.HuksKeyPADDINGNONE, HuksDeriveHKDF.HuksKeyPADDINGNONE,
HuksDeriveHKDF.HuksKeyBLOCKMODEECB HuksDeriveHKDF.HuksKeyBLOCKMODEGCM
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
......
...@@ -27,7 +27,7 @@ let HuksOptions63kb = { ...@@ -27,7 +27,7 @@ let HuksOptions63kb = {
HuksDeriveHKDF.HuksKeyAlgAES, HuksDeriveHKDF.HuksKeyAlgAES,
HuksDeriveHKDF.HuksKeyPurposeHKDF, HuksDeriveHKDF.HuksKeyPurposeHKDF,
HuksDeriveHKDF.HuksTagHKDFDigestSHA256, HuksDeriveHKDF.HuksTagHKDFDigestSHA256,
HuksDeriveHKDF.HuksKeyHKDFSize128 HuksDeriveHKDF.HuksKeyHKDFSize256
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -35,7 +35,7 @@ let HuksOptions63kb = { ...@@ -35,7 +35,7 @@ let HuksOptions63kb = {
export default function SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit() { export default function SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit() {
describe('SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit', function () { describe('SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit', function () {
it('testDeriveHKDF101', 0, async function (done) { it('testDeriveHKDF101', 0, async function (done) {
const srcKeyAliesFirst = 'testDeriveHKDFSize128SHA256Finish63KBDeriveKeyAlias_01_101'; const srcKeyAliesFirst = 'testDeriveHKDFSize256SHA256Finish63KBDeriveKeyAlias_01_101';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksDeriveHKDF.HuksKeySTORAGE, HuksDeriveHKDF.HuksKeySTORAGE,
...@@ -49,7 +49,7 @@ describe('SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit', function () { ...@@ -49,7 +49,7 @@ describe('SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit', function () {
value: stringToUint8Array(srcKeyAliesFirst), value: stringToUint8Array(srcKeyAliesFirst),
}, },
HuksDeriveHKDF.HuksKeyPADDINGNONE, HuksDeriveHKDF.HuksKeyPADDINGNONE,
HuksDeriveHKDF.HuksKeyBLOCKMODEECB HuksDeriveHKDF.HuksKeyBLOCKMODEGCM
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
......
...@@ -28,14 +28,16 @@ let HuksOptions63kb = { ...@@ -28,14 +28,16 @@ let HuksOptions63kb = {
HuksDerivePBKDF2.HuksKeyAlgAES, HuksDerivePBKDF2.HuksKeyAlgAES,
HuksDerivePBKDF2.HuksKeyPurposePBKDF2, HuksDerivePBKDF2.HuksKeyPurposePBKDF2,
HuksDerivePBKDF2.HuksTagPBKDF2DigestSHA256, HuksDerivePBKDF2.HuksTagPBKDF2DigestSHA256,
HuksDerivePBKDF2.HuksKeyPBKDF2Size128 HuksDerivePBKDF2.HuksKeyPBKDF2Size256,
HuksDerivePBKDF2.HuksKeyPBKDF2Iteration,
HuksDerivePBKDF2.HuksKeyPBKDF2Salt
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
export default function SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit() { export default function SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit() {
describe('SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit', function () { describe('SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit', function () {
it('testDerivePBKDF2102', 0, async function (done) { it('testDerivePBKDF2102', 0, async function (done) {
const srcKeyAliesFirst = 'testDerivePBKDF2Size128SHA256Abort63KBDeriveKeyAlias_01_101'; const srcKeyAliesFirst = 'testDerivePBKDF2Size256SHA256Abort63KBDeriveKeyAlias_01_101';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksDerivePBKDF2.HuksKeySTORAGE, HuksDerivePBKDF2.HuksKeySTORAGE,
...@@ -49,7 +51,7 @@ describe('SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit', function () { ...@@ -49,7 +51,7 @@ describe('SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit', function () {
value: stringToUint8Array(srcKeyAliesFirst), value: stringToUint8Array(srcKeyAliesFirst),
}, },
HuksDerivePBKDF2.HuksKeyPADDINGNONE, HuksDerivePBKDF2.HuksKeyPADDINGNONE,
HuksDerivePBKDF2.HuksKeyBLOCKMODEECB HuksDerivePBKDF2.HuksKeyBLOCKMODEGCM
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
......
...@@ -28,7 +28,9 @@ let HuksOptions63kb = { ...@@ -28,7 +28,9 @@ let HuksOptions63kb = {
HuksDerivePBKDF2.HuksKeyAlgAES, HuksDerivePBKDF2.HuksKeyAlgAES,
HuksDerivePBKDF2.HuksKeyPurposePBKDF2, HuksDerivePBKDF2.HuksKeyPurposePBKDF2,
HuksDerivePBKDF2.HuksTagPBKDF2DigestSHA256, HuksDerivePBKDF2.HuksTagPBKDF2DigestSHA256,
HuksDerivePBKDF2.HuksKeyPBKDF2Size128 HuksDerivePBKDF2.HuksKeyPBKDF2Size256,
HuksDerivePBKDF2.HuksKeyPBKDF2Iteration,
HuksDerivePBKDF2.HuksKeyPBKDF2Salt
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -36,7 +38,7 @@ let HuksOptions63kb = { ...@@ -36,7 +38,7 @@ let HuksOptions63kb = {
export default function SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit() { export default function SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit() {
describe('SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit', function () { describe('SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit', function () {
it('testDerivePBKDF2101', 0, async function (done) { it('testDerivePBKDF2101', 0, async function (done) {
const srcKeyAliesFirst = 'testDerivePBKDF2Size128SHA256Finish63KBDeriveKeyAlias_01_101'; const srcKeyAliesFirst = 'testDerivePBKDF2Size256SHA256Finish63KBDeriveKeyAlias_01_101';
let huksOptionsFinish = { let huksOptionsFinish = {
properties: new Array( properties: new Array(
HuksDerivePBKDF2.HuksKeySTORAGE, HuksDerivePBKDF2.HuksKeySTORAGE,
...@@ -50,7 +52,7 @@ describe('SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit', function () { ...@@ -50,7 +52,7 @@ describe('SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit', function () {
value: stringToUint8Array(srcKeyAliesFirst), value: stringToUint8Array(srcKeyAliesFirst),
}, },
HuksDerivePBKDF2.HuksKeyPADDINGNONE, HuksDerivePBKDF2.HuksKeyPADDINGNONE,
HuksDerivePBKDF2.HuksKeyBLOCKMODEECB HuksDerivePBKDF2.HuksKeyBLOCKMODEGCM
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { describe, it, expect } from "@ohos/hypium"; import { describe, it, expect, beforeAll } from "@ohos/hypium";
import huks from "@ohos.security.huks"; import huks from "@ohos.security.huks";
import Data from "../../../../../../utils/data.json"; import Data from "../../../../../../utils/data.json";
import { stringToUint8Array } from "../../../../../../utils/param/publicFunc"; import { stringToUint8Array, checkSoftware } from "../../../../../../utils/param/publicFunc";
import { import {
HuksSignVerifyDSA, HuksSignVerifyDSA,
HuksSignVerifyRSA, HuksSignVerifyRSA,
...@@ -33,6 +33,7 @@ import { HuksHmac } from "../../../../../../utils/param/hmac/publicHmacParam"; ...@@ -33,6 +33,7 @@ import { HuksHmac } from "../../../../../../utils/param/hmac/publicHmacParam";
let srcData63 = Data.Data63b; let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63); let srcData63Kb = stringToUint8Array(srcData63);
let useSoftware = true;
function generateKey(srcKeyAlies, HuksOptions) { function generateKey(srcKeyAlies, HuksOptions) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -126,6 +127,11 @@ async function exportKeyFunc(srcKeyAlias, HuksOptions) { ...@@ -126,6 +127,11 @@ async function exportKeyFunc(srcKeyAlias, HuksOptions) {
export function SecurityHuksAccessControlJsunit() { export function SecurityHuksAccessControlJsunit() {
describe("SecurityHuksAccessControlJsunit", function () { describe("SecurityHuksAccessControlJsunit", function () {
beforeAll(async function (done) {
useSoftware = await checkSoftware();
done();
})
it("HUKS_Basic_Capability_AccessControl_0100", 0, async function (done) { it("HUKS_Basic_Capability_AccessControl_0100", 0, async function (done) {
let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_0100"; let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_0100";
let HuksOptions = { let HuksOptions = {
...@@ -137,22 +143,24 @@ export function SecurityHuksAccessControlJsunit() { ...@@ -137,22 +143,24 @@ export function SecurityHuksAccessControlJsunit() {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await generateKeyFunc(srcKeyAlias, HuksOptions); if (useSoftware) {
await exportKeyFunc(srcKeyAlias, HuksOptions); await generateKeyFunc(srcKeyAlias, HuksOptions);
await exportKeyFunc(srcKeyAlias, HuksOptions);
HuksOptions.properties.splice(1, 1, HuksAgreeDH.HuksKeyPurposeDH);
HuksOptions.properties.splice(3, 1); HuksOptions.properties.splice(1, 1, HuksAgreeDH.HuksKeyPurposeDH);
await init(srcKeyAlias, HuksOptions) HuksOptions.properties.splice(3, 1);
.then((data) => { await init(srcKeyAlias, HuksOptions)
console.log(`test init data: ${JSON.stringify(data)}`); .then((data) => {
expect(data.errorCode == -112).assertTrue(); console.log(`test init data: ${JSON.stringify(data)}`);
}) expect(data.errorCode == -112).assertTrue();
.catch((err) => { })
console.log(`test init err: " + ${JSON.stringify(err)}`); .catch((err) => {
expect(err.code == -112).assertTrue(); console.log(`test init err: " + ${JSON.stringify(err)}`);
}); expect(err.code == -112).assertTrue();
});
await deleteKeyFunc(srcKeyAlias, HuksOptions);
await deleteKeyFunc(srcKeyAlias, HuksOptions);
}
done(); done();
}); });
...@@ -162,7 +170,7 @@ export function SecurityHuksAccessControlJsunit() { ...@@ -162,7 +170,7 @@ export function SecurityHuksAccessControlJsunit() {
properties: new Array( properties: new Array(
HuksSignVerifyECC.HuksKeyAlgECC, HuksSignVerifyECC.HuksKeyAlgECC,
HuksSignVerifyECC.HuksKeyECCPurposeSINGVERIFY, HuksSignVerifyECC.HuksKeyECCPurposeSINGVERIFY,
HuksSignVerifyECC.HuksKeyECCSize224, HuksSignVerifyECC.HuksKeyECCSize384,
HuksSignVerifyECC.HuksTagECCDigestNONE HuksSignVerifyECC.HuksTagECCDigestNONE
), ),
inData: srcData63Kb, inData: srcData63Kb,
...@@ -196,32 +204,34 @@ export function SecurityHuksAccessControlJsunit() { ...@@ -196,32 +204,34 @@ export function SecurityHuksAccessControlJsunit() {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await generateKeyFunc(srcKeyAlias, HuksOptions); if (useSoftware) {
await exportKeyFunc(srcKeyAlias, HuksOptions); await generateKeyFunc(srcKeyAlias, HuksOptions);
await exportKeyFunc(srcKeyAlias, HuksOptions);
HuksOptions.properties.splice(1, 1, HuksCipherAES.HuksKeyPurposeENCRYPT);
await init(srcKeyAlias, HuksOptions) HuksOptions.properties.splice(1, 1, HuksCipherAES.HuksKeyPurposeENCRYPT);
.then((data) => { await init(srcKeyAlias, HuksOptions)
console.log(`test init data: ${JSON.stringify(data)}`); .then((data) => {
expect(null).assertFail(); console.log(`test init data: ${JSON.stringify(data)}`);
}) expect(null).assertFail();
.catch((err) => { })
console.log(`test init err: " + ${JSON.stringify(err)}`); .catch((err) => {
expect(err.code == -112).assertTrue(); console.log(`test init err: " + ${JSON.stringify(err)}`);
}); expect(err.code == -112).assertTrue();
});
HuksOptions.properties.splice(1, 1, HuksCipherAES.HuksKeyPurposeDECRYPT);
await init(srcKeyAlias, HuksOptions) HuksOptions.properties.splice(1, 1, HuksCipherAES.HuksKeyPurposeDECRYPT);
.then((data) => { await init(srcKeyAlias, HuksOptions)
console.log(`test init data: ${JSON.stringify(data)}`); .then((data) => {
expect(null).assertFail(); console.log(`test init data: ${JSON.stringify(data)}`);
}) expect(null).assertFail();
.catch((err) => { })
console.log(`test init err: " + ${JSON.stringify(err)}`); .catch((err) => {
expect(err.code == -112).assertTrue(); console.log(`test init err: " + ${JSON.stringify(err)}`);
}); expect(err.code == -112).assertTrue();
});
await deleteKeyFunc(srcKeyAlias, HuksOptions);
await deleteKeyFunc(srcKeyAlias, HuksOptions);
}
done(); done();
}); });
...@@ -233,7 +243,7 @@ export function SecurityHuksAccessControlJsunit() { ...@@ -233,7 +243,7 @@ export function SecurityHuksAccessControlJsunit() {
HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN, HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN,
HuksSignVerifyRSA.HuksTagPKCS1DigestMD5, HuksSignVerifyRSA.HuksTagPKCS1DigestMD5,
HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15,
HuksSignVerifyRSA.HuksKeyRSASize512 HuksSignVerifyRSA.HuksKeyRSASize3072
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -315,21 +325,23 @@ export function SecurityHuksAccessControlJsunit() { ...@@ -315,21 +325,23 @@ export function SecurityHuksAccessControlJsunit() {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await generateKeyFunc(srcKeyAlias, HuksOptions); if (useSoftware) {
await exportKeyFunc(srcKeyAlias, HuksOptions); await generateKeyFunc(srcKeyAlias, HuksOptions);
await exportKeyFunc(srcKeyAlias, HuksOptions);
HuksOptions.properties.splice(1, 1, HuksHmac.HuksKeyPurpose);
await init(srcKeyAlias, HuksOptions) HuksOptions.properties.splice(1, 1, HuksHmac.HuksKeyPurpose);
.then((data) => { await init(srcKeyAlias, HuksOptions)
console.log(`test init data: ${JSON.stringify(data)}`); .then((data) => {
expect(null).assertFail(); console.log(`test init data: ${JSON.stringify(data)}`);
}) expect(null).assertFail();
.catch((err) => { })
console.log(`test init err: " + ${JSON.stringify(err)}`); .catch((err) => {
expect(err.code == -112).assertTrue(); console.log(`test init err: " + ${JSON.stringify(err)}`);
}); expect(err.code == -112).assertTrue();
});
await deleteKeyFunc(srcKeyAlias, HuksOptions);
await deleteKeyFunc(srcKeyAlias, HuksOptions);
}
done(); done();
}); });
...@@ -391,7 +403,7 @@ export function SecurityHuksAccessControlJsunit() { ...@@ -391,7 +403,7 @@ export function SecurityHuksAccessControlJsunit() {
properties: new Array( properties: new Array(
HuksAgreeECDH.HuksKeyAlgECC, HuksAgreeECDH.HuksKeyAlgECC,
HuksAgreeECDH.HuksKeyPurposeECDH, HuksAgreeECDH.HuksKeyPurposeECDH,
HuksAgreeECDH.HuksKeyECCSize224, HuksAgreeECDH.HuksKeyECCSize384,
HuksAgreeECDH.HuksKeyECCDIGEST, HuksAgreeECDH.HuksKeyECCDIGEST,
HuksAgreeECDH.HuksKeyECCPADDING, HuksAgreeECDH.HuksKeyECCPADDING,
HuksAgreeECDH.HuksKeyECCBLOCKMODE HuksAgreeECDH.HuksKeyECCBLOCKMODE
...@@ -448,23 +460,25 @@ export function SecurityHuksAccessControlJsunit() { ...@@ -448,23 +460,25 @@ export function SecurityHuksAccessControlJsunit() {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await generateKeyFunc(srcKeyAlias, HuksOptions); if (useSoftware) {
await exportKeyFunc(srcKeyAlias, HuksOptions); await generateKeyFunc(srcKeyAlias, HuksOptions);
await exportKeyFunc(srcKeyAlias, HuksOptions);
HuksOptions.properties.splice(1, 1, HuksAgreeDH.HuksKeyPurposeDH);
HuksOptions.properties.splice(3, 1); HuksOptions.properties.splice(1, 1, HuksAgreeDH.HuksKeyPurposeDH);
await huks HuksOptions.properties.splice(3, 1);
.init(srcKeyAlias, HuksOptions) await huks
.then((data) => { .init(srcKeyAlias, HuksOptions)
console.log(`test init data: ${JSON.stringify(data)}`); .then((data) => {
expect(data.errorCode == -112).assertTrue(); console.log(`test init data: ${JSON.stringify(data)}`);
}) expect(data.errorCode == -112).assertTrue();
.catch((err) => { })
console.log(`test init err: " + ${JSON.stringify(err)}`); .catch((err) => {
expect(err.code == -112).assertTrue(); console.log(`test init err: " + ${JSON.stringify(err)}`);
}); expect(err.code == -112).assertTrue();
});
await deleteKeyFunc(srcKeyAlias, HuksOptions);
await deleteKeyFunc(srcKeyAlias, HuksOptions);
}
done(); done();
}); });
...@@ -835,7 +849,7 @@ export function SecurityHuksAccessControlJsunit() { ...@@ -835,7 +849,7 @@ export function SecurityHuksAccessControlJsunit() {
expect(1342197283).assertEqual( expect(1342197283).assertEqual(
huks.HuksTag.HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA huks.HuksTag.HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA
); );
expect(0).assertEqual(huks.HuksKeyStorageType.HUKS_STORAGE_TEMP ); expect(0).assertEqual(huks.HuksKeyStorageType.HUKS_STORAGE_TEMP);
expect(1).assertEqual(huks.HuksKeyStorageType.HUKS_STORAGE_PERSISTENT); expect(1).assertEqual(huks.HuksKeyStorageType.HUKS_STORAGE_PERSISTENT);
done(); done();
}); });
......
...@@ -243,12 +243,12 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions, thirdInderfaceName) { ...@@ -243,12 +243,12 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions, thirdInderfaceName) {
export function SecurityHuksHmacCallbackJsunit() { export function SecurityHuksHmacCallbackJsunit() {
describe("SecurityHuksHmacCallbackJsunit", function () { describe("SecurityHuksHmacCallbackJsunit", function () {
it("testHmacSHA1001", 0, async function (done) { it("testHmacSHA1001", 0, async function (done) {
let srcKeyAlies = "testHmacDigestSHA1KeyAlias001"; let srcKeyAlies = "testHmacDigestSHA256KeyAlias001";
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose, HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1 HuksHmac.HuksTagDigestSHA256
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -258,12 +258,12 @@ export function SecurityHuksHmacCallbackJsunit() { ...@@ -258,12 +258,12 @@ export function SecurityHuksHmacCallbackJsunit() {
}); });
it("testHmacSHA1002", 0, async function (done) { it("testHmacSHA1002", 0, async function (done) {
let srcKeyAlies = "testHmacDigestSHA1KeyAlias002"; let srcKeyAlies = "testHmacDigestSHA256KeyAlias002";
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose, HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1 HuksHmac.HuksTagDigestSHA256
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -271,12 +271,12 @@ export function SecurityHuksHmacCallbackJsunit() { ...@@ -271,12 +271,12 @@ export function SecurityHuksHmacCallbackJsunit() {
done(); done();
}); });
it("testHmacSHA1003", 0, async function (done) { it("testHmacSHA1003", 0, async function (done) {
let srcKeyAlies = "testHmacDigestSHA1KeyAlias003"; let srcKeyAlies = "testHmacDigestSHA256KeyAlias003";
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose, HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1 HuksHmac.HuksTagDigestSHA256
), ),
inData: srcData65Kb, inData: srcData65Kb,
}; };
...@@ -284,12 +284,12 @@ export function SecurityHuksHmacCallbackJsunit() { ...@@ -284,12 +284,12 @@ export function SecurityHuksHmacCallbackJsunit() {
done(); done();
}); });
it("testHmacSHA1004", 0, async function (done) { it("testHmacSHA1004", 0, async function (done) {
let srcKeyAlies = "testHmacDigestSHA1KeyAlias004"; let srcKeyAlies = "testHmacDigestSHA256KeyAlias004";
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose, HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1 HuksHmac.HuksTagDigestSHA256
), ),
inData: srcData65Kb, inData: srcData65Kb,
}; };
......
...@@ -234,12 +234,12 @@ async function update(handle, HuksOptions) { ...@@ -234,12 +234,12 @@ async function update(handle, HuksOptions) {
export default function SecurityHuksHmacBasicPromiseJsunit() { export default function SecurityHuksHmacBasicPromiseJsunit() {
describe("SecurityHuksHmacBasicPromiseJsunit", function () { describe("SecurityHuksHmacBasicPromiseJsunit", function () {
it("testHmac101", 0, async function (done) { it("testHmac101", 0, async function (done) {
const srcKeyAlies = "testHmacDigestSHA1KeyAlias101"; const srcKeyAlies = "testHmacDigestSHA256KeyAlias101";
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose, HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1 HuksHmac.HuksTagDigestSHA256
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -248,12 +248,12 @@ export default function SecurityHuksHmacBasicPromiseJsunit() { ...@@ -248,12 +248,12 @@ export default function SecurityHuksHmacBasicPromiseJsunit() {
}); });
it("testHmac102", 0, async function (done) { it("testHmac102", 0, async function (done) {
const srcKeyAlies = "testHmacDigestSHA1KeyAlias102"; const srcKeyAlies = "testHmacDigestSHA256KeyAlias102";
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose, HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1 HuksHmac.HuksTagDigestSHA256
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -262,12 +262,12 @@ export default function SecurityHuksHmacBasicPromiseJsunit() { ...@@ -262,12 +262,12 @@ export default function SecurityHuksHmacBasicPromiseJsunit() {
}); });
it("testHmac103", 0, async function (done) { it("testHmac103", 0, async function (done) {
const srcKeyAlies = "testHmacDigestSHA1KeyAlias103"; const srcKeyAlies = "testHmacDigestSHA256KeyAlias103";
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose, HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1 HuksHmac.HuksTagDigestSHA256
), ),
inData: srcData65Kb, inData: srcData65Kb,
}; };
...@@ -276,12 +276,12 @@ export default function SecurityHuksHmacBasicPromiseJsunit() { ...@@ -276,12 +276,12 @@ export default function SecurityHuksHmacBasicPromiseJsunit() {
}); });
it("testHmac104", 0, async function (done) { it("testHmac104", 0, async function (done) {
const srcKeyAlies = "testHmacDigestSHA1KeyAlias104"; const srcKeyAlies = "testHmacDigestSHA256KeyAlias104";
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose, HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1 HuksHmac.HuksTagDigestSHA256
), ),
inData: srcData65Kb, inData: srcData65Kb,
}; };
......
...@@ -15,24 +15,27 @@ ...@@ -15,24 +15,27 @@
import { describe, it } from '@ohos/hypium'; import { describe, it } from '@ohos/hypium';
import Data from '../../../../../../utils/data.json'; import Data from '../../../../../../utils/data.json';
import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam'; import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js'; import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData63 = Data.Data63b; let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63); let srcData63Kb = stringToUint8Array(srcData63);
export default function SecurityHuksDSABasicAbort63KBCallbackJsunit() { export default function SecurityHuksDSABasicAbort63KBCallbackJsunit() {
describe('SecurityHuksDSABasicAbort63KBCallbackJsunit', function () { describe('SecurityHuksDSABasicAbort63KBCallbackJsunit', function () {
it('testSignVerifyDSA002', 0, async function (done) { it('testSignVerifyDSA002', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias002'; const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias002';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksSignVerifyDSA.HuksKeyAlgDSA, HuksSignVerifyDSA.HuksKeyAlgDSA,
HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN, HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN,
HuksSignVerifyDSA.HuksTagDSADigestSHA1 HuksSignVerifyDSA.HuksTagDSADigestSHA1
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', true, srcData63Kb); let useSoftware = await checkSoftware();
done(); if (useSoftware) {
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', true, srcData63Kb);
}
done();
});
}); });
});
} }
...@@ -15,25 +15,28 @@ ...@@ -15,25 +15,28 @@
import { describe, it } from '@ohos/hypium'; import { describe, it } from '@ohos/hypium';
import Data from '../../../../../../utils/data.json'; import Data from '../../../../../../utils/data.json';
import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam'; import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js'; import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData65 = Data.Data65b; let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65); let srcData65Kb = stringToUint8Array(srcData65);
export default function SecurityHuksDSABasicAbort65KBCallbackJsunit() { export default function SecurityHuksDSABasicAbort65KBCallbackJsunit() {
describe('SecurityHuksDSABasicAbort65KBCallbackJsunit', function () { describe('SecurityHuksDSABasicAbort65KBCallbackJsunit', function () {
it('testSignVerifyDSA004', 0, async function (done) { it('testSignVerifyDSA004', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias004'; const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias004';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksSignVerifyDSA.HuksKeyAlgDSA, HuksSignVerifyDSA.HuksKeyAlgDSA,
HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN, HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN,
HuksSignVerifyDSA.HuksTagDSADigestSHA1 HuksSignVerifyDSA.HuksTagDSADigestSHA1
), ),
inData: srcData65Kb, inData: srcData65Kb,
}; };
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', true, srcData65Kb); let useSoftware = await checkSoftware();
done(); if (useSoftware) {
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', true, srcData65Kb);
}
done();
});
}); });
});
} }
...@@ -15,35 +15,38 @@ ...@@ -15,35 +15,38 @@
import { describe, it } from '@ohos/hypium'; import { describe, it } from '@ohos/hypium';
import Data from '../../../../../../utils/data.json'; import Data from '../../../../../../utils/data.json';
import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam'; import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js'; import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData63 = Data.Data63b; let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63); let srcData63Kb = stringToUint8Array(srcData63);
let finishOutData; let finishOutData;
export default function SecurityHuksDSABasicFinish63KBCallbackJsunit() { export default function SecurityHuksDSABasicFinish63KBCallbackJsunit() {
describe('SecurityHuksDSABasicFinish63KBCallbackJsunit', function () { describe('SecurityHuksDSABasicFinish63KBCallbackJsunit', function () {
it('testSignVerifyDSA001', 0, async function (done) { it('testSignVerifyDSA001', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias001'; const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias001';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksSignVerifyDSA.HuksKeyAlgDSA, HuksSignVerifyDSA.HuksKeyAlgDSA,
HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN, HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN,
HuksSignVerifyDSA.HuksTagDSADigestSHA1 HuksSignVerifyDSA.HuksTagDSADigestSHA1
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData63Kb); let useSoftware = await checkSoftware();
HuksOptions = { if (useSoftware) {
properties: new Array( finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData63Kb);
HuksSignVerifyDSA.HuksKeyAlgDSA, HuksOptions = {
HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY, properties: new Array(
HuksSignVerifyDSA.HuksTagDSADigestSHA1, HuksSignVerifyDSA.HuksKeyAlgDSA,
HuksSignVerifyDSA.HuksTagDSACOMMONSIZE HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY,
), HuksSignVerifyDSA.HuksTagDSADigestSHA1,
inData: finishOutData, HuksSignVerifyDSA.HuksTagDSACOMMONSIZE
}; ),
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', false, srcData63Kb); inData: finishOutData,
done(); };
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', false, srcData63Kb);
}
done();
});
}); });
});
} }
...@@ -15,35 +15,38 @@ ...@@ -15,35 +15,38 @@
import { describe, it } from '@ohos/hypium'; import { describe, it } from '@ohos/hypium';
import Data from '../../../../../../utils/data.json'; import Data from '../../../../../../utils/data.json';
import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam'; import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js'; import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData65 = Data.Data65b; let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65); let srcData65Kb = stringToUint8Array(srcData65);
let finishOutData; let finishOutData;
export default function SecurityHuksDSABasicFinish65KBCallbackJsunit() { export default function SecurityHuksDSABasicFinish65KBCallbackJsunit() {
describe('SecurityHuksDSABasicFinish65KBCallbackJsunit', function () { describe('SecurityHuksDSABasicFinish65KBCallbackJsunit', function () {
it('testSignVerifyDSA003', 0, async function (done) { it('testSignVerifyDSA003', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias003'; const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias003';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksSignVerifyDSA.HuksKeyAlgDSA, HuksSignVerifyDSA.HuksKeyAlgDSA,
HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN, HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN,
HuksSignVerifyDSA.HuksTagDSADigestSHA1 HuksSignVerifyDSA.HuksTagDSADigestSHA1
), ),
inData: srcData65Kb, inData: srcData65Kb,
}; };
finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData65Kb); let useSoftware = await checkSoftware();
HuksOptions = { if (useSoftware) {
properties: new Array( finishOutData = await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', true, srcData65Kb);
HuksSignVerifyDSA.HuksKeyAlgDSA, HuksOptions = {
HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY, properties: new Array(
HuksSignVerifyDSA.HuksTagDSADigestSHA1, HuksSignVerifyDSA.HuksKeyAlgDSA,
HuksSignVerifyDSA.HuksKeySIZE1024 HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY,
), HuksSignVerifyDSA.HuksTagDSADigestSHA1,
inData: finishOutData, HuksSignVerifyDSA.HuksKeySIZE1024
}; ),
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', false, srcData65Kb); inData: finishOutData,
done(); };
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'finish', false, srcData65Kb);
}
done();
});
}); });
});
} }
...@@ -32,7 +32,7 @@ describe('SecurityHuksECCBasicAbort63KBCallbackJsunit', function () { ...@@ -32,7 +32,7 @@ describe('SecurityHuksECCBasicAbort63KBCallbackJsunit', function () {
HuksSignVerifyECC.HuksKeyAlgECC, HuksSignVerifyECC.HuksKeyAlgECC,
HuksSignVerifyECC.HuksKeyECCPurposeSIGN, HuksSignVerifyECC.HuksKeyECCPurposeSIGN,
HuksSignVerifyECC.HuksTagECCDigestNONE, HuksSignVerifyECC.HuksTagECCDigestNONE,
HuksSignVerifyECC.HuksKeyECCSize224 HuksSignVerifyECC.HuksKeyECCSize256
), ),
inData: srcData63AfterSha256, inData: srcData63AfterSha256,
}; };
......
...@@ -32,7 +32,7 @@ describe('SecurityHuksECCBasicAbort65KBCallbackJsunit', function () { ...@@ -32,7 +32,7 @@ describe('SecurityHuksECCBasicAbort65KBCallbackJsunit', function () {
HuksSignVerifyECC.HuksKeyAlgECC, HuksSignVerifyECC.HuksKeyAlgECC,
HuksSignVerifyECC.HuksKeyECCPurposeSIGN, HuksSignVerifyECC.HuksKeyECCPurposeSIGN,
HuksSignVerifyECC.HuksTagECCDigestNONE, HuksSignVerifyECC.HuksTagECCDigestNONE,
HuksSignVerifyECC.HuksKeyECCSize224 HuksSignVerifyECC.HuksKeyECCSize256
), ),
inData: srcData65Sha256, inData: srcData65Sha256,
}; };
......
...@@ -33,7 +33,7 @@ describe('SecurityHuksECCBasicFinish63KBCallbackJsunit', function () { ...@@ -33,7 +33,7 @@ describe('SecurityHuksECCBasicFinish63KBCallbackJsunit', function () {
HuksSignVerifyECC.HuksKeyAlgECC, HuksSignVerifyECC.HuksKeyAlgECC,
HuksSignVerifyECC.HuksKeyECCPurposeSIGN, HuksSignVerifyECC.HuksKeyECCPurposeSIGN,
HuksSignVerifyECC.HuksTagECCDigestNONE, HuksSignVerifyECC.HuksTagECCDigestNONE,
HuksSignVerifyECC.HuksKeyECCSize224 HuksSignVerifyECC.HuksKeyECCSize256
), ),
inData: srcData63AfterSha256, inData: srcData63AfterSha256,
}; };
...@@ -43,7 +43,7 @@ describe('SecurityHuksECCBasicFinish63KBCallbackJsunit', function () { ...@@ -43,7 +43,7 @@ describe('SecurityHuksECCBasicFinish63KBCallbackJsunit', function () {
HuksSignVerifyECC.HuksKeyAlgECC, HuksSignVerifyECC.HuksKeyAlgECC,
HuksSignVerifyECC.HuksKeyECCPurposeVERIFY, HuksSignVerifyECC.HuksKeyECCPurposeVERIFY,
HuksSignVerifyECC.HuksTagECCDigestNONE, HuksSignVerifyECC.HuksTagECCDigestNONE,
HuksSignVerifyECC.HuksKeyECCSize224 HuksSignVerifyECC.HuksKeyECCSize256
), ),
inData: finishOutData, inData: finishOutData,
}; };
......
...@@ -33,7 +33,7 @@ describe('SecurityHuksECCBasicFinish65KBCallbackJsunit', function () { ...@@ -33,7 +33,7 @@ describe('SecurityHuksECCBasicFinish65KBCallbackJsunit', function () {
HuksSignVerifyECC.HuksKeyAlgECC, HuksSignVerifyECC.HuksKeyAlgECC,
HuksSignVerifyECC.HuksKeyECCPurposeSIGN, HuksSignVerifyECC.HuksKeyECCPurposeSIGN,
HuksSignVerifyECC.HuksTagECCDigestNONE, HuksSignVerifyECC.HuksTagECCDigestNONE,
HuksSignVerifyECC.HuksKeyECCSize224 HuksSignVerifyECC.HuksKeyECCSize256
), ),
inData: srcData65Sha256, inData: srcData65Sha256,
}; };
...@@ -43,7 +43,7 @@ describe('SecurityHuksECCBasicFinish65KBCallbackJsunit', function () { ...@@ -43,7 +43,7 @@ describe('SecurityHuksECCBasicFinish65KBCallbackJsunit', function () {
HuksSignVerifyECC.HuksKeyAlgECC, HuksSignVerifyECC.HuksKeyAlgECC,
HuksSignVerifyECC.HuksKeyECCPurposeVERIFY, HuksSignVerifyECC.HuksKeyECCPurposeVERIFY,
HuksSignVerifyECC.HuksTagECCDigestNONE, HuksSignVerifyECC.HuksTagECCDigestNONE,
HuksSignVerifyECC.HuksKeyECCSize224 HuksSignVerifyECC.HuksKeyECCSize256
), ),
inData: finishOutData, inData: finishOutData,
}; };
......
...@@ -25,14 +25,14 @@ let srcData63Kb = stringToUint8Array(srcData63); ...@@ -25,14 +25,14 @@ let srcData63Kb = stringToUint8Array(srcData63);
export default function SecurityHuksRSABasicAbort63KBCallbackJsunit() { export default function SecurityHuksRSABasicAbort63KBCallbackJsunit() {
describe('SecurityHuksRSABasicAbort63KBCallbackJsunit', function () { describe('SecurityHuksRSABasicAbort63KBCallbackJsunit', function () {
it('testSignVerifyRSA002', 0, async function (done) { it('testSignVerifyRSA002', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias002'; const srcKeyAlies = 'testSignVerifyRSASize4096SIGNPKCS1SHA512KeyAlias002';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksSignVerifyRSA.HuksKeyAlgRSA, HuksSignVerifyRSA.HuksKeyAlgRSA,
HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN, HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN,
HuksSignVerifyRSA.HuksTagPKCS1DigestMD5, HuksSignVerifyRSA.HuksTagPKCS1DigestSHA512,
HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15,
HuksSignVerifyRSA.HuksKeyRSASize512 HuksSignVerifyRSA.HuksKeyRSASize4096
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
......
...@@ -22,14 +22,14 @@ let srcData65Kb = stringToUint8Array(srcData65); ...@@ -22,14 +22,14 @@ let srcData65Kb = stringToUint8Array(srcData65);
export default function SecurityHuksRSABasicAbort65KBCallbackJsunit() { export default function SecurityHuksRSABasicAbort65KBCallbackJsunit() {
describe('SecurityHuksRSABasicAbort65KBCallbackJsunit', function () { describe('SecurityHuksRSABasicAbort65KBCallbackJsunit', function () {
it('testSignVerifyRSA004', 0, async function (done) { it('testSignVerifyRSA004', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias004'; const srcKeyAlies = 'testSignVerifyRSASize4096SIGNPKCS1SHA512KeyAlias004';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksSignVerifyRSA.HuksKeyAlgRSA, HuksSignVerifyRSA.HuksKeyAlgRSA,
HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN, HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN,
HuksSignVerifyRSA.HuksTagPKCS1DigestMD5, HuksSignVerifyRSA.HuksTagPKCS1DigestSHA512,
HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15,
HuksSignVerifyRSA.HuksKeyRSASize512 HuksSignVerifyRSA.HuksKeyRSASize4096
), ),
inData: srcData65Kb, inData: srcData65Kb,
}; };
......
...@@ -23,14 +23,14 @@ let finishOutData; ...@@ -23,14 +23,14 @@ let finishOutData;
export default function SecurityHuksRSABasicFinish63KBCallbackJsunit() { export default function SecurityHuksRSABasicFinish63KBCallbackJsunit() {
describe('SecurityHuksRSABasicFinish63KBCallbackJsunit', function () { describe('SecurityHuksRSABasicFinish63KBCallbackJsunit', function () {
it('testSignVerifyRSA001', 0, async function (done) { it('testSignVerifyRSA001', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias001'; const srcKeyAlies = 'testSignVerifyRSASize4096SIGNPKCS1SHA512KeyAlias001';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksSignVerifyRSA.HuksKeyAlgRSA, HuksSignVerifyRSA.HuksKeyAlgRSA,
HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN, HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN,
HuksSignVerifyRSA.HuksTagPKCS1DigestMD5, HuksSignVerifyRSA.HuksTagPKCS1DigestSHA512,
HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15,
HuksSignVerifyRSA.HuksKeyRSASize512 HuksSignVerifyRSA.HuksKeyRSASize4096
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
...@@ -39,9 +39,9 @@ describe('SecurityHuksRSABasicFinish63KBCallbackJsunit', function () { ...@@ -39,9 +39,9 @@ describe('SecurityHuksRSABasicFinish63KBCallbackJsunit', function () {
properties: new Array( properties: new Array(
HuksSignVerifyRSA.HuksKeyAlgRSA, HuksSignVerifyRSA.HuksKeyAlgRSA,
HuksSignVerifyRSA.HuksKeyRSAPurposeVERIFY, HuksSignVerifyRSA.HuksKeyRSAPurposeVERIFY,
HuksSignVerifyRSA.HuksTagPKCS1DigestMD5, HuksSignVerifyRSA.HuksTagPKCS1DigestSHA512,
HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15,
HuksSignVerifyRSA.HuksKeyRSASize512 HuksSignVerifyRSA.HuksKeyRSASize4096
), ),
inData: finishOutData, inData: finishOutData,
}; };
......
...@@ -23,14 +23,14 @@ let finishOutData; ...@@ -23,14 +23,14 @@ let finishOutData;
export default function SecurityHuksRSABasicFinish65KBCallbackJsunit() { export default function SecurityHuksRSABasicFinish65KBCallbackJsunit() {
describe('SecurityHuksRSABasicFinish65KBCallbackJsunit', function () { describe('SecurityHuksRSABasicFinish65KBCallbackJsunit', function () {
it('testSignVerifyRSA003', 0, async function (done) { it('testSignVerifyRSA003', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias003'; const srcKeyAlies = 'testSignVerifyRSASize4096SIGNPKCS1SHA512KeyAlias003';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksSignVerifyRSA.HuksKeyAlgRSA, HuksSignVerifyRSA.HuksKeyAlgRSA,
HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN, HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN,
HuksSignVerifyRSA.HuksTagPKCS1DigestMD5, HuksSignVerifyRSA.HuksTagPKCS1DigestSHA512,
HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15,
HuksSignVerifyRSA.HuksKeyRSASize512 HuksSignVerifyRSA.HuksKeyRSASize4096
), ),
inData: srcData65Kb, inData: srcData65Kb,
}; };
...@@ -39,9 +39,9 @@ describe('SecurityHuksRSABasicFinish65KBCallbackJsunit', function () { ...@@ -39,9 +39,9 @@ describe('SecurityHuksRSABasicFinish65KBCallbackJsunit', function () {
properties: new Array( properties: new Array(
HuksSignVerifyRSA.HuksKeyAlgRSA, HuksSignVerifyRSA.HuksKeyAlgRSA,
HuksSignVerifyRSA.HuksKeyRSAPurposeVERIFY, HuksSignVerifyRSA.HuksKeyRSAPurposeVERIFY,
HuksSignVerifyRSA.HuksTagPKCS1DigestMD5, HuksSignVerifyRSA.HuksTagPKCS1DigestSHA512,
HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15,
HuksSignVerifyRSA.HuksKeyRSASize512 HuksSignVerifyRSA.HuksKeyRSASize4096
), ),
inData: finishOutData, inData: finishOutData,
}; };
......
...@@ -15,24 +15,27 @@ ...@@ -15,24 +15,27 @@
import { describe, it } from '@ohos/hypium'; import { describe, it } from '@ohos/hypium';
import Data from '../../../../../../utils/data.json'; import Data from '../../../../../../utils/data.json';
import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam'; import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js'; import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData63 = Data.Data63b; let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63); let srcData63Kb = stringToUint8Array(srcData63);
export default function SecurityHuksDSABasicAbort63KBPromiseJsunit() { export default function SecurityHuksDSABasicAbort63KBPromiseJsunit() {
describe('SecurityHuksDSABasicAbort63KBPromiseJsunit', function () { describe('SecurityHuksDSABasicAbort63KBPromiseJsunit', function () {
it('testSignVerifyDSA102', 0, async function (done) { it('testSignVerifyDSA102', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias102'; const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias102';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksSignVerifyDSA.HuksKeyAlgDSA, HuksSignVerifyDSA.HuksKeyAlgDSA,
HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN, HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN,
HuksSignVerifyDSA.HuksTagDSADigestSHA1 HuksSignVerifyDSA.HuksTagDSADigestSHA1
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', true, srcData63Kb); let useSoftware = await checkSoftware();
done(); if (useSoftware) {
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', true, srcData63Kb);
}
done();
});
}); });
});
} }
...@@ -15,24 +15,27 @@ ...@@ -15,24 +15,27 @@
import { describe, it } from '@ohos/hypium'; import { describe, it } from '@ohos/hypium';
import Data from '../../../../../../utils/data.json'; import Data from '../../../../../../utils/data.json';
import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam'; import { HuksSignVerifyDSA } from '../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../utils/param/publicFunc'; import { stringToUint8Array, checkSoftware } from '../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js'; import { publicSignVerifyFunc } from '../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData65 = Data.Data65b; let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65); let srcData65Kb = stringToUint8Array(srcData65);
export default function SecurityHuksDSABasicAbort65KBPromiseJsunit() { export default function SecurityHuksDSABasicAbort65KBPromiseJsunit() {
describe('SecurityHuksDSABasicAbort65KBPromiseJsunit', function () { describe('SecurityHuksDSABasicAbort65KBPromiseJsunit', function () {
it('testSignVerifyDSA104', 0, async function (done) { it('testSignVerifyDSA104', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias104'; const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias104';
let HuksOptions = { let HuksOptions = {
properties: new Array( properties: new Array(
HuksSignVerifyDSA.HuksKeyAlgDSA, HuksSignVerifyDSA.HuksKeyAlgDSA,
HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN, HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN,
HuksSignVerifyDSA.HuksTagDSADigestSHA1 HuksSignVerifyDSA.HuksTagDSADigestSHA1
), ),
inData: srcData65Kb, inData: srcData65Kb,
}; };
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', true, srcData65Kb); let useSoftware = await checkSoftware();
done(); if (useSoftware) {
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', true, srcData65Kb);
}
done();
});
}); });
});
} }
...@@ -157,6 +157,10 @@ let HuksSignVerifyED25519 = { ...@@ -157,6 +157,10 @@ let HuksSignVerifyED25519 = {
tag: param.HksTag.HKS_TAG_DIGEST, tag: param.HksTag.HKS_TAG_DIGEST,
value: param.HksKeyDigest.HKS_DIGEST_SHA1, value: param.HksKeyDigest.HKS_DIGEST_SHA1,
}, },
HuksTagDigestSHA256: {
tag: param.HksTag.HKS_TAG_DIGEST,
value: param.HksKeyDigest.HKS_DIGEST_SHA256,
},
}; };
let HuksSignVerifyRSA = { let HuksSignVerifyRSA = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册