diff --git a/security/huks_standard/BUILD.gn b/security/huks_standard/BUILD.gn
index a57999da16d937a57d74b01b714e65a5dbe771d2..c927d5fc4d75777533a334a65ece54d420070393 100644
--- a/security/huks_standard/BUILD.gn
+++ b/security/huks_standard/BUILD.gn
@@ -19,12 +19,6 @@ group("huks_standard") {
deps = [
"HuksAbnormalTest:ActsHuksAbnormalTest",
"HuksAlgCompletionTest:ActsHuksAlgCompletionTest",
- "HuksConcurrencyApp1:ActsHuksConcurrencyApp1Test",
- "HuksConcurrencyApp2:ActsHuksConcurrencyApp2Test",
- "HuksConcurrencyTest:ActsHuksConcurrencyTest",
- "HuksJSTimingTest:ActsHuksJSTimingTest",
-
- #"HuksStressTest:ActsHuksStressTest",
]
}
}
diff --git a/security/huks_standard/HuksAbnormalTest/Test.json b/security/huks_standard/HuksAbnormalTest/Test.json
index 213442d73d4902db4eda9c0506fbd13b374c9b30..17d3d436657eef0843252424eb836dddb2976984 100644
--- a/security/huks_standard/HuksAbnormalTest/Test.json
+++ b/security/huks_standard/HuksAbnormalTest/Test.json
@@ -2,7 +2,7 @@
"description": "Configuration for algorithm completion test",
"driver": {
"type": "JSUnitTest",
- "test-timeout": "300000",
+ "test-timeout": "7200000",
"package": "com.example.err",
"shell-timeout": "60000"
},
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/common/images/Wallpaper.png b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/common/images/Wallpaper.png
new file mode 100644
index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48
Binary files /dev/null and b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/common/images/Wallpaper.png differ
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/common/images/bg-tv.jpg b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/common/images/bg-tv.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89
Binary files /dev/null and b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/common/images/bg-tv.jpg differ
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.css b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.css
index 2b1965821483f4f8c8b97c86ef07fe87ea767d01..cea86d90eac6e55509e20fee0b234ac060af020c 100644
--- a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.css
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.css
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
.container {
flex-direction: column;
justify-content: center;
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.hml b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.hml
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..546cd8296b727c1639d551d2301a0bca055c1457 100644
--- a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.hml
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.hml
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
{{ $t('strings.hello') }} {{ title }}
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.js
index 8efefbc7bf415cbb12402fdd62b5510f11e348a7..1e7b197f6005568827b5fd4d3af3039c0359235c 100644
--- a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.js
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/default/pages/index/index.js
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part1.test.js
similarity index 52%
rename from security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback.test.js
rename to security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part1.test.js
index a9d0fe980bcc43734e1b5c2fb7feddd409dc796f..a1583c8a43f49fed81f48cd06edc6e92895c6878 100644
--- a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback.test.js
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part1.test.js
@@ -14,7 +14,7 @@
*/
import hks from '@ohos.security.huks'
-import {describe, it, expect} from 'deccjsunit/index'
+import { describe, it, expect } from 'deccjsunit/index'
import {
alias,
aliasEmpty,
@@ -32,12 +32,15 @@ import {
plainTextSize16,
plainTextSize64,
makeAgreeOption,
- makeEncryptAndDecryptOption,
+ makeEncryptAndDecryptOptionForAbnormal,
makeMacOption,
- makeSignVerifyAndImportOption
+ makeSignVerifyAndImportOption,
+ inDataTooLong,
+ aliasStrange,
+ invalidValueUint8Array
} from './hks_abnormal_common.test.js'
-describe('Hks_XtsTest_Abnormal_Callback', function () {
+describe('Hks_Abnormal_Callback_Part1', function () {
async function generateAesKey(mode) {
var option = {};
@@ -47,12 +50,12 @@ describe('Hks_XtsTest_Abnormal_Callback', function () {
option = JSON.parse(JSON.stringify(generateAesGCMKeyOption));
}
var ret = await hks.generateKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
};
function deleteKeyCallback(alias, done) {
hks.deleteKey(alias, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
done();
});
};
@@ -60,933 +63,933 @@ describe('Hks_XtsTest_Abnormal_Callback', function () {
async function generateRsaKey() {
var option = generateRSAKeyOption;
var ret = await hks.generateKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
};
async function generateEccKey() {
var option = generateECCKeyOption;
var ret = await hks.generateKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
};
async function generateMacKey() {
var option = generateMACKeyOption;
var ret = await hks.generateKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
};
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_00100
- * @tc.name HUKS_ABNORMAL_CALLBACK_00100
- * @tc.desc Abnormal with callback.
+ * @tc.name GenerateKeyCallbackEmptyAlias
+ * @tc.desc Generate key callback with empty alias.
*/
it('HUKS_ABNORMAL_CALLBACK_00100', 0, async function (done) {
hks.generateKey(aliasEmpty, generateAesCBCKeyOption, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_00200
- * @tc.name HUKS_ABNORMAL_CALLBACK_00200
- * @tc.desc Abnormal with callback.
+ * @tc.name GenerateKeyCallbackCriticalAlias
+ * @tc.desc Generate key callback with critical length alias.
*/
it('HUKS_ABNORMAL_CALLBACK_00200', 0, async function (done) {
hks.generateKey(aliasCritical, generateAesCBCKeyOption, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
deleteKeyCallback(aliasCritical, done);
})
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_00300
- * @tc.name HUKS_ABNORMAL_CALLBACK_00300
- * @tc.desc Abnormal with callback.
+ * @tc.name GenerateKeyCallbackLongAlias
+ * @tc.desc Generate key callback with too long alias.
*/
it('HUKS_ABNORMAL_CALLBACK_00300', 0, async function (done) {
hks.generateKey(aliasTooLong, generateAesCBCKeyOption, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_00400
- * @tc.name HUKS_ABNORMAL_CALLBACK_00400
- * @tc.desc Abnormal with callback.
+ * @tc.name GenerateKeyCallbackLackAlgTag
+ * @tc.desc Generate key callback lack of alg tag.
*/
it('HUKS_ABNORMAL_CALLBACK_00400', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties.splice(0, 1);
hks.generateKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_00500
- * @tc.name HUKS_ABNORMAL_CALLBACK_00500
- * @tc.desc Abnormal with callback.
+ * @tc.name GenerateKeyCallbackLackSizeTag
+ * @tc.desc Generate key callback lack of size tag.
*/
it('HUKS_ABNORMAL_CALLBACK_00500', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties.splice(1, 1);
hks.generateKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_00600
- * @tc.name HUKS_ABNORMAL_CALLBACK_00600
- * @tc.desc Abnormal with callback.
+ * @tc.name GenerateKeyCallbackLackPurposeTag
+ * @tc.desc Generate key callback lack of purpose tag.
*/
it('HUKS_ABNORMAL_CALLBACK_00600', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties.splice(2, 1);
hks.generateKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PURPOSE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PURPOSE_FAIL);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_00700
- * @tc.name HUKS_ABNORMAL_CALLBACK_00700
- * @tc.desc Abnormal with callback.
+ * @tc.name GenerateKeyCallbackLackPaddingTag
+ * @tc.desc Generate key callback lack of padding tag.
*/
it('HUKS_ABNORMAL_CALLBACK_00700', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties.splice(3, 1);
hks.generateKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PADDING_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PADDING_FAIL);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_00800
- * @tc.name HUKS_ABNORMAL_CALLBACK_00800
- * @tc.desc Abnormal with callback.
+ * @tc.name GenerateKeyCallbackLackModeTag
+ * @tc.desc Generate key callback lack of mode tag.
*/
it('HUKS_ABNORMAL_CALLBACK_00800', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties.splice(4, 1);
hks.generateKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_MODE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_MODE_FAIL);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_00900
- * @tc.name HUKS_ABNORMAL_CALLBACK_00900
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidAlgTagForGeneratingKeyCallback
+ * @tc.desc Invalid value of alg tag for generating key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_00900', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties[0].value = invalidValue;
hks.generateKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_01000
- * @tc.name HUKS_ABNORMAL_CALLBACK_01000
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidSizeTagForGeneratingKeyCallback
+ * @tc.desc Invalid value of size tag for generating key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_01000', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties[1].value = invalidValue;
hks.generateKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_KEY_SIZE);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_01100
- * @tc.name HUKS_ABNORMAL_CALLBACK_01100
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPurposeTagForGeneratingKeyCallback
+ * @tc.desc Invalid value of purpose tag for generating key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_01100', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties[2].value = invalidValue;
hks.generateKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_PURPOSE);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_01200
- * @tc.name HUKS_ABNORMAL_CALLBACK_01200
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPaddingTagForGeneratingKeyCallback
+ * @tc.desc Invalid value of padding tag for generating key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_01200', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties[3].value = invalidValue;
hks.generateKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_PADDING);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_01300
- * @tc.name HUKS_ABNORMAL_CALLBACK_01300
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidModeTagForGeneratingKeyCallback
+ * @tc.desc Invalid value of mode tag for generating key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_01300', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties[4].value = invalidValue;
hks.generateKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_MODE);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_MODE);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_01400
- * @tc.name HUKS_ABNORMAL_CALLBACK_01400
- * @tc.desc Abnormal with callback.
+ * @tc.name DeletekeyCallbackNotExistAlias
+ * @tc.desc Delete key callback with not exist alias.
*/
it('HUKS_ABNORMAL_CALLBACK_01400', 0, async function (done) {
hks.deleteKey(aliasNotExist, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_01500
- * @tc.name HUKS_ABNORMAL_CALLBACK_01500
- * @tc.desc Abnormal with callback.
+ * @tc.name DeletekeyCallbackEmptyAlias
+ * @tc.desc Delete key callback with empty alias.
*/
it('HUKS_ABNORMAL_CALLBACK_01500', 0, async function (done) {
hks.deleteKey(aliasEmpty, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_01600
- * @tc.name HUKS_ABNORMAL_CALLBACK_01600
- * @tc.desc Abnormal with callback.
+ * @tc.name DeletekeyCallbackLongAlias
+ * @tc.desc Delete key callback with too long alias.
*/
it('HUKS_ABNORMAL_CALLBACK_01600', 0, async function (done) {
hks.deleteKey(aliasTooLong, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_01700
- * @tc.name HUKS_ABNORMAL_CALLBACK_01700
- * @tc.desc Abnormal with callback.
+ * @tc.name EncryptCallbackEmptyAlias
+ * @tc.desc Encrypt callback with empty alias.
*/
it('HUKS_ABNORMAL_CALLBACK_01700', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
hks.encrypt(aliasEmpty, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_01800
- * @tc.name HUKS_ABNORMAL_CALLBACK_01800
- * @tc.desc Abnormal with callback.
+ * @tc.name EncryptCallbackNotExistAlias
+ * @tc.desc Encrypt callback with not exist alias.
*/
it('HUKS_ABNORMAL_CALLBACK_01800', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
hks.encrypt(aliasNotExist, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_01900
- * @tc.name HUKS_ABNORMAL_CALLBACK_01900
- * @tc.desc Abnormal with callback.
+ * @tc.name EncryptCallbackCriticalAlias
+ * @tc.desc Encrypt callback with critical length alias.
*/
it('HUKS_ABNORMAL_CALLBACK_01900', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
- hks.encrypt(aliasTooLong, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
+ hks.encrypt(aliasCritical, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_02000
- * @tc.name HUKS_ABNORMAL_CALLBACK_02000
- * @tc.desc Abnormal with callback.
+ * @tc.name EncryptCallbackLongAlias
+ * @tc.desc Encrypt callback with too long alias.
*/
it('HUKS_ABNORMAL_CALLBACK_02000', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
hks.encrypt(aliasTooLong, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_02100
- * @tc.name HUKS_ABNORMAL_CALLBACK_02100
- * @tc.desc Abnormal with callback.
+ * @tc.name EncryptCallbackLackAlgTag
+ * @tc.desc Encrypt callback lack of alg tag.
*/
it('HUKS_ABNORMAL_CALLBACK_02100', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(0, 1);
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_02200
- * @tc.name HUKS_ABNORMAL_CALLBACK_02200
- * @tc.desc Abnormal with callback.
+ * @tc.name EncryptCallbackLackPurposeTag
+ * @tc.desc Encrypt callback lack of purpose tag.
*/
it('HUKS_ABNORMAL_CALLBACK_02200', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(1, 1);
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PURPOSE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PURPOSE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_02300
- * @tc.name HUKS_ABNORMAL_CALLBACK_02300
- * @tc.desc Abnormal with callback.
+ * @tc.name EncryptCallbackLackModeTag
+ * @tc.desc Encrypt callback lack of mode tag.
*/
it('HUKS_ABNORMAL_CALLBACK_02300', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(2, 1);
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_MODE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_MODE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_02400
- * @tc.name HUKS_ABNORMAL_CALLBACK_02400
- * @tc.desc Abnormal with callback.
+ * @tc.name EncryptCallbackLackPaddingTag
+ * @tc.desc Encrypt callback lack of padding tag.
*/
it('HUKS_ABNORMAL_CALLBACK_02400', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(3, 1);
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PADDING_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PADDING_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_02500
- * @tc.name HUKS_ABNORMAL_CALLBACK_02500
- * @tc.desc Abnormal with callback.
+ * @tc.name EncryptCallbackLackIvTag
+ * @tc.desc Encrypt callback lack of iv tag.
*/
it('HUKS_ABNORMAL_CALLBACK_02500', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(4, 1);
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_IV_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_IV_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_02600
- * @tc.name HUKS_ABNORMAL_CALLBACK_02600
- * @tc.desc Abnormal with callback.
+ * @tc.name EncryptCallbackLackNonceTag
+ * @tc.desc Encrypt callback lack of nonce tag.
*/
it('HUKS_ABNORMAL_CALLBACK_02600', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.properties.splice(4, 1);
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_NONCE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_NONCE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_02700
- * @tc.name HUKS_ABNORMAL_CALLBACK_02700
- * @tc.desc Abnormal with callback.
+ * @tc.name EncryptCallbackLackAssociatedDataTag
+ * @tc.desc Encrypt callback lack of associated data tag.
*/
it('HUKS_ABNORMAL_CALLBACK_02700', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.properties.splice(5, 1);
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_AAD_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_AAD_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_02800
- * @tc.name HUKS_ABNORMAL_CALLBACK_02800
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidAlgTagForEncryptCallback
+ * @tc.desc Invalid value of alg tag for encrypt callback.
*/
it('HUKS_ABNORMAL_CALLBACK_02800', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[0].value = invalidValue;
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_02900
- * @tc.name HUKS_ABNORMAL_CALLBACK_02900
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPurposeTagForEncryptCallback
+ * @tc.desc Invalid value of purpose tag for encrypt callback.
*/
it('HUKS_ABNORMAL_CALLBACK_02900', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[1].value = invalidValue;
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_03000
- * @tc.name HUKS_ABNORMAL_CALLBACK_03000
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidModeTagForEncryptCallback
+ * @tc.desc Invalid value of mode tag for encrypt callback.
*/
it('HUKS_ABNORMAL_CALLBACK_03000', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[2].value = invalidValue;
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_MODE);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_MODE);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_03100
- * @tc.name HUKS_ABNORMAL_CALLBACK_03100
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPaddingTagForEncryptCallback
+ * @tc.desc Invalid value of padding tag for encrypt callback.
*/
it('HUKS_ABNORMAL_CALLBACK_03100', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[3].value = invalidValue;
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_PADDING);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_03200
- * @tc.name HUKS_ABNORMAL_CALLBACK_03200
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidIndataOfOptionForEncryptCallback
+ * @tc.desc Invalid indata of option for encrypt callback.
*/
it('HUKS_ABNORMAL_CALLBACK_03200', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.inData = new Uint8Array(0);
hks.encrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_03300
- * @tc.name HUKS_ABNORMAL_CALLBACK_03300
- * @tc.desc Abnormal with callback.
+ * @tc.name DecryptCallbackEmptyAlias
+ * @tc.desc Decrypt callback with empty alias.
*/
it('HUKS_ABNORMAL_CALLBACK_03300', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
hks.decrypt(aliasEmpty, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_03400
- * @tc.name HUKS_ABNORMAL_CALLBACK_03400
- * @tc.desc Abnormal with callback.
+ * @tc.name DecryptCallbackNotExistAlias
+ * @tc.desc Decrypt callback with not exist alias.
*/
it('HUKS_ABNORMAL_CALLBACK_03400', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
hks.decrypt(aliasNotExist, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_03500
- * @tc.name HUKS_ABNORMAL_CALLBACK_03500
- * @tc.desc Abnormal with callback.
+ * @tc.name DecryptCallbackCriticalAlias
+ * @tc.desc Decrypt callback with critical length alias.
*/
it('HUKS_ABNORMAL_CALLBACK_03500', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
- hks.decrypt(aliasTooLong, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
+ hks.decrypt(aliasCritical, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_03600
- * @tc.name HUKS_ABNORMAL_CALLBACK_03600
- * @tc.desc Abnormal with callback.
+ * @tc.name DecryptCallbackLongAlias
+ * @tc.desc Decrypt callback with too long alias.
*/
it('HUKS_ABNORMAL_CALLBACK_03600', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
hks.decrypt(aliasTooLong, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_03700
- * @tc.name HUKS_ABNORMAL_CALLBACK_03700
- * @tc.desc Abnormal with callback.
+ * @tc.name DecryptCallbackLackAlgTag
+ * @tc.desc Decrypt callback lack of alg tag.
*/
it('HUKS_ABNORMAL_CALLBACK_03700', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(0, 1);
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_03800
- * @tc.name HUKS_ABNORMAL_CALLBACK_03800
- * @tc.desc Abnormal with callback.
+ * @tc.name DecryptCallbackLackPurposeTag
+ * @tc.desc Decrypt callback lack of purpose tag.
*/
it('HUKS_ABNORMAL_CALLBACK_03800', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(1, 1);
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PURPOSE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PURPOSE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_03900
- * @tc.name HUKS_ABNORMAL_CALLBACK_03900
- * @tc.desc Abnormal with callback.
+ * @tc.name DecryptCallbackLackModeTag
+ * @tc.desc Decrypt callback lack of mode tag.
*/
it('HUKS_ABNORMAL_CALLBACK_03900', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(2, 1);
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_MODE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_MODE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_04000
- * @tc.name HUKS_ABNORMAL_CALLBACK_04000
- * @tc.desc Abnormal with callback.
+ * @tc.name DecryptCallbackLackPaddingTag
+ * @tc.desc Decrypt callback lack of padding tag.
*/
it('HUKS_ABNORMAL_CALLBACK_04000', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(3, 1);
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PADDING_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PADDING_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_04100
- * @tc.name HUKS_ABNORMAL_CALLBACK_04100
- * @tc.desc Abnormal with callback.
+ * @tc.name DecryptCallbackLackIvTag
+ * @tc.desc Decrypt callback lack of iv tag.
*/
it('HUKS_ABNORMAL_CALLBACK_04100', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(4, 1);
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_IV_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_IV_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_04200
- * @tc.name HUKS_ABNORMAL_CALLBACK_04200
- * @tc.desc Abnormal with callback.
+ * @tc.name DecryptCallbackLackNonceTag
+ * @tc.desc Decrypt callback lack of nonce tag.
*/
it('HUKS_ABNORMAL_CALLBACK_04200', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.properties.splice(4, 1);
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_NONCE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_NONCE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_04300
- * @tc.name HUKS_ABNORMAL_CALLBACK_04300
- * @tc.desc Abnormal with callback.
+ * @tc.name DecryptCallbackLackAssociatedDataTag
+ * @tc.desc Decrypt callback lack of associated data tag.
*/
it('HUKS_ABNORMAL_CALLBACK_04300', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.properties.splice(5, 1);
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_AAD_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_AAD_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_04400
- * @tc.name HUKS_ABNORMAL_CALLBACK_04400
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidAlgTagForDecryptCallback
+ * @tc.desc Invalid value of alg tag for decrypt callback.
*/
it('HUKS_ABNORMAL_CALLBACK_04400', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[0].value = invalidValue;
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_04500
- * @tc.name HUKS_ABNORMAL_CALLBACK_04500
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPurposeTagForDecryptCallback
+ * @tc.desc Invalid value of purpose tag for decrypt callback.
*/
it('HUKS_ABNORMAL_CALLBACK_04500', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[1].value = invalidValue;
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_04600
- * @tc.name HUKS_ABNORMAL_CALLBACK_04600
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidModeTagForDecryptCallback
+ * @tc.desc Invalid value of mode tag for decrypt callback.
*/
it('HUKS_ABNORMAL_CALLBACK_04600', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[2].value = invalidValue;
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_MODE);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_MODE);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_04700
- * @tc.name HUKS_ABNORMAL_CALLBACK_04700
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPaddingTagForDecryptCallback
+ * @tc.desc Invalid value of padding tag for decrypt callback.
*/
it('HUKS_ABNORMAL_CALLBACK_04700', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[3].value = invalidValue;
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_PADDING);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_04800
- * @tc.name HUKS_ABNORMAL_CALLBACK_04800
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidIndataOfOptionForDecryptCallback
+ * @tc.desc Invalid indata of option for decrypt callback.
*/
it('HUKS_ABNORMAL_CALLBACK_04800', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.inData = new Uint8Array(0);
hks.decrypt(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_04900
- * @tc.name HUKS_ABNORMAL_CALLBACK_04900
- * @tc.desc Abnormal with callback.
+ * @tc.name ImportKeyCallbackEmptyAlias
+ * @tc.desc Import key callback with empty alias.
*/
it('HUKS_ABNORMAL_CALLBACK_04900', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
hks.importKey(aliasEmpty, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_05000
- * @tc.name HUKS_ABNORMAL_CALLBACK_05000
- * @tc.desc Abnormal with callback.
+ * @tc.name ImportKeyCallbackCriticalAlias
+ * @tc.desc Import key callback with critical length alias.
*/
it('HUKS_ABNORMAL_CALLBACK_05000', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
hks.importKey(aliasCritical, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_05100
- * @tc.name HUKS_ABNORMAL_CALLBACK_05100
- * @tc.desc Abnormal with callback.
+ * @tc.name ImportKeyCallbackLongAlias
+ * @tc.desc Import key callback with too long alias.
*/
it('HUKS_ABNORMAL_CALLBACK_05100', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
hks.importKey(aliasTooLong, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_05200
- * @tc.name HUKS_ABNORMAL_CALLBACK_05200
- * @tc.desc Abnormal with callback.
+ * @tc.name ImportKeyCallbackLackAlgTag
+ * @tc.desc Import key callback lack of alg tag.
*/
it('HUKS_ABNORMAL_CALLBACK_05200', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(0, 1);
hks.importKey(aliasNotExist, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
done()
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_05300
- * @tc.name HUKS_ABNORMAL_CALLBACK_05300
- * @tc.desc Abnormal with callback.
+ * @tc.name ImportKeyCallbackLackPurposeTag
+ * @tc.desc Import key callback lack of purpose tag.
*/
it('HUKS_ABNORMAL_CALLBACK_05300', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(1, 1);
hks.importKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_05400
- * @tc.name HUKS_ABNORMAL_CALLBACK_05400
- * @tc.desc Abnormal with callback.
+ * @tc.name ImportKeyCallbackLackPaddingTag
+ * @tc.desc Import key callback lack of padding tag.
*/
it('HUKS_ABNORMAL_CALLBACK_05400', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(2, 1);
hks.importKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_05500
- * @tc.name HUKS_ABNORMAL_CALLBACK_05500
- * @tc.desc Abnormal with callback.
+ * @tc.name ImportKeyCallbackLackDigestTag
+ * @tc.desc Import key callback lack of digest tag.
*/
it('HUKS_ABNORMAL_CALLBACK_05500', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(3, 1);
hks.importKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_05600
- * @tc.name HUKS_ABNORMAL_CALLBACK_05600
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidAlgTagForImportKeyCallback
+ * @tc.desc Invalid value of alg tag for import key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_05600', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[0].value = invalidValue;
hks.importKey(aliasNotExist, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
done()
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_05700
- * @tc.name HUKS_ABNORMAL_CALLBACK_05700
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPurposeTagForImportKeyCallback
+ * @tc.desc Invalid value of alg tag for purpose key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_05700', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[1].value = invalidValue;
hks.importKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_05800
- * @tc.name HUKS_ABNORMAL_CALLBACK_05800
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPaddingTagForImportKeyCallback
+ * @tc.desc Invalid value of alg tag for padding key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_05800', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[2].value = invalidValue;
hks.importKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_05900
- * @tc.name HUKS_ABNORMAL_CALLBACK_05900
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidDigestTagForImportKeyCallback
+ * @tc.desc Invalid value of alg tag for digest key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_05900', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[3].value = invalidValue;
hks.importKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
});
-
+
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_06000
- * @tc.name HUKS_ABNORMAL_CALLBACK_06000
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidIndataOfOptionForImportKeyCallback
+ * @tc.desc Invalid indata of option for import key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_06000', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.inData = new Uint8Array(0);
hks.importKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_06100
- * @tc.name HUKS_ABNORMAL_CALLBACK_06100
- * @tc.desc Abnormal with callback.
+ * @tc.name ExportKeyCallbackNotExistAlias
+ * @tc.desc Export key callback with not exist alias.
*/
it('HUKS_ABNORMAL_CALLBACK_06100', 0, async function (done) {
hks.exportKey(aliasNotExist, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_06200
- * @tc.name HUKS_ABNORMAL_CALLBACK_06200
- * @tc.desc Abnormal with callback.
+ * @tc.name ExportKeyCallbackLongAlias
+ * @tc.desc Export key callback with too long alias.
*/
it('HUKS_ABNORMAL_CALLBACK_06200', 0, async function (done) {
hks.exportKey(aliasTooLong, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_06300
- * @tc.name HUKS_ABNORMAL_CALLBACK_06300
- * @tc.desc Abnormal with callback.
+ * @tc.name ExportKeyCallbackEmptyAlias
+ * @tc.desc Export key callback with empty alias.
*/
it('HUKS_ABNORMAL_CALLBACK_06300', 0, async function (done) {
hks.exportKey(aliasEmpty, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_06400
- * @tc.name HUKS_ABNORMAL_CALLBACK_06400
- * @tc.desc Abnormal with callback.
+ * @tc.name SignCallbackNotExistAlias
+ * @tc.desc Sign callback with not exist alias.
*/
it('HUKS_ABNORMAL_CALLBACK_06400', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
hks.sign(aliasNotExist, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_06500
- * @tc.name HUKS_ABNORMAL_CALLBACK_06500
- * @tc.desc Abnormal with callback.
+ * @tc.name SignCallbackLongAlias
+ * @tc.desc Sign callback with too long alias.
*/
it('HUKS_ABNORMAL_CALLBACK_06500', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
hks.sign(aliasTooLong, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_06600
- * @tc.name HUKS_ABNORMAL_CALLBACK_06600
- * @tc.desc Abnormal with callback.
+ * @tc.name SignCallbackEmptyAlias
+ * @tc.desc Sign callback with empty alias.
*/
it('HUKS_ABNORMAL_CALLBACK_06600', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
hks.sign(aliasEmpty, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
@@ -994,532 +997,635 @@ describe('Hks_XtsTest_Abnormal_Callback', function () {
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_06700
- * @tc.name HUKS_ABNORMAL_CALLBACK_06700
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidAlgTagForSignCallback
+ * @tc.desc Invalid value of alg tag for sign callback.
*/
it('HUKS_ABNORMAL_CALLBACK_06700', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[0].value = invalidValue;
hks.sign(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_06800
- * @tc.name HUKS_ABNORMAL_CALLBACK_06800
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPurposeTagForSignCallback
+ * @tc.desc Invalid value of purpose tag for sign callback.
*/
it('HUKS_ABNORMAL_CALLBACK_06800', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[1].value = invalidValue;
hks.sign(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_06900
- * @tc.name HUKS_ABNORMAL_CALLBACK_06900
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPaddingTagForSignCallback
+ * @tc.desc Invalid value of padding tag for sign callback.
*/
it('HUKS_ABNORMAL_CALLBACK_06900', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties[2].value = invalidValue;
hks.sign(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_07000
- * @tc.name HUKS_ABNORMAL_CALLBACK_07000
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidDigestTagForSignCallback
+ * @tc.desc Invalid value of digest tag for sign callback.
*/
it('HUKS_ABNORMAL_CALLBACK_07000', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties[3].value = invalidValue;
hks.sign(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_07100
- * @tc.name HUKS_ABNORMAL_CALLBACK_07100
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidIndataOfOptionForSignCallback
+ * @tc.desc Invalid indata of option for sign callback.
*/
it('HUKS_ABNORMAL_CALLBACK_07100', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.inData = new Uint8Array(0);
hks.sign(aliasEmpty, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_07200
- * @tc.name HUKS_ABNORMAL_CALLBACK_07200
- * @tc.desc Abnormal with callback.
+ * @tc.name SignCallbackLackAlgTag
+ * @tc.desc Sign callback lack of alg tag.
*/
it('HUKS_ABNORMAL_CALLBACK_07200', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(0, 1);
hks.sign(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_07300
- * @tc.name HUKS_ABNORMAL_CALLBACK_07300
- * @tc.desc Abnormal with callback.
+ * @tc.name SignCallbackLackPurposeTag
+ * @tc.desc Sign callback lack of purpose tag.
*/
it('HUKS_ABNORMAL_CALLBACK_07300', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(1, 1);
hks.sign(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_07400
- * @tc.name HUKS_ABNORMAL_CALLBACK_07400
- * @tc.desc Abnormal with callback.
+ * @tc.name SignCallbackLackPaddingTag
+ * @tc.desc Sign callback lack of padding tag.
*/
it('HUKS_ABNORMAL_CALLBACK_07400', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties.splice(2, 1);
hks.sign(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_07500
- * @tc.name HUKS_ABNORMAL_CALLBACK_07500
- * @tc.desc Abnormal with callback.
+ * @tc.name SignCallbackLackDigestTag
+ * @tc.desc Sign callback lack of digest tag.
*/
it('HUKS_ABNORMAL_CALLBACK_07500', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties.splice(3, 1);
hks.sign(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_07600
- * @tc.name HUKS_ABNORMAL_CALLBACK_07600
- * @tc.desc Abnormal with callback.
+ * @tc.name VerifyCallbackNotExistAlias
+ * @tc.desc Verify callback with not exist alias.
*/
it('HUKS_ABNORMAL_CALLBACK_07600', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
hks.verify(aliasNotExist, option, plainTextSize64, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_07700
- * @tc.name HUKS_ABNORMAL_CALLBACK_07700
- * @tc.desc Abnormal with callback.
+ * @tc.name VerifyCallbackLongAlias
+ * @tc.desc Verify callback with too long alias.
*/
it('HUKS_ABNORMAL_CALLBACK_07700', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
hks.verify(aliasTooLong, option, plainTextSize64, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_07800
- * @tc.name HUKS_ABNORMAL_CALLBACK_07800
- * @tc.desc Abnormal with callback.
+ * @tc.name VerifyCallbackEmptyAlias
+ * @tc.desc Verify callback with empty alias.
*/
it('HUKS_ABNORMAL_CALLBACK_07800', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
hks.verify(aliasEmpty, option, plainTextSize64, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_07900
- * @tc.name HUKS_ABNORMAL_CALLBACK_07900
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidAlgTagForVerifyCallback
+ * @tc.desc Invalid value of alg tag for verify callback.
*/
it('HUKS_ABNORMAL_CALLBACK_07900', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[0].value = invalidValue;
hks.verify(alias, option, plainTextSize64, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_08000
- * @tc.name HUKS_ABNORMAL_CALLBACK_08000
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPurposeTagForVerifyCallback
+ * @tc.desc Invalid value of purpose tag for verify callback.
*/
it('HUKS_ABNORMAL_CALLBACK_08000', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties[1].value = invalidValue;
hks.verify(alias, option, plainTextSize8, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_08100
- * @tc.name HUKS_ABNORMAL_CALLBACK_08100
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPaddingTagForVerifyCallback
+ * @tc.desc Invalid value of padding tag for verify callback.
*/
it('HUKS_ABNORMAL_CALLBACK_08100', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties[2].value = invalidValue;
hks.verify(alias, option, plainTextSize8, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_08200
- * @tc.name HUKS_ABNORMAL_CALLBACK_08200
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidDigestTagForVerifyCallback
+ * @tc.desc Invalid value of digest tag for verify callback.
*/
it('HUKS_ABNORMAL_CALLBACK_08200', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties[3].value = invalidValue;
hks.verify(alias, option, plainTextSize8, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_08300
- * @tc.name HUKS_ABNORMAL_CALLBACK_08300
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidIndataOfOptionForVerifyCallback
+ * @tc.desc Invalid indata of option for verify callback.
*/
it('HUKS_ABNORMAL_CALLBACK_08300', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize16);
option.inData = new Uint8Array(0);
hks.verify(alias, option, plainTextSize64, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_08400
- * @tc.name HUKS_ABNORMAL_CALLBACK_08400
- * @tc.desc Abnormal with callback.
+ * @tc.name VerifyCallbackLackAlgTag
+ * @tc.desc Verify callback lack of alg tag.
*/
it('HUKS_ABNORMAL_CALLBACK_08400', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(0, 1);
hks.verify(alias, option, plainTextSize64, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_08500
- * @tc.name HUKS_ABNORMAL_CALLBACK_08500
- * @tc.desc Abnormal with callback.
+ * @tc.name VerifyCallbackLackPurposeTag
+ * @tc.desc Verify callback lack of purpose tag.
*/
it('HUKS_ABNORMAL_CALLBACK_08500', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(1, 1);
hks.verify(aliasNotExist, option, plainTextSize64, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_08600
- * @tc.name HUKS_ABNORMAL_CALLBACK_08600
- * @tc.desc Abnormal with callback.
+ * @tc.name VerifyCallbackLackPaddingTag
+ * @tc.desc Verify callback lack of padding tag.
*/
it('HUKS_ABNORMAL_CALLBACK_08600', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties.splice(2, 1);
hks.verify(alias, option, plainTextSize8, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_08700
- * @tc.name HUKS_ABNORMAL_CALLBACK_08700
- * @tc.desc Abnormal with callback.
+ * @tc.name VerifyCallbackLackDigestTag
+ * @tc.desc Verify callback lack of digest tag.
*/
it('HUKS_ABNORMAL_CALLBACK_08700', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(3, 1);
hks.verify(alias, option, plainTextSize64, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_08800
- * @tc.name HUKS_ABNORMAL_CALLBACK_08800
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidIvTagForEncryptCallback
+ * @tc.desc Invalid value of iv tag for encrypt callback.
*/
it('HUKS_ABNORMAL_CALLBACK_08800', 0, async function (done) {
- await generateRsaKey();
- var option = makeSignVerifyAndImportOption(plainTextSize64);
- option.properties[0].value = invalidValue;
- hks.verify(alias, option, plainTextSize64, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ await generateAesKey('CBC');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
+ option.properties[4].value = invalidValueUint8Array;
+ hks.encrypt(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
+
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_08900
- * @tc.name HUKS_ABNORMAL_CALLBACK_08900
- * @tc.desc Abnormal with callback.
+ * @tc.name AgreeKeyCallbackEmptyAlias
+ * @tc.desc Agree key callback with empty alias.
*/
it('HUKS_ABNORMAL_CALLBACK_08900', 0, async function (done) {
var option = makeAgreeOption();
hks.agreeKey(aliasEmpty, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_09000
- * @tc.name HUKS_ABNORMAL_CALLBACK_09000
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidAlgTagForAgreeKeyCallback
+ * @tc.desc Invalid value of alg tag for agree key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_09000', 0, async function (done) {
await generateEccKey();
var option = makeAgreeOption();
option.properties[0].value = invalidValue;
hks.agreeKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_09100
- * @tc.name HUKS_ABNORMAL_CALLBACK_09100
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidSizeTagForAgreeKeyCallback
+ * @tc.desc Invalid value of size tag for agree key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_09100', 0, async function (done) {
await generateEccKey();
var option = makeAgreeOption();
option.properties[1].value = invalidValue;
hks.agreeKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_09200
- * @tc.name HUKS_ABNORMAL_CALLBACK_09200
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidIndataOfOptionForAgreeKeyCallback
+ * @tc.desc Invalid indata of option for agree key callback.
*/
it('HUKS_ABNORMAL_CALLBACK_09200', 0, async function (done) {
await generateEccKey();
var option = makeAgreeOption();
option.inData = new Uint8Array(0);
hks.agreeKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_09300
- * @tc.name HUKS_ABNORMAL_CALLBACK_09300
- * @tc.desc Abnormal with callback.
+ * @tc.name AgreeKeyCallbackLackAlgTag
+ * @tc.desc Agree key callback lack of alg tag.
*/
it('HUKS_ABNORMAL_CALLBACK_09300', 0, async function (done) {
await generateEccKey();
var option = makeAgreeOption();
option.properties.splice(0, 1);
hks.agreeKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_09400
- * @tc.name HUKS_ABNORMAL_CALLBACK_09400
- * @tc.desc Abnormal with callback.
+ * @tc.name AgreeKeyCallbackLackSizeTag
+ * @tc.desc Agree key callback lack of size tag.
*/
it('HUKS_ABNORMAL_CALLBACK_09400', 0, async function (done) {
await generateEccKey();
var option = makeAgreeOption();
option.properties[1].value = invalidValue;
hks.agreeKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_09500
- * @tc.name HUKS_ABNORMAL_CALLBACK_09500
- * @tc.desc Abnormal with callback.
+ * @tc.name MacCallbackEmptyAlias
+ * @tc.desc Mac callback with empty alias.
*/
it('HUKS_ABNORMAL_CALLBACK_09500', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
hks.mac(aliasNotExist, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_09600
- * @tc.name HUKS_ABNORMAL_CALLBACK_09600
- * @tc.desc Abnormal with callback.
+ * @tc.name MacCallbackTooLongAlias
+ * @tc.desc Mac callback with too long alias.
*/
it('HUKS_ABNORMAL_CALLBACK_09600', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
hks.mac(aliasTooLong, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_09700
- * @tc.name HUKS_ABNORMAL_CALLBACK_09700
- * @tc.desc Abnormal with callback.
+ * @tc.name MacCallbackEmptyAlias
+ * @tc.desc Mac callback with empty alias.
*/
it('HUKS_ABNORMAL_CALLBACK_09700', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
hks.mac(aliasEmpty, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_09800
- * @tc.name HUKS_ABNORMAL_CALLBACK_09800
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidPurposeTagForMacCallback
+ * @tc.desc Invalid value of purpose tag for mac callback.
*/
it('HUKS_ABNORMAL_CALLBACK_09800', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
option.properties[0].value = invalidValue;
hks.mac(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_PURPOSE);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_09900
- * @tc.name HUKS_ABNORMAL_CALLBACK_09900
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidDigestTagForMacCallback
+ * @tc.desc Invalid value of digest tag for mac callback.
*/
it('HUKS_ABNORMAL_CALLBACK_09900', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
option.properties[1].value = invalidValue;
hks.mac(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_10000
- * @tc.name HUKS_ABNORMAL_CALLBACK_10000
- * @tc.desc Abnormal with callback.
+ * @tc.name InvalidIndataOfOptionForMacCallback
+ * @tc.desc Invalid indata of option for mac callback.
*/
it('HUKS_ABNORMAL_CALLBACK_10000', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
option.inData = new Uint8Array(0);
hks.mac(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_10100
- * @tc.name HUKS_ABNORMAL_CALLBACK_10100
- * @tc.desc Abnormal with callback.
+ * @tc.name MacCallbackLackPurposeTag
+ * @tc.desc Mac callback lack of purpose tag.
*/
it('HUKS_ABNORMAL_CALLBACK_10100', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
option.properties.splice(0, 1);
hks.mac(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PURPOSE_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PURPOSE_FAIL);
deleteKeyCallback(alias, done);
});
});
/**
* @tc.number HUKS_ABNORMAL_CALLBACK_10200
- * @tc.name HUKS_ABNORMAL_CALLBACK_10200
- * @tc.desc Abnormal with callback.
+ * @tc.name MacCallbackLackDigestTag
+ * @tc.desc Mac callback lack of digest tag.
*/
it('HUKS_ABNORMAL_CALLBACK_10200', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
option.properties.splice(1, 1);
hks.mac(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_DIGEST_FAIL);
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_DIGEST_FAIL);
+ deleteKeyCallback(alias, done);
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_10300
+ * @tc.name LongIndataOfOptionForEncryptCallback
+ * @tc.desc Too long indata of option for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_10300', 0, async function (done) {
+ await generateAesKey('CBC');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
+ option.inData = inDataTooLong;
+ hks.encrypt(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_10400
+ * @tc.name GenerateKeyCallbackStrangeAlias
+ * @tc.desc Generate key callback with strange alias.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_10400', 0, async function (done) {
+ hks.generateKey(aliasStrange, generateAesCBCKeyOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ deleteKeyCallback(aliasStrange, done);
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_10500
+ * @tc.name InvalidNonceTagForEncryptCallback
+ * @tc.desc Invalid value of nonce tag for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_10500', 0, async function (done) {
+ await generateAesKey('GCM');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
+ option.properties[4].value = invalidValueUint8Array;
+ hks.encrypt(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ deleteKeyCallback(alias, done);
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_10600
+ * @tc.name InvalidASSOCIATEDDATATagForEncryptCallback
+ * @tc.desc Invalid value of associated data tag for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_10600', 0, async function (done) {
+ await generateAesKey('GCM');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
+ option.properties[5].value = invalidValueUint8Array;
+ hks.encrypt(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ deleteKeyCallback(alias, done);
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_10700
+ * @tc.name InvalidIvTagForDecryptCallback
+ * @tc.desc Invalid value of iv tag for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_10700', 0, async function (done) {
+ await generateAesKey('CBC');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
+ option.properties[4].value = invalidValueUint8Array;
+ hks.decrypt(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ deleteKeyCallback(alias, done);
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_10800
+ * @tc.name InvalidNonceTagForDecryptCallback
+ * @tc.desc Invalid value of nonce tag for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_10800', 0, async function (done) {
+ await generateAesKey('GCM');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
+ option.properties[4].value = invalidValueUint8Array;
+ hks.decrypt(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ deleteKeyCallback(alias, done);
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_10900
+ * @tc.name InvalidAssociatedDataTagForDecryptCallback
+ * @tc.desc Invalid value of associated data tag for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_10900', 0, async function (done) {
+ await generateAesKey('GCM');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
+ option.properties[5].value = invalidValueUint8Array;
+ hks.decrypt(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyCallback(alias, done);
});
});
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part2.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part2.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..3a543236a5fd9393066111322f16d5fe7d8ceec1
--- /dev/null
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part2.test.js
@@ -0,0 +1,2018 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hks from '@ohos.security.huks'
+import { describe, it, expect } from 'deccjsunit/index'
+import {
+ alias,
+} from '../../../../../../hks_xts_common.test'
+import {
+ aesGenerateKeyInvalidSizeOption,
+ aesGenerateKeyInvalidModeOption,
+ aesGenerateKeyInvalidAlgOption,
+ aesGenerateKeyInvalidPurposeOption,
+ rsaGenerateKeyInvalidSizeOption,
+ rsaGenerateKeyInvalidPaddingOption,
+ rsaGenerateKeyInvalidPurposeOption,
+ eccGenerateKeyInvalidSizeOption,
+ eccGenerateKeyInvalidDigestOption,
+ eccGenerateKeyInvalidPurposeOption,
+ ecdhGenerateKeyInvalidAlgOption,
+ hkdfGenerateKeyInvalidAlgOption,
+ pbkdf2GenerateKeyInvalidAlgOption,
+ ed25519GenerateKeyInvalidPurposeOption,
+ x25519GenerateKeyInvalidPurposeOption,
+ hmacGenerateKeyInvalidSizeOption,
+ hmacGenerateKeyInvalidPurposeOption,
+ dsaGenerateKeyInvalidSizeOption,
+ dsaGenerateKeyInvalidPurposeOption,
+ dhGenerateKeyInvalidPurposeOption,
+} from './hks_abnormal_common.test.js'
+
+describe('Hks_Abnormal_Callback_Part2', function () {
+ var errHmacKeySizeA = 0;
+ var errHmacKeySizeB = 9;
+ var errDsaKeySizeA = 0;
+ var errDsaKeySizeB = 9;
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_11000
+ * @tc.name InvalidAesKeySize512AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid aes key size 512 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_11000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_512);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_11100
+ * @tc.name InvalidRsaKeySize512AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 512 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_11100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_11200
+ * @tc.name InvalidRsaKeySize768AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 768 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_11200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_768);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_11300
+ * @tc.name InvalidRsaKeySize1024AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 1024 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_11300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_11400
+ * @tc.name InvalidRsaKeySize2048AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 2048 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_11400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_11500
+ * @tc.name InvalidRsaKeySize3072AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 3072 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_11500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_11600
+ * @tc.name InvalidRsaKeySize4096AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 4096 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_11600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_11700
+ * @tc.name InvalidEccKeySize224AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid ecc key size 224 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_11700', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_11800
+ * @tc.name InvalidEccKeySize256AlgAesForGenerateGKeyCallback
+ * @tc.desc Ecc key size 256 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_11800', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_11900
+ * @tc.name InvalidEccKeySize384AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid ecc key size 384 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_11900', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_12000
+ * @tc.name InvalidEccKeySize521AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid ecc key size 521 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_12000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_12100
+ * @tc.name InvalidCurve25519KeySize256AlgAesForGenerateGKeyCallback
+ * @tc.desc Curve25519 key size 256 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_12100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_12200
+ * @tc.name InvaliddhKeySize2048AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid dh key size 2048 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_12200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_12300
+ * @tc.name InvaliddhKeySize3072AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid dh key size 2048 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_12300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_12400
+ * @tc.name InvaliddhKeySize4096AlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid dh key size 4096 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_12400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_12500
+ * @tc.name InvalidPaddingOaepModeCbcAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding oaep mode cbc alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_12500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CBC,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_12600
+ * @tc.name InvalidPaddingPssModeCbcAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pss mode cbc alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_12600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(hks.HuksCipherMode.HUKS_MODE_CBC, hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_12700
+ * @tc.name InvalidPaddingPkcs1_v1_5ModeCbcAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs1_v1_5 mode cbc alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_12700', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CBC,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_12800
+ * @tc.name InvalidPaddingPkcs5ModeCbcAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs5 mode cbc alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_12800', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CBC,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_12900
+ * @tc.name InvalidPaddingOaepModeCtrAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding oaep mode ctr alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_12900', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CTR,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13000
+ * @tc.name InvalidPaddingPssModeCtrAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pss mode ctr alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_13000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(hks.HuksCipherMode.HUKS_MODE_CTR, hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13100
+ * @tc.name InvalidPaddingPkcs1_v1_5ModeCtrAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs1_v1_5 mode ctr alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_13100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CTR,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13200
+ * @tc.name InvalidPaddingPkcs5ModeCtrAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs5 mode ctr alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_13200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CTR,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13300
+ * @tc.name InvalidPaddingPkcs7ModeCtrAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs7 mode ctr alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_13300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CTR,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13400
+ * @tc.name InvalidPaddingOaepModeEcbAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding oaep mode ecb alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_13400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13500
+ * @tc.name InvalidPaddingPssModeEcbAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pss mode ecb alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_13500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(hks.HuksCipherMode.HUKS_MODE_ECB, hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13600
+ * @tc.name InvalidPaddingPkcs1_v1_5ModeEcbAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs1_v1_5 mode ecb alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_13600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13700
+ * @tc.name InvalidPaddingPkcs5ModeEcbAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs5 mode ecb alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_13700', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13800
+ * @tc.name InvalidPaddingOaepModeGcmAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding oaep mode gcm alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_13800', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_GCM,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13900
+ * @tc.name InvalidPaddingpssModeGcmAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pss mode gcm alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_13900', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(hks.HuksCipherMode.HUKS_MODE_GCM, hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14000
+ * @tc.name InvalidPaddingPkcs1_v1_5ModeGcmAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs1_v1_5 mode gcm alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_14000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_GCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14100
+ * @tc.name InvalidPaddingPkcs5ModeGcmAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs5 mode gcm alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_14100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_GCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14200
+ * @tc.name InvalidPaddingPkcs7ModeGcmAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs7 mode gcm alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_14200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_GCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14300
+ * @tc.name InvalidPaddingOaepModeCcmAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding oaep mode ccm alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_14300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CCM,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14400
+ * @tc.name InvalidPaddingPssModeCcmAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pss mode ccm alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_14400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(hks.HuksCipherMode.HUKS_MODE_CCM, hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14500
+ * @tc.name InvalidPaddingPkcs1_v1_5ModeCcmAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs1_v1_5 mode ccm alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_14500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14600
+ * @tc.name InvalidPaddingPkcs5ModeCcmAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs5 mode ccm alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_14600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14700
+ * @tc.name InvalidPaddingPkcs7ModeCcmAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid padding pkcs7 mode ccm alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_14700', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14800
+ * @tc.name InvalidModeOfbAlgAesForGenerateGKeyCallback
+ * @tc.desc Invalid mode ofb alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_14800', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_OFB,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_MODE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14900
+ * @tc.name InvalidPurposeDeriveAlgRsaAlgAesForGenerateKeyCallback.
+ * @tc.desc Invalid purpose derive alg rsa alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_14900', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15000
+ * @tc.name InvalidPurposeDeriveAlgEccAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg ecc alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_15000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15100
+ * @tc.name InvalidPurposeDeriveAlgDsaAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg dsa alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_15100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_DSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15200
+ * @tc.name InvalidPurposeDeriveAlgHkdfAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg hkdf alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_15200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_HKDF,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15300
+ * @tc.name InvalidPurposeDeriveAlgPbkdf2AlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg pbkdf2 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_15300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_PBKDF2,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15400
+ * @tc.name InvalidPurposeDeriveAlgEcdhAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg ecdh alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_15400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECDH,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15500
+ * @tc.name InvalidPurposeDeriveAlgX25519AlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg x25519 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_15500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_X25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15600
+ * @tc.name InvalidPurposeDeriveAlgEd25519AlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg ed25519 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_15600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ED25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15700
+ * @tc.name InvalidPurposeDeriveAlgDhAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg dh alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_15700', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15800
+ * @tc.name InvalidPurposeMacAlgRsaAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg rsa alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_15800', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_RSA, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15900
+ * @tc.name InvalidPurposeMacAlgEccAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg ecc alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_15900', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECC, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16000
+ * @tc.name InvalidPurposeMacAlgDsaAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg dsa alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_16000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DSA, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16100
+ * @tc.name InvalidPurposeMacAlgHkdfAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg hkdf alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_16100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16200
+ * @tc.name InvalidPurposeMacAlgPbkdf2AlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg pbkdf2 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_16200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_PBKDF2,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16300
+ * @tc.name InvalidPurposeMacAlgEcdhAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg ecdh alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_16300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECDH, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16400
+ * @tc.name InvalidPurposeMacAlgX25519AlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg x25519 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_16400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_X25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16500
+ * @tc.name InvalidPurposeMacAlgEd25519AlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg ed25519 alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_16500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ED25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16600
+ * @tc.name InvalidPurposeMacAlgDhAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg dh alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_16600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16700
+ * @tc.name InvalidPurposeSignAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose sign alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_16700', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(aesGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN;
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16800
+ * @tc.name InvalidPurposeVerifyAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose verify alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_16800', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(aesGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY;
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16900
+ * @tc.name InvalidPurposeAgreeAlgAesForGenerateKeyCallback
+ * @tc.desc Invalid purpose agree alg aes for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_16900', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(aesGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE;
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17000
+ * @tc.name InvalidEccKeySize224AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid ecc key size 224 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_17000', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17100
+ * @tc.name InvalidEccKeySize256AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid ecc key size 256 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_17100', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17200
+ * @tc.name InvalidEccKeySize384AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid ecc key size 384 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_17200', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17300
+ * @tc.name InvalidEccKeySize521AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid ecc key size 521 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_17300', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17400
+ * @tc.name InvalidAesKeySize128AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid aes key size 128 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_17400', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_128);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17500
+ * @tc.name InvalidAesKeySize192AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid aes key size 192 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_17500', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_192);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17600
+ * @tc.name InvalidAesKeySize256AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid aes key size 256 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_17600', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_256);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17700
+ * @tc.name InvalidAesKeySize512AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid aes key size 512 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_17700', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_512);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17800
+ * @tc.name InvalidCurve25519KeySize256AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid curve25519 key size 256 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_17800', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17900
+ * @tc.name InvalidDhKeySize2048AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid dh key size 2048 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_17900', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18000
+ * @tc.name InvalidDhKeySize3072AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid dh key size 3072 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_18000', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18100
+ * @tc.name InvalidDhKeySize4096AlgRsaForGenerateGKeyCallback
+ * @tc.desc Invalid dh key size 4096 alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_18100', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18200
+ * @tc.name InvalidPaddingPssPurposeEncryptDecryptAlgRsaForGenerateKeyCallback.
+ * @tc.desc Invalid padding pss purpose encrypt decrypt alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_18200', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18300
+ * @tc.name InvalidPaddingPkcs5PurposeEncryptDecryptAlgRsaForGenerateKeyCallback
+ * @tc.desc Invalid padding pkcs5 purpose encrypt decrypt alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_18300', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18400
+ * @tc.name InvalidPaddingPkcs7PurposeEncryptDecryptAlgRsaForGenerateKeyCallback
+ * @tc.desc Invalid padding pkcs7 purpose encrypt decrypt alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_18400', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18500
+ * @tc.name InvalidPaddingNonePurposeSignVerifyAlgRsaForGenerateKeyCallback
+ * @tc.desc Invalid padding none purpose sign verify alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_18500', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18600
+ * @tc.name InvalidPaddingOaepPurposeSignVerifyAlgRsaForGenerateKeyCallback
+ * @tc.desc Invalid padding oaep purpose sign verify alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_18600', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18700
+ * @tc.name InvalidPaddingPkcs5PurposeSignVerifyAlgRsaForGenerateKeyCallback
+ * @tc.desc Invalid padding pkcs5 purpose sign verify alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_18700', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18800
+ * @tc.name InvalidPaddingPkcs7PurposeSignVerifyAlgRsaForGenerateKeyCallback
+ * @tc.desc Invalid padding pkcs7 purpose sign verify alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_18800', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18900
+ * @tc.name InvalidPurposeDeriveAlgRsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_18900', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(rsaGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE;
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19000
+ * @tc.name InvalidPurposeMacAlgRsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_19000', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(rsaGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC;
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19100
+ * @tc.name InvalidPurposeWrapAlgRsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose wrap alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_19100', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(rsaGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP;
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19200
+ * @tc.name InvalidPurposeUnwrapAlgRsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose unwrap alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_19200', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(rsaGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP;
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19300
+ * @tc.name InvalidPurposeagreeAlgRsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose agree alg rsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_19300', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(rsaGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE;
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19400
+ * @tc.name InvalidRsaKeySize512AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 512 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_19400', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19500
+ * @tc.name InvalidRsaKeySize768AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 768 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_19500', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_768);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19600
+ * @tc.name InvalidRsaKeySize1024AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 1024 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_19600', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19700
+ * @tc.name InvalidRsaKeySize2048AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 2048 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_19700', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19800
+ * @tc.name InvalidRsaKeySize3072AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 3072 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_19800', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19900
+ * @tc.name InvalidRsaKeySize4096AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid rsa key size 4096 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_19900', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20000
+ * @tc.name InvalidAesKeySize128AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid aes key size 128 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_20000', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_128);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20100
+ * @tc.name InvalidAesKeySize192AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid aes key size 192 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_20100', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_192);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20200
+ * @tc.name InvalidAesKeySize256AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid aes key size 256 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_20200', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_256);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20300
+ * @tc.name InvalidAesKeySize512AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid aes key size 512 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_20300', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_512);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20400
+ * @tc.name InvalidCurve25519KeySize256AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid curve25519 key size 256 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_20400', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20500
+ * @tc.name InvalidDhKeySize2048AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid dh key size 2048 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_20500', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20600
+ * @tc.name InvalidDhKeySize3072AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid dh key size 3072 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_20600', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20700
+ * @tc.name InvalidDhKeySize4096AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid dh key size 4096 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_20700', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20800
+ * @tc.name InvalidDigestMd5AlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid digest md5 alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_20800', 0, async function (done) {
+ var option = eccGenerateKeyInvalidDigestOption(hks.HuksKeyDigest.HUKS_DIGEST_MD5);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20900
+ * @tc.name InvalidPurposeDeriveAlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid purpose derive alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_20900', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21000
+ * @tc.name InvalidPurposeMacAlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid purpose mac alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_21000', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21100
+ * @tc.name InvalidPurposeWrapAlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid purpose wrap alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_21100', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21200
+ * @tc.name InvalidPurposeUnwrapAlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid purpose unwrap alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_21200', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21300
+ * @tc.name InvalidPurposeencryptAlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid purpose encrypt alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_21300', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21400
+ * @tc.name InvalidPurposeDecryptAlgEccForGenerateGKeyCallback
+ * @tc.desc Invalid purpose decrypt alg ecc for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_21400', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21500
+ * @tc.name InvalidArgumentAlgEcdhForGenerateGKeyCallback
+ * @tc.desc Invalid argument alg ecdh for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_21500', 0, async function (done) {
+ var option = ecdhGenerateKeyInvalidAlgOption();
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21600
+ * @tc.name InvalidAlgorithmAlgHkdfForGenerateGKeyCallback
+ * @tc.desc Invalid algorithm alg hkdf for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_21600', 0, async function (done) {
+ var option = hkdfGenerateKeyInvalidAlgOption();
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21700
+ * @tc.name InvalidAlgorithmAlgPbkdf2ForGenerateGKeyCallback
+ * @tc.desc Invalid algorithm alg pbkdf2 for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_21700', 0, async function (done) {
+ var option = pbkdf2GenerateKeyInvalidAlgOption();
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21800
+ * @tc.name InvalidPurposeDeriveAlgEd25519ForGenerateKeyCallback.
+ * @tc.desc Invalid purpose derive alg ed25519 for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_21800', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21900
+ * @tc.name InvalidPurposeMacAlgEd25519ForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg ed25519 for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_21900', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22000
+ * @tc.name InvalidPurposeWrapAlgEd25519ForGenerateKeyCallback
+ * @tc.desc Invalid purpose wrap alg ed25519 for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_22000', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22100
+ * @tc.name InvalidPurposeUnwrapAlgEd25519ForGenerateKeyCallback
+ * @tc.desc Invalid purpose unwrap alg ed25519 for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_22100', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22200
+ * @tc.name InvalidPurposeEncryptAlgEd25519ForGenerateKeyCallback
+ * @tc.desc Invalid purpose encrypt alg ed25519 for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_22200', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22300
+ * @tc.name InvalidPurposeDecryptAlgEd25519ForGenerateKeyCallback
+ * @tc.desc Invalid purpose decrypt alg ed25519 for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_22300', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22400
+ * @tc.name InvalidPurposeDeriveAlgX25519ForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg x25519 for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_22400', 0, async function (done) {
+ var option = x25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22500
+ * @tc.name InvalidPurposeMacAlgX25519ForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg x25519 for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_22500', 0, async function (done) {
+ var option = x25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22600
+ * @tc.name InvalidPurposeEncryptAlgX25519ForGenerateKeyCallback
+ * @tc.desc Invalid purpose encrypt alg x25519 for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_22600', 0, async function (done) {
+ var option = x25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22700
+ * @tc.name InvalidPurposeDecryptAlgX25519ForGenerateKeyCallback
+ * @tc.desc Invalid purpose decrypt alg x25519 for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_22700', 0, async function (done) {
+ var option = x25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22800
+ * @tc.name InvalidArgumentSizeaAlgHmacForGenerateKeyCallback
+ * @tc.desc Invalid argument sizea alg hmac for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_22800', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidSizeOption(errHmacKeySizeA);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22900
+ * @tc.name InvalidArgumentSizebAlgHmacForGenerateKeyCallback
+ * @tc.desc Invalid argument sizeb alg hmac for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_22900', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidSizeOption(errHmacKeySizeB);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23000
+ * @tc.name InvalidPurposeDeriveAlgHmacForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg hmac for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_23000', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23100
+ * @tc.name InvalidPurposeSignAlgHmacForGenerateKeyCallback
+ * @tc.desc Invalid purpose sign alg hmac for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_23100', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23200
+ * @tc.name InvalidPurposeVerifyAlgHmacForGenerateKeyCallback
+ * @tc.desc Invalid purpose verify alg hmac for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_23200', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23300
+ * @tc.name InvalidPurposeWrapAlgHmacForGenerateKeyCallback
+ * @tc.desc Invalid purpose wrap alg hmac for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_23300', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23400
+ * @tc.name InvalidPurposeUnwrapAlgHmacForGenerateKeyCallback
+ * @tc.desc Invalid purpose unwrap alg hmac for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_23400', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23500
+ * @tc.name InvalidPurposeEncryptAlgHmacForGenerateKeyCallback
+ * @tc.desc Invalid purpose encrypt alg hmac for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_23500', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23600
+ * @tc.name InvalidPurposeDecryptAlgHmacForGenerateKeyCallback
+ * @tc.desc Invalid purpose decrypt alg hmac for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_23600', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23700
+ * @tc.name InvalidPurposeAgreeAlgHmacForGenerateKeyCallback
+ * @tc.desc Invalid purpose agree alg hmac for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_23700', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23800
+ * @tc.name InvalidArgumentSizeaAlgDsaForGenerateKeyCallback
+ * @tc.desc Invalid argument sizea alg dsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_23800', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidSizeOption(errDsaKeySizeA);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23900
+ * @tc.name InvalidArgumentSizebAlgDsaForGenerateKeyCallback
+ * @tc.desc Invalid argument sizeb alg dsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_23900', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidSizeOption(errDsaKeySizeB);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24000
+ * @tc.name InvalidPurposeDeriveAlgDsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg dsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_24000', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24100
+ * @tc.name InvalidPurposeMacAlgDsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg dsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_24100', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24200
+ * @tc.name InvalidPurposeWrapAlgDsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose wrap alg dsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_24200', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24300
+ * @tc.name InvalidPurposeUnwrapAlgDsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose unwrap alg dsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_24300', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24400
+ * @tc.name InvalidPurposeEncryptAlgDsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose encrypt alg dsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_24400', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24500
+ * @tc.name InvalidPurposeDecryptAlgDsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose decrypt alg dsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_24500', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24600
+ * @tc.name InvalidPurposeAgreeAlgDsaForGenerateKeyCallback
+ * @tc.desc Invalid purpose agree alg dsa for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_24600', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24700
+ * @tc.name InvalidPurposeDeriveAlgDhForGenerateKeyCallback
+ * @tc.desc Invalid purpose derive alg dh for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_24700', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24800
+ * @tc.name InvalidPurposeMacAlgDhForGenerateKeyCallback
+ * @tc.desc Invalid purpose mac alg dh for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_24800', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24900
+ * @tc.name InvalidPurposeWrapAlgDhForGenerateKeyCallback
+ * @tc.desc Invalid purpose wrap alg dh for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_24900', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25000
+ * @tc.name InvalidPurposeUnwrapAlgDhForGenerateKeyCallback
+ * @tc.desc Invalid purpose unwrap alg dh for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_25000', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25100
+ * @tc.name InvalidPurposeEncryptAlgDhForGenerateKeyCallback
+ * @tc.desc Invalid purpose encrypt alg dh for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_25100', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25200
+ * @tc.name InvalidPurposeDecryptAlgDhForGenerateKeyCallback
+ * @tc.desc Invalid purpose decrypt alg dh for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_25200', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25300
+ * @tc.name InvalidPurposeSignAlgDhForGenerateKeyCallback
+ * @tc.desc Invalid purpose sign alg dh for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_25300', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25400
+ * @tc.name InvalidPurposeVerifyAlgDhForGenerateKeyCallback
+ * @tc.desc Invalid purpose verify alg dh for generate key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_25400', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY);
+ hks.generateKey(alias, option, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+});
+
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part3.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part3.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..8a98cf26364df2851291bac175efcf84368891e9
--- /dev/null
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part3.test.js
@@ -0,0 +1,1484 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hks from '@ohos.security.huks'
+import { describe, it, expect } from 'deccjsunit/index'
+import {
+ alias,
+} from '../../../../../../hks_xts_common.test'
+
+import {
+ generateRSAKeyOption,
+ generateAesCBCKeyOption,
+ generateAesGCMKeyOption,
+ encryptOrDecryptGenerateKeyOption,
+ encryptOrDecryptOption,
+ encryptOrDecryptInvalidAlgOption,
+ rsaEncryptInvalidSizeOption,
+ aesEncryptOrDecryptInvalidSizeOption,
+ aesEncryptOrDecryptInvalidPaddingOption,
+ aesEncryptOrDecryptInvalidDigestOption,
+ rsaEncryptOrDecryptInvalidIndataOption,
+ aesEncryptOrDecryptInvalidIndataOption,
+ aesEncryptOrDecryptInvalidPurposeOption,
+ rsaDecryptInvalidSizeOption,
+} from './hks_abnormal_common.test.js'
+
+describe('Hks_Abnormal_Callback_Part3', function () {
+ var cipherText = [];
+
+ async function generateKey() {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ };
+
+ async function generateRSAKey() {
+ var option = generateRSAKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ };
+
+ async function generateAesCBCKey() {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ };
+ async function generateAesGCMKey() {
+ var option = generateAesGCMKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ };
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25500
+ * @tc.name InvalidAlgorithmAlgEccForEncryptCallback
+ * @tc.desc Invalid algorithm alg ecc for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_25500', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECC);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25600
+ * @tc.name InvalidAlgorithmAlgDsaForEncryptCallback
+ * @tc.desc Invalid algorithm alg dsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_25600', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DSA);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25700
+ * @tc.name InvalidAlgorithmAlgHmacForEncryptCallback
+ * @tc.desc Invalid algorithm alg hmac for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_25700', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HMAC);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25800
+ * @tc.name InvalidAlgorithmAlgHkdfForEncryptCallback
+ * @tc.desc Invalid algorithm alg hkdf for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_25800', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25900
+ * @tc.name InvalidAlgorithmAlgPbkdf2ForEncryptCallback
+ * @tc.desc Invalid algorithm alg pbkdf2 for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_25900', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_PBKDF2);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26000
+ * @tc.name InvalidAlgorithmAlgEcdhForEncryptCallback
+ * @tc.desc Invalid algorithm alg ecdh for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_26000', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECDH);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26100
+ * @tc.name InvalidAlgorithmAlgX25519ForEncryptCallback
+ * @tc.desc Invalid algorithm alg x25519 for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_26100', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_X25519);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26200
+ * @tc.name InvalidAlgorithmAlgEd25519ForEncryptCallback
+ * @tc.desc Invalid algorithm alg ed25519 for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_26200', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ED25519);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26300
+ * @tc.name InvalidAlgorithmAlgDhForEncryptCallback
+ * @tc.desc Invalid algorithm alg dh for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_26300', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26400
+ * @tc.name SuccessEcc224AlgRsaForEncryptCallback
+ * @tc.desc Success ecc 224 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_26400', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26500
+ * @tc.name SuccessEcc256AlgRsaForEncryptCallback
+ * @tc.desc Success ecc 256 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_26500', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26600
+ * @tc.name SuccessEcc384AlgRsaForEncryptCallback
+ * @tc.desc Success ecc 384 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_26600', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26700
+ * @tc.name SuccessEcc521AlgRsaForEncryptCallback
+ * @tc.desc Success ecc 521 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_26700', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26800
+ * @tc.name SuccessAes128AlgRsaForEncryptCallback
+ * @tc.desc Success aes 128 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_26800', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_128);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26900
+ * @tc.name SuccessAes192AlgRsaForEncryptCallback
+ * @tc.desc Success aes 192 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_26900', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_192);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27000
+ * @tc.name SuccessAes256AlgRsaForEncryptCallback
+ * @tc.desc Success aes 256 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_27000', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_256);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27100
+ * @tc.name SuccessAes512AlgRsaForEncryptCallback
+ * @tc.desc Success aes 512 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_27100', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_512);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27200
+ * @tc.name SuccessCurve25519256AlgRsaForEncryptCallback
+ * @tc.desc Success curve25519 256 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_27200', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27300
+ * @tc.name SuccessDh2048AlgRsaForEncryptCallback
+ * @tc.desc Success dh 2048 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_27300', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27400
+ * @tc.name SuccessDh3072AlgRsaForEncryptCallback
+ * @tc.desc Success dh 3072 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_27400', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27500
+ * @tc.name SuccessDh4096AlgRsaForEncryptCallback
+ * @tc.desc Success dh 4096 alg rsa for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_27500', 0, async function (done) {
+ await generateKey();
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27600
+ * @tc.name SuccessRsa512AlgAesForEncryptCallback
+ * @tc.desc Success rsa 512 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_27600', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27700
+ * @tc.name SuccessRsa768AlgAesForEncryptCallback
+ * @tc.desc Success rsa 768 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_27700', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_768);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27800
+ * @tc.name SuccessRsa1024AlgAesForEncryptCallback
+ * @tc.desc Success rsa 1024 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_27800', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27900
+ * @tc.name SuccessRsa2048AlgAesForEncryptCallback
+ * @tc.desc Success rsa 2048 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_27900', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28000
+ * @tc.name SuccessRsa3072AlgAesForEncryptCallback
+ * @tc.desc Success rsa 3072 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_28000', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28100
+ * @tc.name SuccessRsa4096AlgAesForEncryptCallback
+ * @tc.desc Success rsa 4096 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_28100', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28200
+ * @tc.name SuccessEcc224AlgAesForEncryptCallback
+ * @tc.desc Success ecc 224 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_28200', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28300
+ * @tc.name SuccessEcc256AlgAesForEncryptCallback
+ * @tc.desc Success ecc 256 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_28300', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28400
+ * @tc.name SuccessEcc384AlgAesForEncryptCallback
+ * @tc.desc Success ecc 384 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_28400', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28500
+ * @tc.name SuccessEcc521AlgAesForEncryptCallback
+ * @tc.desc Success ecc 521 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_28500', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28600
+ * @tc.name SuccessCurve25519256AlgAesForEncryptCallback
+ * @tc.desc Success curve25519 256 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_28600', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28700
+ * @tc.name SuccessDh2048AlgAesForEncryptCallback
+ * @tc.desc Success dh 2048 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_28700', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28800
+ * @tc.name SuccessDh3072AlgAesForEncryptCallback
+ * @tc.desc Success dh 3072 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_28800', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28900
+ * @tc.name SuccessDh4096AlgAesForEncryptCallback
+ * @tc.desc Success dh 4096 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_28900', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29000
+ * @tc.name InvalidPaddingPssPurposeEncryptDecryptAlgAesForEncryptCallback
+ * @tc.desc Invalid padding pss purpose encrypt decrypt alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_29000', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29100
+ * @tc.name InvalidPaddingPkcs5PurposeEncryptDecryptAlgAesForEncryptCallback
+ * @tc.desc Invalid padding pkcs5 purpose encrypt decrypt alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_29100', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29200
+ * @tc.name InvalidPaddingPkcs7PurposeEncryptDecryptAlgAesForEncryptCallback
+ * @tc.desc Invalid padding pkcs7 purpose encrypt decrypt alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_29200', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29300
+ * @tc.name SuccessDigestMd5AlgAesForEncryptCallback
+ * @tc.desc Success digest md5 alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_29300', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidDigestOption(hks.HuksKeyDigest.HUKS_DIGEST_MD5);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29400
+ * @tc.name InvalidArgumentIndataLargerThanKeySizeRsaPaddingNoneForEncryptCallback
+ * @tc.desc Invalid argument indata is larger than key size rsa padding none for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_29400', 0, async function (done) {
+ await generateRSAKey();
+ var encryptOption = rsaEncryptOrDecryptInvalidIndataOption();
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29500
+ * @tc.name InvalidArgumentIndataLargerThanKeySizeAesPaddingNoneForEncryptCallback
+ * @tc.desc Invalid argument indata is larger than key size aes padding none for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_29500', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidIndataOption();
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29600
+ * @tc.name InvalidPurposeDecryptAlgAesForEncryptCallback
+ * @tc.desc Invalid purpose decrypt alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_29600', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29700
+ * @tc.name InvalidPurposeSignAlgAesForEncryptCallback
+ * @tc.desc Invalid purpose sign alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_29700', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29800
+ * @tc.name InvalidPurposeVerifyAlgAesForEncryptCallback
+ * @tc.desc Invalid purpose verify alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_29800', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29900
+ * @tc.name InvalidPurposeDeriveAlgAesForEncryptCallback
+ * @tc.desc Invalid purpose derive alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_29900', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30000
+ * @tc.name InvalidPurposeWrapAlgAesForEncryptCallback
+ * @tc.desc Invalid purpose wrap alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_30000', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30100
+ * @tc.name InvalidPurposeUnwrapAlgAesForEncryptCallback
+ * @tc.desc Invalid purpose unwrap alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_30100', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30200
+ * @tc.name InvalidPurposeMacAlgAesForEncryptCallback
+ * @tc.desc Invalid purpose mac alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_30200', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30300
+ * @tc.name InvalidPurposeagreeAlgAesForEncryptCallback
+ * @tc.desc Invalid purpose agree alg aes for encrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_30300', 0, async function (done) {
+ await generateAesCBCKey();
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ hks.encrypt(alias, encryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30400
+ * @tc.name InvalidAlgorithmEccForDecryptCallback
+ * @tc.desc Invalid algorithm ecc for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_30400', 0, async function (done) {
+ await generateKey();
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECC);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30500
+ * @tc.name InvalidAlgorithmDsaForDecryptCallback
+ * @tc.desc Invalid algorithm dsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_30500', 0, async function (done) {
+ await generateKey();
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DSA);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30600
+ * @tc.name InvalidAlgorithmHmacForDecryptCallback
+ * @tc.desc Invalid algorithm hmac for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_30600', 0, async function (done) {
+ await generateKey();
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HMAC);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30700
+ * @tc.name InvalidAlgorithmHkdfForDecryptCallback
+ * @tc.desc Invalid algorithm hkdf for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_30700', 0, async function (done) {
+ await generateKey();
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30800
+ * @tc.name InvalidAlgorithmPbkdf2ForDecryptCallback
+ * @tc.desc Invalid algorithm pbkdf2 for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_30800', 0, async function (done) {
+ await generateKey();
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_PBKDF2);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30900
+ * @tc.name InvalidAlgorithmEcdhForDecryptCallback
+ * @tc.desc Invalid algorithm ecdh for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_30900', 0, async function (done) {
+ await generateKey();
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECDH);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31000
+ * @tc.name InvalidAlgorithmX25519ForDecryptCallback
+ * @tc.desc Invalid algorithm x25519 for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_31000', 0, async function (done) {
+ await generateKey();
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_X25519);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31100
+ * @tc.name InvalidAlgorithmEd25519ForDecryptCallback
+ * @tc.desc Invalid algorithm ed25519 for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_31100', 0, async function (done) {
+ await generateKey();
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ED25519);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31200
+ * @tc.name InvalidAlgorithmDhForDecryptCallback
+ * @tc.desc Invalid algorithm dh for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_31200', 0, async function (done) {
+ await generateKey();
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31300
+ * @tc.name SuccessEcc224AlgRsaForDecryptCallback
+ * @tc.desc Success ecc 224 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_31300', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31400
+ * @tc.name SuccessEcc256AlgRsaForDecryptCallback
+ * @tc.desc Success ecc 256 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_31400', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31500
+ * @tc.name SuccessEcc384AlgRsaForDecryptCallback
+ * @tc.desc Success ecc 384 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_31500', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31600
+ * @tc.name SuccessEcc521AlgRsaForDecryptCallback
+ * @tc.desc Success ecc 521 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_31600', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31700
+ * @tc.name SuccessAes128AlgRsaForDecryptCallback
+ * @tc.desc Success aes 128 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_31700', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_128, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31800
+ * @tc.name SuccessAes192AlgRsaForDecryptCallback
+ * @tc.desc Success aes 192 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_31800', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_192, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31900
+ * @tc.name SuccessAes256AlgRsaForDecryptCallback
+ * @tc.desc Success aes 256 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_31900', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_256, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32000
+ * @tc.name SuccessAes512AlgRsaForDecryptCallback
+ * @tc.desc Success aes 512 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_32000', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_512, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32100
+ * @tc.name SuccessCurve25519256AlgRsaForDecryptCallback
+ * @tc.desc Success curve25519 256 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_32100', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32200
+ * @tc.name SuccessDh2048AlgRsaForDecryptCallback
+ * @tc.desc Success dh 2048 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_32200', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32300
+ * @tc.name SuccessDh3072AlgRsaForDecryptCallback
+ * @tc.desc Success dh 3072 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_32300', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32400
+ * @tc.name SuccessDh4096AlgRsaForDecryptCallback
+ * @tc.desc Success dh 4096 alg rsa for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_32400', 0, async function (done) {
+ await generateKey();
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096, cipherText);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32500
+ * @tc.name SuccessRsa512AlgAesForDecryptCallback
+ * @tc.desc Success rsa 512 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_32500', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32600
+ * @tc.name SuccessRsa768AlgAesForDecryptCallback
+ * @tc.desc Success rsa 768 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_32600', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_768);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32700
+ * @tc.name SuccessRsa1024AlgAesForDecryptCallback
+ * @tc.desc Success rsa 1024 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_32700', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32800
+ * @tc.name SuccessRsa2048AlgAesForDecryptCallback
+ * @tc.desc Success rsa 2048 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_32800', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32900
+ * @tc.name SuccessRsa3072AlgAesForDecryptCallback
+ * @tc.desc Success rsa 3072 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_32900', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33000
+ * @tc.name SuccessRsa4096AlgAesForDecryptCallback
+ * @tc.desc Success rsa 4096 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_33000', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33100
+ * @tc.name SuccessEcc224AlgAesForDecryptCallback
+ * @tc.desc Success ecc 224 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_33100', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33200
+ * @tc.name SuccessEcc256AlgAesForDecryptCallback
+ * @tc.desc Success ecc 256 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_33200', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33300
+ * @tc.name SuccessEcc384AlgAesForDecryptCallback
+ * @tc.desc Success ecc 384 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_33300', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33400
+ * @tc.name SuccessEcc521AlgAesForDecryptCallback
+ * @tc.desc Success ecc 521 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_33400', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33500
+ * @tc.name Successcurve25519256AlgAesForDecryptCallback
+ * @tc.desc Success curve25519 256 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_33500', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33600
+ * @tc.name SuccessDh2048AlgAesForDecryptCallback
+ * @tc.desc Success dh 2048 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_33600', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33700
+ * @tc.name SuccessDh3072AlgAesForDecryptCallback
+ * @tc.desc Success dh 3072 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_33700', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33800
+ * @tc.name SuccessDh4096AlgAesForDecryptCallback
+ * @tc.desc Success dh 4096 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_33800', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33900
+ * @tc.name InvalidPaddingPssPurposeEncryptDecryptAlgAesForDecryptCallback
+ * @tc.desc Invalid padding pss purpose encrypt decrypt alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_33900', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34000
+ * @tc.name InvalidPaddingPkcs5PurposeEncryptDecryptAlgAesForDecryptCallback
+ * @tc.desc Invalid padding pkcs5 purpose encrypt decrypt alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_34000', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34100
+ * @tc.name InvalidPaddingPkcs7PurposeEncryptDecryptAlgAesForDecryptCallback
+ * @tc.desc Invalid padding pkcs7 purpose encrypt decrypt alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_34100', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34200
+ * @tc.name SuccessDigestMd5AlgAesForDecryptCallback
+ * @tc.desc Success digest md5 alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_34200', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidDigestOption(hks.HuksKeyDigest.HUKS_DIGEST_MD5);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34300
+ * @tc.name InvalidArgumentIndataLargerThanKeySizeRsaPaddingNoneForDecryptCallback
+ * @tc.desc Invalid argument indata is larger than key size rsa padding none for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_34300', 0, async function (done) {
+ await generateRSAKey();
+ var decryptOption = rsaEncryptOrDecryptInvalidIndataOption();
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34400
+ * @tc.name InvalidArgumentIndataLargerThanKeySizeAesPaddingNoneForDecryptCallback
+ * @tc.desc Invalid argument indata is larger than key size aes padding none for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_34400', 0, async function (done) {
+ await generateAesCBCKey();
+ var decryptOption = aesEncryptOrDecryptInvalidIndataOption();
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34500
+ * @tc.name InvalidPurposeEncryptAlgAesForDecryptCallback
+ * @tc.desc Invalid purpose encrypt alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_34500', 0, async function (done) {
+ await generateAesGCMKey();
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34600
+ * @tc.name InvalidPurposeSignAlgAesForDecryptCallback
+ * @tc.desc Invalid purpose sign alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_34600', 0, async function (done) {
+ await generateAesGCMKey();
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34700
+ * @tc.name InvalidPurposeVerifyAlgAesForDecryptCallback
+ * @tc.desc Invalid purpose verify alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_34700', 0, async function (done) {
+ await generateAesGCMKey();
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34800
+ * @tc.name InvalidPurposeDeriveAlgAesForDecryptCallback
+ * @tc.desc Invalid purpose derive alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_34800', 0, async function (done) {
+ await generateAesGCMKey();
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34900
+ * @tc.name InvalidPurposeWrapAlgAesForDecryptCallback
+ * @tc.desc Invalid purpose wrap alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_34900', 0, async function (done) {
+ await generateAesGCMKey();
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35000
+ * @tc.name InvalidPurposeUnwrapAlgAesForDecryptCallback
+ * @tc.desc Invalid purpose unwrap alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_35000', 0, async function (done) {
+ await generateAesGCMKey();
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35100
+ * @tc.name InvalidPurposeMacAlgAesForDecryptCallback
+ * @tc.desc Invalid purpose mac alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_35100', 0, async function (done) {
+ await generateAesGCMKey();
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35200
+ * @tc.name InvalidPurposeAgreeAlgAesForDecryptCallback
+ * @tc.desc Invalid purpose agree alg aes for decrypt callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_35200', 0, async function (done) {
+ await generateAesGCMKey();
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ hks.decrypt(alias, decryptOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+});
\ No newline at end of file
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part4.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part4.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..d1553ec950720ea289a91d5fbf93a8af05aa65c2
--- /dev/null
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part4.test.js
@@ -0,0 +1,568 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hks from '@ohos.security.huks'
+import { describe, it, expect } from 'deccjsunit/index'
+import {
+ alias,
+} from '../../../../../../hks_xts_common.test'
+import {
+ plainTextSize64,
+ signOrVerifyGenerateKeyOption,
+ signOrVerifyInvalidAlgOption,
+ signOrVerifyInvalidPurposeOption,
+ signOrVerifyInvalidPaddingOption,
+} from './hks_abnormal_common.test.js'
+
+describe('Hks_Abnormal_Callback_Part4', function () {
+
+ async function generateKey() {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ };
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35300
+ * @tc.name InvalidAlgorithmAlgAesForSignCallback
+ * @tc.desc Invalid algorithm alg aes for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_35300', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_AES);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35400
+ * @tc.name InvalidAlgorithmAlghmacForSignCallback
+ * @tc.desc Invalid algorithm alg hmac for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_35400', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HMAC);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35500
+ * @tc.name InvalidAlgorithmAlgHkdfForSignCallback
+ * @tc.desc Invalid algorithm alg hkdf for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_35500', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35600
+ * @tc.name InvalidAlgorithmAlgPbkdf2ForSignCallback
+ * @tc.desc Invalid algorithm alg pbkdf2 for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_35600', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_PBKDF2);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35700
+ * @tc.name InvalidAlgorithmAlgEcdhForSignCallback
+ * @tc.desc Invalid algorithm alg ecdh for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_35700', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECDH);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35800
+ * @tc.name InvalidAlgorithmAlgX25519ForSignCallback
+ * @tc.desc Invalid algorithm alg x25519 for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_35800', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_X25519);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35900
+ * @tc.name InvalidAlgorithmAlgDhForSignCallback
+ * @tc.desc Invalid algorithm alg dh for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_35900', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_36000
+ * @tc.name InvalidPurposeEncryptForSignCallback
+ * @tc.desc Invalid purpose encrypt for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_36000', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_36100
+ * @tc.name InvalidPurposeDecryptForSignCallback
+ * @tc.desc Invalid purpose decrypt for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_36100', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_36200
+ * @tc.name InvalidPurposeVerifyForSignCallback
+ * @tc.desc Invalid purpose verify for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_36200', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_36300
+ * @tc.name InvalidPurposeDeriveForSignCallback
+ * @tc.desc Invalid purpose derive for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_36300', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_36400
+ * @tc.name InvalidPurposeWrapForSignCallback
+ * @tc.desc Invalid purpose wrap for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_36400', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_36500
+ * @tc.name InvalidPurposeUnwrapForSignCallback
+ * @tc.desc Invalid purpose unwrap for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_36500', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_36600
+ * @tc.name InvalidPurposeMacForSignCallback
+ * @tc.desc Invalid purpose mac for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_36600', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_36700
+ * @tc.name InvalidPurposeAgreeForSignCallback
+ * @tc.desc Invalid purpose agree for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_36700', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_36800
+ * @tc.name InvalidPaddingNoneAlgRsaForSignCallback
+ * @tc.desc Invalid padding none alg rsa for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_36800', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_NONE);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_36900
+ * @tc.name InvalidPaddingOaepAlgRsaForSignCallback
+ * @tc.desc Invalid padding oaep alg rsa for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_36900', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_37000
+ * @tc.name InvalidPaddingPkcs5AlgRsaForSignCallback
+ * @tc.desc Invalid padding pkcs5 alg rsa for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_37000', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_37100
+ * @tc.name InvalidPaddingPkcs7AlgRsaForSignCallback
+ * @tc.desc Invalid padding pkcs7 alg rsa for sign callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_37100', 0, async function (done) {
+ await generateKey();
+ var signOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ hks.sign(alias, signOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_37200
+ * @tc.name InvalidAlgorithmAlgAesForVerifyCallback
+ * @tc.desc Invalid algorithm alg aes for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_37200', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_AES);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_37300
+ * @tc.name InvalidAlgorithmAlgHmacForVerifyCallback
+ * @tc.desc Invalid algorithm alg hmac for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_37300', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HMAC);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_37400
+ * @tc.name InvalidAlgorithmAlgHkdfForVerifyCallback
+ * @tc.desc Invalid algorithm alg hkdf for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_37400', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_37500
+ * @tc.name InvalidAlgorithmAlgPbkdf2ForVerifyCallback
+ * @tc.desc Invalid algorithm alg pbkdf2 for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_37500', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_PBKDF2);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_37600
+ * @tc.name InvalidAlgorithmAlgEcdhForVerifyCallback
+ * @tc.desc Invalid algorithm alg ecdh for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_37600', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECDH);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_37700
+ * @tc.name InvalidAlgorithmAlgX25519ForVerifyCallback
+ * @tc.desc Invalid algorithm alg x25519 for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_37700', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_X25519);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_37800
+ * @tc.name InvalidAlgorithmAlgDhForVerifyCallback
+ * @tc.desc Invalid algorithm alg dh for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_37800', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_37900
+ * @tc.name InvalidAlgorithmEncryptForVerifyCallback
+ * @tc.desc Invalid purpose encrypt for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_37900', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_38000
+ * @tc.name InvalidAlgorithmDecryptForVerifyCallback
+ * @tc.desc Invalid purpose decrypt for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_38000', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_38100
+ * @tc.name InvalidAlgorithmSignForVerifyCallback
+ * @tc.desc Invalid purpose sign for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_38100', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_38200
+ * @tc.name InvalidAlgorithmDeriveForVerifyCallback
+ * @tc.desc Invalid purpose derive for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_38200', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_38300
+ * @tc.name InvalidAlgorithmWrapForVerifyCallback
+ * @tc.desc Invalid purpose wrap for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_38300', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_38400
+ * @tc.name InvalidAlgorithmUnwrapForVerifyCallback
+ * @tc.desc Invalid purpose unwrap for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_38400', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_38500
+ * @tc.name InvalidAlgorithmMacForVerifyCallback
+ * @tc.desc Invalid purpose mac for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_38500', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_38600
+ * @tc.name InvalidAlgorithmAgreeForVerifyCallback
+ * @tc.desc Invalid purpose agree for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_38600', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_38700
+ * @tc.name InvalidPaddingNoneAlgRsaForVerifyCallback
+ * @tc.desc Invalid padding none alg rsa for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_38700', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_NONE);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_38800
+ * @tc.name InvalidPaddingOaepAlgRsaForVerifyCallback
+ * @tc.desc Invalid padding oaep alg rsa for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_38800', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_38900
+ * @tc.name InvalidPaddingPksc5AlgRsaForVerifyCallback
+ * @tc.desc Invalid padding pksc5 alg rsa for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_38900', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_39000
+ * @tc.name InvalidPaddingPkcs7AlgRsaForVerifyCallback
+ * @tc.desc Invalid padding pkcs7 alg rsa for verify callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_39000', 0, async function (done) {
+ await generateKey();
+ var verifyOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ hks.verify(alias, verifyOption, plainTextSize64, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+});
\ No newline at end of file
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part5.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part5.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..65ff37c62f41b32afd9212f1f3b667395da6e443
--- /dev/null
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part5.test.js
@@ -0,0 +1,347 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hks from '@ohos.security.huks'
+import { describe, it, expect } from 'deccjsunit/index'
+import {
+ alias,
+} from '../../../../../../hks_xts_common.test'
+import {
+ generateAgreeKeyOption,
+ hmacGenerateKeyOption,
+ agreeInvalidAlgOption,
+ hmacInvalidPurposeOption,
+} from './hks_abnormal_common.test.js'
+
+describe('Hks_Abnormal_Callback_Part5', function () {
+ async function hmacGenerateKey() {
+ var option = hmacGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ };
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_39100
+ * @tc.name InvalidAlgorithmAlgRsaForAgreeKeyCallback
+ * @tc.desc Invalid algorithm alg rsa for agree key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_39100', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_RSA);
+ agreeOption.inData = exportKeyRet.outData
+ hks.agreeKey(alias, agreeOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_39200
+ * @tc.name InvalidAlgorithmAlgEccForAgreeKeyCallback
+ * @tc.desc Invalid algorithm alg ecc for agree key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_39200', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECC);
+ agreeOption.inData = exportKeyRet.outData
+ hks.agreeKey(alias, agreeOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_39300
+ * @tc.name InvalidAlgorithmAlgDsaForAgreeKeyCallback
+ * @tc.desc Invalid algorithm alg dsa for agree key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_39300', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DSA);
+ agreeOption.inData = exportKeyRet.outData
+ hks.agreeKey(alias, agreeOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_39400
+ * @tc.name InvalidAlgorithmAlgAesForAgreeKeyCallback
+ * @tc.desc Invalid algorithm alg aes for agree key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_39400', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_AES);
+ agreeOption.properties[1].value = hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256;
+ agreeOption.inData = exportKeyRet.outData
+ hks.agreeKey(alias, agreeOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_39500
+ * @tc.name InvalidAlgorithmAlgHmacForAgreeKeyCallback
+ * @tc.desc Invalid algorithm alg hmac for agree key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_39500', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HMAC);
+ agreeOption.inData = exportKeyRet.outData
+ hks.agreeKey(alias, agreeOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_39600
+ * @tc.name InvalidAlgorithmAlgHkdfForAgreeKeyCallback
+ * @tc.desc Invalid algorithm alg hkdf for agree key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_39600', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF);
+ agreeOption.inData = exportKeyRet.outData
+ hks.agreeKey(alias, agreeOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_39700
+ * @tc.name InvalidAlgorithmAlgPbkdf2ForAgreeKeyCallback
+ * @tc.desc Invalid algorithm alg pbkdf2 for agree key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_39700', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_PBKDF2);
+ agreeOption.inData = exportKeyRet.outData
+ hks.agreeKey(alias, agreeOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_39800
+ * @tc.name InvalidAlgorithmAlgEd25519ForAgreeKeyCallback
+ * @tc.desc Invalid algorithm alg ed25519 for agree key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_39800', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ED25519);
+ agreeOption.properties[1].value = hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256;
+ agreeOption.inData = exportKeyRet.outData
+ hks.agreeKey(alias, agreeOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_39900
+ * @tc.name InvalidPurposeEncryptForMacCallback
+ * @tc.desc Invalid purpose encrypt for mac callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_39900', 0, async function (done) {
+ await hmacGenerateKey();
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT, hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ hks.mac(alias, macOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_40000
+ * @tc.name InvalidPurposeDecryptForMacCallback
+ * @tc.desc Invalid purpose decrypt for mac callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_40000', 0, async function (done) {
+ await hmacGenerateKey();
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ hks.mac(alias, macOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_40100
+ * @tc.name InvalidPurposeSignForMacCallback
+ * @tc.desc Invalid purpose sign for mac callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_40100', 0, async function (done) {
+ await hmacGenerateKey();
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ hks.mac(alias, macOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_40200
+ * @tc.name InvalidPurposeVerifyForMacCallback
+ * @tc.desc Invalid purpose verify for mac callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_40200', 0, async function (done) {
+ await hmacGenerateKey();
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ hks.mac(alias, macOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_40300
+ * @tc.name InvalidPurposeDeriveForMacCallback
+ * @tc.desc Invalid purpose derive for mac callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_40300', 0, async function (done) {
+ await hmacGenerateKey();
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ hks.mac(alias, macOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_40400
+ * @tc.name InvalidPurposeWrapForMacCallback
+ * @tc.desc Invalid purpose wrap for mac callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_40400', 0, async function (done) {
+ await hmacGenerateKey();
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ hks.mac(alias, macOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_40500
+ * @tc.name InvalidPurposeUnwrapForMacCallback
+ * @tc.desc Invalid purpose unwrap for mac callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_40500', 0, async function (done) {
+ await hmacGenerateKey();
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ hks.mac(alias, macOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_40600
+ * @tc.name InvalidPurposeAgreeForMacCallback
+ * @tc.desc Invalid purpose agree for mac callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_40600', 0, async function (done) {
+ await hmacGenerateKey();
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ hks.mac(alias, macOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_40700
+ * @tc.name InvalidDigestNoneForMacCallback
+ * @tc.desc Invalid digest none for mac callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_40700', 0, async function (done) {
+ await hmacGenerateKey();
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE);
+ hks.mac(alias, macOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_40800
+ * @tc.name InvalidDigestMd5ForMacCallback
+ * @tc.desc Invalid digest md5 for mac callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_40800', 0, async function (done) {
+ await hmacGenerateKey();
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ hks.HuksKeyDigest.HUKS_DIGEST_MD5);
+ hks.mac(alias, macOption, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
+ done();
+ });
+ });
+});
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part6.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part6.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..591e394f580233f955d8ea1f6b0fafc85aa8a638
--- /dev/null
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_callback_part6.test.js
@@ -0,0 +1,658 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hks from '@ohos.security.huks'
+import { describe, it, expect } from 'deccjsunit/index'
+import {
+ aliasA,
+ aliasB,
+} from '../../../../../../hks_xts_common.test'
+import {
+ generateImportKeyOption,
+ eccGenerateKeyOption,
+ importOptionsInvalidAlgOption,
+ importOptionsInvalidSizeOption,
+ importOptionsInvalidPurposeOrPaddingOption,
+} from './hks_abnormal_common.test.js'
+
+describe('Hks_Abnormal_Callback_Part6', function () {
+ var publicKey = [];
+
+ var emptyOption = makeEmptyOptions();
+
+ function makeEmptyOptions() {
+ var emptyOptions = {
+ properties: []
+ };
+ return emptyOptions;
+ };
+
+ async function generateKeyAndExportKey() {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ };
+ async function eccGenerateKey() {
+ var option = eccGenerateKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ };
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_40900
+ * @tc.name InvalidPurposeDeriveAlgRsaForImportKeyCallback
+ * @tc.desc Invalid purpose derive alg rsa for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_40900', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_41000
+ * @tc.name InvalidPurposeDeriveAlgEccForImportKeyCallback
+ * @tc.desc Invalid purpose derive alg ecc for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_41000', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_41100
+ * @tc.name InvalidPurposeDeriveAlgDsaForImportKeyCallback
+ * @tc.desc Invalid purpose derive alg dsa for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_41100', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_DSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_41200
+ * @tc.name InvalidPurposeDeriveAlgHkdfForImportKeyCallback
+ * @tc.desc Invalid purpose derive alg hkdf for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_41200', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_HKDF,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_41300
+ * @tc.name InvalidPurposeDeriveAlgPbkdf2ForImportKeyCallback
+ * @tc.desc Invalid purpose derive alg pbkdf2 for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_41300', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_PBKDF2,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_41400
+ * @tc.name InvalidPurposeDeriveAlgEcdhForImportKeyCallback
+ * @tc.desc Invalid purpose derive alg ecdh for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_41400', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECDH,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_41500
+ * @tc.name InvalidPurposeDeriveAlgX25519ForImportKeyCallback
+ * @tc.desc Invalid purpose derive alg x25519 for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_41500', 0, async function (done) {
+ await eccGenerateKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_X25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_41600
+ * @tc.name InvalidPurposeDeriveAlgEd25519ForImportKeyCallback
+ * @tc.desc Invalid purpose derive alg ed25519 for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_41600', 0, async function (done) {
+ await eccGenerateKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ED25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_41700
+ * @tc.name InvalidPurposeDeriveAlgDhForImportKeyCallback
+ * @tc.desc Invalid purpose derive alg dh for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_41700', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_DH,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_41800
+ * @tc.name InvalidPurposeMacAlgRsaForImportKeyCallback
+ * @tc.desc Invalid purpose mac alg rsa for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_41800', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_41900
+ * @tc.name InvalidPurposeMacAlgEccForImportKeyCallback
+ * @tc.desc Invalid purpose mac alg ecc for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_41900', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_42000
+ * @tc.name InvalidPurposeMacAlgDsaForImportKeyCallback
+ * @tc.desc Invalid purpose mac alg dsa for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_42000', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_DSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_42100
+ * @tc.name InvalidPurposeMacAlgHkdfForImportKeyCallback
+ * @tc.desc Invalid purpose mac alg hkdf for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_42100', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_HKDF,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_42200
+ * @tc.name InvalidPurposeMacAlgPbkdf2ForImportKeyCallback
+ * @tc.desc Invalid purpose mac alg pbkdf2 for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_42200', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_PBKDF2,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_42300
+ * @tc.name InvalidPurposeMacAlgEcdhForImportKeyCallback
+ * @tc.desc Invalid purpose mac alg ecdh for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_42300', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECDH,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_42400
+ * @tc.name InvalidPurposeMacAlgX25519ForImportKeyCallback
+ * @tc.desc Invalid purpose mac alg x25519 for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_42400', 0, async function (done) {
+ await eccGenerateKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_X25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_42500
+ * @tc.name InvalidPurposeMacAlgEd25519ForImportKeyCallback
+ * @tc.desc Invalid purpose mac alg ed25519 for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_42500', 0, async function (done) {
+ await eccGenerateKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ED25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_42600
+ * @tc.name InvalidPurposeMacAlgDhForImportKeyCallback
+ * @tc.desc Invalid purpose mac alg dh for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_42600', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_DH,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_42700
+ * @tc.name GenerateAndImportKeySizeDifferentAesForImportKeyCallback
+ * @tc.desc Generate key and import key have different key size aes for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_42700', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidSizeOption(hks.HuksKeyAlg.HUKS_ALG_AES, publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_42800
+ * @tc.name GenerateAndImportKeySizeDifferentRsaForImportKeyCallback
+ * @tc.desc Generate key and import key have different key size rsa for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_42800', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidSizeOption(hks.HuksKeyAlg.HUKS_ALG_RSA, publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_42900
+ * @tc.name GenerateAndImportKeySizeDifferentEccForImportKeyCallback
+ * @tc.desc Generate key and import key have different key size ecc for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_42900', 0, async function (done) {
+ var option = eccGenerateKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidSizeOption(hks.HuksKeyAlg.HUKS_ALG_ECC, publicKey);
+ importOptions.properties[1].value = hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521;
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_43000
+ * @tc.name InvalidPurposeDecryptForImportKeyCallback
+ * @tc.desc Invalid purpose decrypt for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_43000', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_43100
+ * @tc.name InvalidPurposeSignForImportKeyCallback
+ * @tc.desc Invalid purpose sign for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_43100', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_43200
+ * @tc.name InvalidPaddingNonePurposeEncryptForImportKeyCallback
+ * @tc.desc Invalid padding none purpose encrypt for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_43200', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var purpose = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT;
+ option.properties[2].value = purpose;
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PSS,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_43300
+ * @tc.name InvalidPaddingPkcs5PurposeEncryptForImportKeyCallback
+ * @tc.desc Invalid padding pkcs5 purpose encrypt for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_43300', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var purpose = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT;
+ option.properties[2].value = purpose;
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_43400
+ * @tc.name InvalidPaddingPkcs7PurposeEncryptForImportKeyCallback
+ * @tc.desc Invalid padding pkcs7 purpose encrypt for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_43400', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var purpose = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT;
+ option.properties[2].value = purpose;
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_43500
+ * @tc.name InvalidPaddingNonePurposeVerifyForImportKeyCallback
+ * @tc.desc Invalid padding none purpose verify for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_43500', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_43600
+ * @tc.name InvalidPaddingOaepPurposeVerifyForImportKeyCallback
+ * @tc.desc Invalid padding oaep purpose verify for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_43600', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_43700
+ * @tc.name InvalidPaddingPkcs5PurposeVerifyForImportKeyCallback
+ * @tc.desc Invalid padding pkcs5 purpose verify for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_43700', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_43800
+ * @tc.name InvalidPaddingPkcs7PurposeVerifyForImportKeyCallback
+ * @tc.desc Invalid padding pkcs7 purpose verify for import key callback.
+ */
+ it('HUKS_ABNORMAL_CALLBACK_43800', 0, async function (done) {
+ await generateKeyAndExportKey();
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ publicKey);
+ hks.importKey(aliasB, importOptions, function (err, data) {
+ expect(data.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+ });
+});
\ No newline at end of file
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_common.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_common.test.js
index 50909aafde312cfa8a2529936a501148093237f3..677bf8dde815ed20a72545d387047766608a417f 100644
--- a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_common.test.js
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_common.test.js
@@ -14,61 +14,72 @@
*/
import hks from '@ohos.security.huks'
-
+import {
+ makeGenerateKeyOption,
+ makeImportOption,
+ makeEncryptAndDecryptOption,
+ makeSignAndVerifyOption
+} from '../../../../../../hks_xts_common.test'
export var alias = 'alias';
export var aliasEmpty = '';
export var aliasTooLong = '01234567890123456789012345678901234567890123456789012345678901234';
export var aliasCritical = '0123456789012345678901234567890123456789012345678901234567890123';
export var aliasNotExist = 'aliasNotExist';
export var emptyOption = makeEmptyOption();
+export var plainTextSize128 = makeRandomArr(128);
export var plainTextSize64 = makeRandomArr(64);
+export var plainTextSize17 = makeRandomArr(17);
export var plainTextSize16 = makeRandomArr(16);
export var plainTextSize8 = makeRandomArr(8);
+export var plainTextSize4 = makeRandomArr(4);
export var invalidValue = 99999;
+export var inDataTooLong = makeRandomArr(1000);
+export var aliasStrange = '+++++++++++';
+export var invalidValueUint8Array = new Uint8Array(99999);
-export var generateAesCBCKeyOption = makeGenerateKeyOption(
- hks.HksKeyAlg.HKS_ALG_AES,
- hks.HksKeySize.HKS_AES_KEY_SIZE_128,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksCipherMode.HKS_MODE_CBC,
+export var generateAesCBCKeyOption = makeGenerateKeyOptionForAbnormal(
+ hks.HuksKeyAlg.HUKS_ALG_AES,
+ hks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ hks.HuksCipherMode.HUKS_MODE_CBC,
null
);
-export var generateAesGCMKeyOption = makeGenerateKeyOption(
- hks.HksKeyAlg.HKS_ALG_AES,
- hks.HksKeySize.HKS_AES_KEY_SIZE_128,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksCipherMode.HKS_MODE_GCM,
+export var generateAesGCMKeyOption = makeGenerateKeyOptionForAbnormal(
+ hks.HuksKeyAlg.HUKS_ALG_AES,
+ hks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ hks.HuksCipherMode.HUKS_MODE_GCM,
null
);
-export var generateRSAKeyOption = makeGenerateKeyOption(
- hks.HksKeyAlg.HKS_ALG_RSA,
- hks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | hks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- hks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
+export var generateRSAKeyOption = makeGenerateKeyOptionForAbnormal(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
null,
- hks.HksKeyDigest.HKS_DIGEST_SHA1
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1
);
-export var generateECCKeyOption = makeGenerateKeyOption(
- hks.HksKeyAlg.HKS_ALG_ECC,
- hks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
+export var generateECCKeyOption = makeGenerateKeyOptionForAbnormal(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
null,
null,
- hks.HksKeyDigest.HKS_DIGEST_NONE
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE
);
-export var generateMACKeyOption = makeGenerateKeyOption(
- hks.HksKeyAlg.HKS_ALG_HMAC,
+export var generateMACKeyOption = makeGenerateKeyOptionForAbnormal(
+ hks.HuksKeyAlg.HUKS_ALG_HMAC,
160,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
null,
null,
- hks.HksKeyDigest.HKS_DIGEST_SHA1
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1
);
export function makeEmptyOption() {
@@ -86,63 +97,63 @@ export function makeRandomArr(size) {
return arr;
};
-function makeAlgTag(alg){
+function makeAlgTag(alg) {
var tag = {
- tag: hks.HksTag.HKS_TAG_ALGORITHM,
+ tag: hks.HuksTag.HUKS_TAG_ALGORITHM,
value: alg
};
return tag;
};
-function makeSizeTag(size){
+function makeSizeTag(size) {
var tag = {
- tag: hks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: hks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
return tag;
};
-function makePurposeTag(purpose){
+function makePurposeTag(purpose) {
var tag = {
- tag: hks.HksTag.HKS_TAG_PURPOSE,
+ tag: hks.HuksTag.HUKS_TAG_PURPOSE,
value: purpose
};
return tag;
};
-function makePaddingTag(padding){
+function makePaddingTag(padding) {
var tag = {
- tag: hks.HksTag.HKS_TAG_PADDING,
+ tag: hks.HuksTag.HUKS_TAG_PADDING,
value: padding
};
return tag;
};
-function makeDigestTag(digest){
+function makeDigestTag(digest) {
var tag = {
- tag: hks.HksTag.HKS_TAG_DIGEST,
+ tag: hks.HuksTag.HUKS_TAG_DIGEST,
value: digest
};
return tag;
};
-function makeModeTag(mode){
+function makeModeTag(mode) {
var tag = {
- tag: hks.HksTag.HKS_TAG_BLOCK_MODE,
+ tag: hks.HuksTag.HUKS_TAG_BLOCK_MODE,
value: mode
};
return tag;
};
-export function makeGenerateKeyOption(alg, size, purpose, padding, mode, digest) {
+export function makeGenerateKeyOptionForAbnormal(alg, size, purpose, padding, mode, digest) {
var properties = new Array();
properties[0] = makeAlgTag(alg);
properties[1] = makeSizeTag(size);
properties[2] = makePurposeTag(purpose);
- if (purpose == (hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT)) {
+ if (purpose == (hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT)) {
properties[3] = makePaddingTag(padding);
properties[4] = makeModeTag(mode);
- } else if (purpose == (hks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | hks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY)) {
+ } else if (purpose == (hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY)) {
properties[3] = makePaddingTag(padding);
properties[4] = makeDigestTag(digest);
} else {
@@ -154,24 +165,25 @@ export function makeGenerateKeyOption(alg, size, purpose, padding, mode, digest)
return option;
};
-export function makeEncryptAndDecryptOption(mode){
+export function makeEncryptAndDecryptOptionForAbnormal(mode) {
var properties = new Array();
- properties[0] = makeAlgTag(hks.HksKeyAlg.HKS_ALG_AES);
- properties[1] = makePurposeTag(hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT);
+ var purpose = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT;
+ properties[0] = makeAlgTag(hks.HuksKeyAlg.HUKS_ALG_AES);
+ properties[1] = makePurposeTag(purpose);
properties[2] = makeModeTag(mode);
- properties[3] = makePaddingTag(hks.HksKeyPadding.HKS_PADDING_NONE);
- if (mode == hks.HksCipherMode.HKS_MODE_CBC) {
+ properties[3] = makePaddingTag(hks.HuksKeyPadding.HUKS_PADDING_NONE);
+ if (mode == hks.HuksCipherMode.HUKS_MODE_CBC) {
properties[4] = {
- tag: hks.HksTag.HKS_TAG_IV,
+ tag: hks.HuksTag.HUKS_TAG_IV,
value: new Uint8Array(16)
};
} else {
properties[4] = {
- tag: hks.HksTag.HKS_TAG_NONCE,
+ tag: hks.HuksTag.HUKS_TAG_NONCE,
value: new Uint8Array(16)
};
properties[5] = {
- tag: hks.HksTag.HKS_TAG_ASSOCIATED_DATA,
+ tag: hks.HuksTag.HUKS_TAG_ASSOCIATED_DATA,
value: new Uint8Array(16)
};
}
@@ -182,12 +194,12 @@ export function makeEncryptAndDecryptOption(mode){
return option;
};
-export function makeSignVerifyAndImportOption(text){
+export function makeSignVerifyAndImportOption(text) {
var properties = new Array();
- properties[0] = makeAlgTag(hks.HksKeyAlg.HKS_ALG_RSA);
- properties[1] = makePurposeTag(hks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | hks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY);
- properties[2] = makePaddingTag(hks.HksKeyPadding.HKS_PADDING_NONE);
- properties[3] = makeDigestTag(hks.HksKeyDigest.HKS_DIGEST_SHA1);
+ properties[0] = makeAlgTag(hks.HuksKeyAlg.HUKS_ALG_RSA);
+ properties[1] = makePurposeTag(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY);
+ properties[2] = makePaddingTag(hks.HuksKeyPadding.HUKS_PADDING_NONE);
+ properties[3] = makeDigestTag(hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
var option = {
properties: properties,
inData: text
@@ -197,8 +209,8 @@ export function makeSignVerifyAndImportOption(text){
export function makeAgreeOption() {
var properties = new Array();
- properties[0] = makeAlgTag(hks.HksKeyAlg.HKS_ALG_ECDH);
- properties[1] = makeSizeTag(hks.HksKeySize.HKS_ECC_KEY_SIZE_224);
+ properties[0] = makeAlgTag(hks.HuksKeyAlg.HUKS_ALG_ECDH);
+ properties[1] = makeSizeTag(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
var options = {
properties: properties,
inData: new Uint8Array(76)
@@ -209,12 +221,12 @@ export function makeAgreeOption() {
export function makeMacOption() {
var properties = new Array();
properties[0] = {
- tag: hks.HksTag.HKS_TAG_PURPOSE,
- value: hks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC
+ tag: hks.HuksTag.HUKS_TAG_PURPOSE,
+ value: hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC
};
properties[1] = {
- tag: hks.HksTag.HKS_TAG_DIGEST,
- value: hks.HksKeyDigest.HKS_DIGEST_SHA1
+ tag: hks.HuksTag.HUKS_TAG_DIGEST,
+ value: hks.HuksKeyDigest.HUKS_DIGEST_SHA1
};
var options = {
properties: properties,
@@ -222,3 +234,557 @@ export function makeMacOption() {
};
return options;
};
+
+export function makeAgreeAlgOptions(alg) {
+ var properties = new Array();
+ properties[0] = makeAlgTag(alg);
+ properties[1] = makeSizeTag(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ var options = {
+ properties: properties,
+ inData: new Uint8Array(76)
+ };
+ return options;
+};
+
+export function makeMacOptions(purpose, digest) {
+ var properties = new Array();
+ properties[0] = {
+ tag: hks.HuksTag.HUKS_TAG_PURPOSE,
+ value: purpose
+ };
+ properties[1] = {
+ tag: hks.HuksTag.HUKS_TAG_DIGEST,
+ value: digest
+ };
+ var options = {
+ properties: properties,
+ inData: plainTextSize16
+ };
+ return options;
+};
+
+export function generateAgreeKeyOption() {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
+ null,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA224
+ );
+ return option;
+};
+
+export function hmacGenerateKeyOption() {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_HMAC,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ null,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1
+ );
+ return option;
+};
+
+export function agreeInvalidAlgOption(alg) {
+ var option = makeAgreeAlgOptions(
+ alg
+ );
+ return option;
+};
+
+export function hmacInvalidPurposeOption(purpose, digest) {
+ var option = makeMacOptions(
+ purpose,
+ digest
+ );
+ return option;
+};
+
+export function encryptOrDecryptGenerateKeyOption() {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1
+ );
+ return option;
+};
+
+export function encryptOrDecryptOption() {
+ var option = makeEncryptAndDecryptOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1,
+ plainTextSize16
+ );
+ return option;
+};
+
+export function encryptOrDecryptInvalidAlgOption(alg) {
+ var option = makeEncryptAndDecryptOption(
+ alg,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ plainTextSize16
+ );
+ return option;
+};
+
+export function rsaEncryptInvalidSizeOption(size) {
+ var option = makeEncryptAndDecryptOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ size,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1,
+ plainTextSize4
+ );
+ return option;
+};
+
+export function aesEncryptOrDecryptInvalidSizeOption(size) {
+ var option = makeEncryptAndDecryptOption(
+ hks.HuksKeyAlg.HUKS_ALG_AES,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ hks.HuksCipherMode.HUKS_MODE_CBC,
+ size,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ plainTextSize16
+ );
+ return option;
+};
+
+export function aesEncryptOrDecryptInvalidPaddingOption(padding) {
+ var option = makeEncryptAndDecryptOption(
+ hks.HuksKeyAlg.HUKS_ALG_AES,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ padding,
+ hks.HuksCipherMode.HUKS_MODE_GCM,
+ hks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ plainTextSize64
+ );
+ return option;
+};
+
+export function aesEncryptOrDecryptInvalidDigestOption(digest) {
+ var option = makeEncryptAndDecryptOption(
+ hks.HuksKeyAlg.HUKS_ALG_AES,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ hks.HuksCipherMode.HUKS_MODE_CBC,
+ hks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ digest,
+ plainTextSize16
+ );
+ return option;
+};
+
+export function rsaEncryptOrDecryptInvalidIndataOption() {
+ var option = makeEncryptAndDecryptOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ plainTextSize128
+ );
+ return option;
+};
+
+export function aesEncryptOrDecryptInvalidIndataOption() {
+ var option = makeEncryptAndDecryptOption(
+ hks.HuksKeyAlg.HUKS_ALG_AES,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ hks.HuksCipherMode.HUKS_MODE_GCM,
+ hks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ plainTextSize17
+ );
+ return option;
+};
+
+export function aesEncryptOrDecryptInvalidPurposeOption(purpose) {
+ var option = makeEncryptAndDecryptOption(
+ hks.HuksKeyAlg.HUKS_ALG_AES,
+ purpose,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ hks.HuksCipherMode.HUKS_MODE_GCM,
+ hks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ plainTextSize64
+ );
+ return option;
+};
+
+export function rsaDecryptInvalidSizeOption(size, cipherText) {
+ var option = makeEncryptAndDecryptOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ size,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1,
+ cipherText
+ );
+ return option;
+};
+
+export function aesGenerateKeyInvalidSizeOption(size) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_AES,
+ size,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE
+ );
+ return option;
+};
+
+export function aesGenerateKeyInvalidModeOption(mode, padding) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_AES,
+ hks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ padding,
+ mode,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE
+ );
+ return option;
+};
+
+export function aesGenerateKeyInvalidAlgOption(alg, purpose) {
+ var option = makeGenerateKeyOption(
+ alg,
+ hks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ purpose,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE
+ );
+ return option;
+};
+
+export var aesGenerateKeyInvalidPurposeOption = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_AES,
+ hks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE
+);
+
+export function rsaGenerateKeyInvalidSizeOption(size) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ size,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1
+ );
+ return option;
+};
+
+export function rsaGenerateKeyInvalidPaddingOption(purpose, padding) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ purpose,
+ padding,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1
+ );
+ return option;
+};
+
+export var rsaGenerateKeyInvalidPurposeOption = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1
+);
+
+export function eccGenerateKeyInvalidSizeOption(size) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ size,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA224
+ );
+ return option;
+};
+
+export function eccGenerateKeyInvalidDigestOption(digest) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ digest
+ );
+ return option;
+};
+
+export function eccGenerateKeyInvalidPurposeOption(purpose) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ purpose,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA224
+ );
+ return option;
+};
+
+export function ecdhGenerateKeyInvalidAlgOption() {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECDH,
+ hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA224
+ );
+ return option;
+};
+
+export function hkdfGenerateKeyInvalidAlgOption() {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_HKDF,
+ hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA224
+ );
+ return option;
+};
+
+export function pbkdf2GenerateKeyInvalidAlgOption() {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_PBKDF2,
+ hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA224
+ );
+ return option;
+};
+
+export function ed25519GenerateKeyInvalidPurposeOption(purpose) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_ED25519,
+ hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256,
+ purpose,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE
+ );
+ return option;
+};
+
+export function x25519GenerateKeyInvalidPurposeOption(purpose) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_X25519,
+ hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256,
+ purpose,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE
+ );
+ return option;
+};
+
+export function hmacGenerateKeyInvalidSizeOption(size) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_HMAC,
+ size,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA256
+ );
+ return option;
+};
+
+export function hmacGenerateKeyInvalidPurposeOption(purpose) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_HMAC,
+ hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ purpose,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA256
+ );
+ return option;
+};
+
+export function dsaGenerateKeyInvalidSizeOption(size) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_DSA,
+ size,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1
+ );
+ return option;
+};
+
+export function dsaGenerateKeyInvalidPurposeOption(purpose) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_DSA,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ purpose,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1
+ );
+ return option;
+};
+
+export function dhGenerateKeyInvalidPurposeOption(purpose) {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_DH,
+ hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048,
+ purpose,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1
+ );
+ return option;
+};
+
+export function generateImportKeyOption() {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_MD5
+ );
+ return option;
+};
+
+export function eccGenerateKeyOption() {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ null,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA224
+ );
+ return option;
+};
+
+export function importOptionsInvalidAlgOption(alg, purpose, publicKey) {
+ var option = makeImportOption(
+ alg,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ purpose,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ publicKey
+ );
+ return option;
+};
+
+export function importOptionsInvalidSizeOption(alg, publicKey) {
+ var option = makeImportOption(
+ alg,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ publicKey
+ );
+ return option;
+};
+
+export function importOptionsInvalidPurposeOrPaddingOption(purpose, padding, publicKey) {
+ var option = makeImportOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ purpose,
+ padding,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ publicKey
+ );
+ return option;
+};
+
+export function signOrVerifyGenerateKeyOption() {
+ var option = makeGenerateKeyOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE
+ );
+ return option;
+};
+
+export function signOrVerifyInvalidAlgOption(alg) {
+ var option = makeSignAndVerifyOption(
+ alg,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ plainTextSize64
+ );
+ return option;
+};
+
+export function signOrVerifyInvalidPurposeOption(purpose) {
+ var option = makeSignAndVerifyOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ purpose,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ plainTextSize64
+ );
+ return option;
+};
+
+export function signOrVerifyInvalidPaddingOption(padding) {
+ var option = makeSignAndVerifyOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ padding,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE,
+ plainTextSize64
+ );
+ return option;
+};
\ No newline at end of file
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part1.test.js
similarity index 51%
rename from security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise.test.js
rename to security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part1.test.js
index d4afc8f2d9dc197fb9a2dc2a32b1c3d6bd7a8df5..6fd66247c2773bde33c2fdaf989b9764769e65a5 100644
--- a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise.test.js
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part1.test.js
@@ -14,7 +14,7 @@
*/
import hks from '@ohos.security.huks'
-import {describe, it, expect} from 'deccjsunit/index'
+import { describe, it, expect } from 'deccjsunit/index'
import {
alias,
aliasEmpty,
@@ -32,14 +32,17 @@ import {
plainTextSize16,
plainTextSize64,
makeAgreeOption,
- makeEncryptAndDecryptOption,
+ makeEncryptAndDecryptOptionForAbnormal,
makeMacOption,
- makeSignVerifyAndImportOption
+ makeSignVerifyAndImportOption,
+ inDataTooLong,
+ aliasStrange,
+ invalidValueUint8Array
} from './hks_abnormal_common.test.js'
-describe('Hks_XtsTest_Abnormal_Promise', function () {
+describe('Hks_Abnormal_Promise_Part1', function () {
- async function generateAesKey(mode){
+ async function generateAesKey(mode) {
var option = {};
if (mode == 'CBC') {
option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
@@ -47,1379 +50,1476 @@ describe('Hks_XtsTest_Abnormal_Promise', function () {
option = JSON.parse(JSON.stringify(generateAesGCMKeyOption));
}
var ret = await hks.generateKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
};
- async function deleteKeyPromise(alias, done){
+ async function deleteKeyPromise(alias, done) {
var ret = await hks.deleteKey(alias, emptyOption);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
done();
};
- async function generateRsaKey(){
+ async function generateRsaKey() {
var option = generateRSAKeyOption;
var ret = await hks.generateKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
};
- async function generateEccKey(){
+ async function generateEccKey() {
var option = generateECCKeyOption;
var ret = await hks.generateKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
};
- async function generateMacKey(){
+ async function generateMacKey() {
var option = generateMACKeyOption;
var ret = await hks.generateKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
};
/**
* @tc.number HUKS_ABNORMAL_PROMISE_00100
- * @tc.name HUKS_ABNORMAL_PROMISE_00100
- * @tc.desc Abnormal with promise.
+ * @tc.name GenerateKeyPromiseEmptyAlias
+ * @tc.desc Generate key promise with empty alias.
*/
it('HUKS_ABNORMAL_PROMISE_00100', 0, async function (done) {
var genKeyRet = await hks.generateKey(aliasEmpty, generateAesCBCKeyOption);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_00200
- * @tc.name HUKS_ABNORMAL_PROMISE_00200
- * @tc.desc Abnormal with promise.
+ * @tc.name GenerateKeyPromiseCriticalAlias
+ * @tc.desc Generate key promise with critical length alias.
*/
it('HUKS_ABNORMAL_PROMISE_00200', 0, async function (done) {
var genKeyRet = await hks.generateKey(aliasCritical, generateAesCBCKeyOption);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
var deleteKeyRet = await hks.deleteKey(aliasCritical, emptyOption);
- expect(deleteKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_SUCCESS);
+ expect(deleteKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_00300
- * @tc.name HUKS_ABNORMAL_PROMISE_00300
- * @tc.desc Abnormal with promise.
+ * @tc.name GenerateKeyPromiseLongAlias
+ * @tc.desc Generate key promise with too long alias.
*/
it('HUKS_ABNORMAL_PROMISE_00300', 0, async function (done) {
var genKeyRet = await hks.generateKey(aliasTooLong, generateAesCBCKeyOption);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_00400
- * @tc.name HUKS_ABNORMAL_PROMISE_00400
- * @tc.desc Abnormal with promise.
+ * @tc.name GenerateKeyPromiseLackAlgTag
+ * @tc.desc Generate key promise lack of alg tag.
*/
it('HUKS_ABNORMAL_PROMISE_00400', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties.splice(0, 1);
var genKeyRet = await hks.generateKey(alias, option);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_00500
- * @tc.name HUKS_ABNORMAL_PROMISE_00500
- * @tc.desc Abnormal with promise.
+ * @tc.name GenerateKeyPromiseLackSizeTag
+ * @tc.desc Generate key promise lack of size tag.
*/
it('HUKS_ABNORMAL_PROMISE_00500', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties.splice(1, 1);
var genKeyRet = await hks.generateKey(alias, option);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_00600
- * @tc.name HUKS_ABNORMAL_PROMISE_00600
- * @tc.desc Abnormal with promise.
+ * @tc.name GenerateKeyPromiseLackPurposeTag
+ * @tc.desc Generate key promise lack of purpose tag.
*/
it('HUKS_ABNORMAL_PROMISE_00600', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties.splice(2, 1);
var genKeyRet = await hks.generateKey(alias, option);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PURPOSE_FAIL);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PURPOSE_FAIL);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_00700
- * @tc.name HUKS_ABNORMAL_PROMISE_00700
- * @tc.desc Abnormal with promise.
+ * @tc.name GenerateKeyPromiseLackPaddingTag
+ * @tc.desc Generate key promise lack of padding tag.
*/
it('HUKS_ABNORMAL_PROMISE_00700', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties.splice(3, 1);
var genKeyRet = await hks.generateKey(alias, option);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PADDING_FAIL);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PADDING_FAIL);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_00800
- * @tc.name HUKS_ABNORMAL_PROMISE_00800
- * @tc.desc Abnormal with promise.
+ * @tc.name GenerateKeyPromiseLackModeTag
+ * @tc.desc Generate key promise lack of mode tag.
*/
it('HUKS_ABNORMAL_PROMISE_00800', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties.splice(4, 1);
var genKeyRet = await hks.generateKey(alias, option);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_MODE_FAIL);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_MODE_FAIL);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_00900
- * @tc.name HUKS_ABNORMAL_PROMISE_00900
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidAlgTagForGeneratingKeyPromise
+ * @tc.desc Invalid value of alg tag for generating key promise.
*/
it('HUKS_ABNORMAL_PROMISE_00900', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties[0].value = invalidValue;
var genKeyRet = await hks.generateKey(alias, option);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_01000
- * @tc.name HUKS_ABNORMAL_PROMISE_01000
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidSizeTagForGeneratingKeyPromise
+ * @tc.desc Invalid value of size tag for generating key promise.
*/
it('HUKS_ABNORMAL_PROMISE_01000', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties[1].value = invalidValue;
var genKeyRet = await hks.generateKey(alias, option);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_KEY_SIZE);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_01100
- * @tc.name HUKS_ABNORMAL_PROMISE_01100
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPurposeTagForGeneratingKeyPromise
+ * @tc.desc Invalid value of purpose tag for generating key promise.
*/
it('HUKS_ABNORMAL_PROMISE_01100', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties[2].value = invalidValue;
var genKeyRet = await hks.generateKey(alias, option);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_PURPOSE);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_01200
- * @tc.name HUKS_ABNORMAL_PROMISE_01200
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPaddingTagForGeneratingKeyPromise
+ * @tc.desc Invalid value of padding tag for generating key promise.
*/
it('HUKS_ABNORMAL_PROMISE_01200', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties[3].value = invalidValue;
var genKeyRet = await hks.generateKey(alias, option);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_PADDING);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_01300
- * @tc.name HUKS_ABNORMAL_PROMISE_01300
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidModeTagForGeneratingKeyPromise
+ * @tc.desc Invalid value of mode tag for generating key promise.
*/
it('HUKS_ABNORMAL_PROMISE_01300', 0, async function (done) {
var option = JSON.parse(JSON.stringify(generateAesCBCKeyOption));
option.properties[4].value = invalidValue;
var genKeyRet = await hks.generateKey(alias, option);
- expect(genKeyRet.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_MODE);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_MODE);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_01400
- * @tc.name HUKS_ABNORMAL_PROMISE_01400
- * @tc.desc Abnormal with promise.
+ * @tc.name DeletekeyPromiseNotExistAlias
+ * @tc.desc Delete key promise with not exist alias.
*/
it('HUKS_ABNORMAL_PROMISE_01400', 0, async function (done) {
var ret = await hks.deleteKey(aliasNotExist, emptyOption);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_01500
- * @tc.name HUKS_ABNORMAL_PROMISE_01500
- * @tc.desc Abnormal with promise.
+ * @tc.name DeletekeyPromiseEmptyAlias
+ * @tc.desc Delete key promise with empty alias.
*/
it('HUKS_ABNORMAL_PROMISE_01500', 0, async function (done) {
var ret = await hks.deleteKey(aliasEmpty, emptyOption);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_01600
- * @tc.name HUKS_ABNORMAL_PROMISE_01600
- * @tc.desc Abnormal with promise.
+ * @tc.name DeletekeyPromiseLongAlias
+ * @tc.desc Delete key promise with too long alias.
*/
it('HUKS_ABNORMAL_PROMISE_01600', 0, async function (done) {
var ret = await hks.deleteKey(aliasTooLong, emptyOption);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_01700
- * @tc.name HUKS_ABNORMAL_PROMISE_01700
- * @tc.desc Abnormal with promise.
+ * @tc.name EncryptPromiseEmptyAlias
+ * @tc.desc Encrypt promise with empty alias.
*/
it('HUKS_ABNORMAL_PROMISE_01700', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
var ret = await hks.encrypt(aliasEmpty, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_01800
- * @tc.name HUKS_ABNORMAL_PROMISE_01800
- * @tc.desc Abnormal with promise.
+ * @tc.name EncryptPromiseNotExistAlias
+ * @tc.desc Encrypt promise with not exist alias.
*/
it('HUKS_ABNORMAL_PROMISE_01800', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
var ret = await hks.encrypt(aliasNotExist, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_01900
- * @tc.name HUKS_ABNORMAL_PROMISE_01900
- * @tc.desc Abnormal with promise.
+ * @tc.name EncryptPromiseCriticalAlias
+ * @tc.desc Encrypt promise with critical length alias.
*/
it('HUKS_ABNORMAL_PROMISE_01900', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
- var ret = await hks.encrypt(aliasTooLong, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
+ var ret = await hks.encrypt(aliasCritical, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_02000
- * @tc.name HUKS_ABNORMAL_PROMISE_02000
- * @tc.desc Abnormal with promise.
+ * @tc.name EncryptPromiseLongAlias
+ * @tc.desc Encrypt promise with too long alias.
*/
it('HUKS_ABNORMAL_PROMISE_02000', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
var ret = await hks.encrypt(aliasTooLong, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_02100
- * @tc.name HUKS_ABNORMAL_PROMISE_02100
- * @tc.desc Abnormal with promise.
+ * @tc.name EncryptPromiseLackAlgTag
+ * @tc.desc Encrypt promise lack of alg tag.
*/
it('HUKS_ABNORMAL_PROMISE_02100', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(0, 1);
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_02200
- * @tc.name HUKS_ABNORMAL_PROMISE_02200
- * @tc.desc Abnormal with promise.
+ * @tc.name EncryptPromiseLackPurposeTag
+ * @tc.desc Encrypt promise lack of purpose tag.
*/
it('HUKS_ABNORMAL_PROMISE_02200', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(1, 1);
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PURPOSE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PURPOSE_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_02300
- * @tc.name HUKS_ABNORMAL_PROMISE_02300
- * @tc.desc Abnormal with promise.
+ * @tc.name EncryptPromiseLackModeTag
+ * @tc.desc Encrypt promise lack of mode tag.
*/
it('HUKS_ABNORMAL_PROMISE_02300', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(2, 1);
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_MODE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_MODE_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_02400
- * @tc.name HUKS_ABNORMAL_PROMISE_02400
- * @tc.desc Abnormal with promise.
+ * @tc.name EncryptPromiseLackPaddingTag
+ * @tc.desc Encrypt promise lack of padding tag.
*/
it('HUKS_ABNORMAL_PROMISE_02400', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(3, 1);
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PADDING_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PADDING_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_02500
- * @tc.name HUKS_ABNORMAL_PROMISE_02500
- * @tc.desc Abnormal with promise.
+ * @tc.name EncryptPromiseLackIvTag
+ * @tc.desc Encrypt promise lack of iv tag.
*/
it('HUKS_ABNORMAL_PROMISE_02500', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(4, 1);
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_IV_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_IV_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_02600
- * @tc.name HUKS_ABNORMAL_PROMISE_02600
- * @tc.desc Abnormal with promise.
+ * @tc.name EncryptPromiseLackNonceTag
+ * @tc.desc Encrypt promise lack of nonce tag.
*/
it('HUKS_ABNORMAL_PROMISE_02600', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.properties.splice(4, 1);
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_NONCE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_NONCE_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_02700
- * @tc.name HUKS_ABNORMAL_PROMISE_02700
- * @tc.desc Abnormal with promise.
+ * @tc.name EncryptPromiseLackAssociatedDataTag
+ * @tc.desc Encrypt promise lack of associated data tag.
*/
it('HUKS_ABNORMAL_PROMISE_02700', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.properties.splice(5, 1);
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_AAD_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_AAD_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_02800
- * @tc.name HUKS_ABNORMAL_PROMISE_02800
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidAlgTagForEncryptPromise
+ * @tc.desc Invalid value of alg tag for encrypt promise.
*/
it('HUKS_ABNORMAL_PROMISE_02800', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[0].value = invalidValue;
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_02900
- * @tc.name HUKS_ABNORMAL_PROMISE_02900
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPurposeTagForEncryptPromise
+ * @tc.desc Invalid value of purpose tag for encrypt promise.
*/
it('HUKS_ABNORMAL_PROMISE_02900', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[1].value = invalidValue;
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_03000
- * @tc.name HUKS_ABNORMAL_PROMISE_03000
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidModeTagForEncryptPromise
+ * @tc.desc Invalid value of mode tag for encrypt promise.
*/
it('HUKS_ABNORMAL_PROMISE_03000', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[2].value = invalidValue;
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_MODE);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_MODE);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_03100
- * @tc.name HUKS_ABNORMAL_PROMISE_03100
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPaddingTagForEncryptPromise
+ * @tc.desc Invalid value of padding tag for encrypt promise.
*/
it('HUKS_ABNORMAL_PROMISE_03100', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[3].value = invalidValue;
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_PADDING);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_03200
- * @tc.name HUKS_ABNORMAL_PROMISE_03200
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidIndataOfOptionForEncryptPromise
+ * @tc.desc Invalid indata of option for encrypt promise.
*/
it('HUKS_ABNORMAL_PROMISE_03200', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.inData = new Uint8Array(0);
var ret = await hks.encrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_03300
- * @tc.name HUKS_ABNORMAL_PROMISE_03300
- * @tc.desc Abnormal with promise.
+ * @tc.name DecryptPromiseEmptyAlias
+ * @tc.desc Decrypt promise with empty alias.
*/
it('HUKS_ABNORMAL_PROMISE_03300', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
var ret = await hks.decrypt(aliasEmpty, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_03400
- * @tc.name HUKS_ABNORMAL_PROMISE_03400
- * @tc.desc Abnormal with promise.
+ * @tc.name DecryptPromiseNotExistAlias
+ * @tc.desc Decrypt promise with not exist alias.
*/
it('HUKS_ABNORMAL_PROMISE_03400', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
var ret = await hks.decrypt(aliasNotExist, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_03500
- * @tc.name HUKS_ABNORMAL_PROMISE_03500
- * @tc.desc Abnormal with promise.
+ * @tc.name DecryptPromiseCriticalAlias
+ * @tc.desc Decrypt promise with critical length alias.
*/
it('HUKS_ABNORMAL_PROMISE_03500', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
- var ret = await hks.decrypt(aliasTooLong, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
+ var ret = await hks.decrypt(aliasCritical, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_03600
- * @tc.name HUKS_ABNORMAL_PROMISE_03600
- * @tc.desc Abnormal with promise.
+ * @tc.name DecryptPromiseLongAlias
+ * @tc.desc Decrypt promise with too long alias.
*/
it('HUKS_ABNORMAL_PROMISE_03600', 0, async function (done) {
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
var ret = await hks.decrypt(aliasTooLong, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_03700
- * @tc.name HUKS_ABNORMAL_PROMISE_03700
- * @tc.desc Abnormal with promise.
+ * @tc.name DecryptPromiseLackAlgTag
+ * @tc.desc Decrypt promise lack of alg tag.
*/
it('HUKS_ABNORMAL_PROMISE_03700', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(0, 1);
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_03800
- * @tc.name HUKS_ABNORMAL_PROMISE_03800
- * @tc.desc Abnormal with promise.
+ * @tc.name DecryptPromiseLackPurposeTag
+ * @tc.desc Decrypt promise lack of purpose tag.
*/
it('HUKS_ABNORMAL_PROMISE_03800', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(1, 1);
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PURPOSE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PURPOSE_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_03900
- * @tc.name HUKS_ABNORMAL_PROMISE_03900
- * @tc.desc Abnormal with promise.
+ * @tc.name DecryptPromiseLackModeTag
+ * @tc.desc Decrypt promise lack of mode tag.
*/
it('HUKS_ABNORMAL_PROMISE_03900', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(2, 1);
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_MODE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_MODE_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_04000
- * @tc.name HUKS_ABNORMAL_PROMISE_04000
- * @tc.desc Abnormal with promise.
+ * @tc.name DecryptPromiseLackPaddingTag
+ * @tc.desc Decrypt promise lack of padding tag.
*/
it('HUKS_ABNORMAL_PROMISE_04000', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(3, 1);
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PADDING_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PADDING_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_04100
- * @tc.name HUKS_ABNORMAL_PROMISE_04100
- * @tc.desc Abnormal with promise.
+ * @tc.name DecryptPromiseLackIvTag
+ * @tc.desc Decrypt promise lack of iv tag.
*/
it('HUKS_ABNORMAL_PROMISE_04100', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties.splice(4, 1);
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_IV_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_IV_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_04200
- * @tc.name HUKS_ABNORMAL_PROMISE_04200
- * @tc.desc Abnormal with promise.
+ * @tc.name DecryptPromiseLackNonceTag
+ * @tc.desc Decrypt promise lack of nonce tag.
*/
it('HUKS_ABNORMAL_PROMISE_04200', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.properties.splice(4, 1);
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_NONCE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_NONCE_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_04300
- * @tc.name HUKS_ABNORMAL_PROMISE_04300
- * @tc.desc Abnormal with promise.
+ * @tc.name DecryptPromiseLackAssociatedDataTag
+ * @tc.desc Decrypt promise lack of associated data tag.
*/
it('HUKS_ABNORMAL_PROMISE_04300', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.properties.splice(5, 1);
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_AAD_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_AAD_FAIL);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_04400
- * @tc.name HUKS_ABNORMAL_PROMISE_04400
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidAlgTagForDecryptPromise
+ * @tc.desc Invalid value of alg tag for decrypt promise.
*/
it('HUKS_ABNORMAL_PROMISE_04400', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[0].value = invalidValue;
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_04500
- * @tc.name HUKS_ABNORMAL_PROMISE_04500
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPurposeTagForDecryptPromise
+ * @tc.desc Invalid value of purpose tag for decrypt promise.
*/
it('HUKS_ABNORMAL_PROMISE_04500', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[1].value = invalidValue;
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_04600
- * @tc.name HUKS_ABNORMAL_PROMISE_04600
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidModeTagForDecryptPromise
+ * @tc.desc Invalid value of mode tag for decrypt promise.
*/
it('HUKS_ABNORMAL_PROMISE_04600', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[2].value = invalidValue;
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_MODE);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_MODE);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_04700
- * @tc.name HUKS_ABNORMAL_PROMISE_04700
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPaddingTagForDecryptPromise
+ * @tc.desc Invalid value of padding tag for decrypt promise.
*/
it('HUKS_ABNORMAL_PROMISE_04700', 0, async function (done) {
await generateAesKey('CBC');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_CBC);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
option.properties[3].value = invalidValue;
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_PADDING);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_04800
- * @tc.name HUKS_ABNORMAL_PROMISE_04800
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidIndataOfOptionForDecryptPromise
+ * @tc.desc Invalid indata of option for decrypt promise.
*/
it('HUKS_ABNORMAL_PROMISE_04800', 0, async function (done) {
await generateAesKey('GCM');
- var option = makeEncryptAndDecryptOption(hks.HksCipherMode.HKS_MODE_GCM);
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
option.inData = new Uint8Array(0);
var ret = await hks.decrypt(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_04900
- * @tc.name HUKS_ABNORMAL_PROMISE_04900
- * @tc.desc Abnormal with promise.
+ * @tc.name ImportKeyPromiseEmptyAlias
+ * @tc.desc Import key promise with empty alias.
*/
it('HUKS_ABNORMAL_PROMISE_04900', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
var ret = await hks.importKey(aliasEmpty, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_05000
- * @tc.name HUKS_ABNORMAL_PROMISE_05000
- * @tc.desc Abnormal with promise.
+ * @tc.name ImportKeyPromiseCriticalAlias
+ * @tc.desc Import key promise with critical length alias.
*/
it('HUKS_ABNORMAL_PROMISE_05000', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
var ret = await hks.importKey(aliasCritical, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_05100
- * @tc.name HUKS_ABNORMAL_PROMISE_05100
- * @tc.desc Abnormal with promise.
+ * @tc.name ImportKeyPromiseLongAlias
+ * @tc.desc Import key promise with too long alias.
*/
it('HUKS_ABNORMAL_PROMISE_05100', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
var ret = await hks.importKey(aliasTooLong, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_05200
- * @tc.name HUKS_ABNORMAL_PROMISE_05200
- * @tc.desc Abnormal with promise.
+ * @tc.name ImportKeyPromiseLackAlgTag
+ * @tc.desc Import key promise lack of alg tag.
*/
it('HUKS_ABNORMAL_PROMISE_05200', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(0, 1);
var ret = await hks.importKey(aliasNotExist, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
done()
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_05300
- * @tc.name HUKS_ABNORMAL_PROMISE_05300
- * @tc.desc Abnormal with promise.
+ * @tc.name ImportKeyPromiseLackPurposeTag
+ * @tc.desc Import key promise lack of purpose tag.
*/
it('HUKS_ABNORMAL_PROMISE_05300', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(1, 1);
var ret = await hks.importKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_05400
- * @tc.name HUKS_ABNORMAL_PROMISE_05400
- * @tc.desc Abnormal with promise.
+ * @tc.name ImportKeyPromiseLackPaddingTag
+ * @tc.desc Import key promise lack of padding tag.
*/
it('HUKS_ABNORMAL_PROMISE_05400', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(2, 1);
var ret = await hks.importKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_05500
- * @tc.name HUKS_ABNORMAL_PROMISE_05500
- * @tc.desc Abnormal with promise.
+ * @tc.name ImportKeyPromiseLackDigestTag
+ * @tc.desc Import key promise lack of digest tag.
*/
it('HUKS_ABNORMAL_PROMISE_05500', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(3, 1);
var ret = await hks.importKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_05600
- * @tc.name HUKS_ABNORMAL_PROMISE_05600
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidAlgTagForImportKeyPromise
+ * @tc.desc Invalid value of alg tag for import key promise.
*/
it('HUKS_ABNORMAL_PROMISE_05600', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[0].value = invalidValue;
var ret = await hks.importKey(aliasNotExist, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
done()
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_05700
- * @tc.name HUKS_ABNORMAL_PROMISE_05700
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPurposeTagForImportKeyPromise
+ * @tc.desc Invalid value of alg tag for purpose key promise.
*/
it('HUKS_ABNORMAL_PROMISE_05700', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[1].value = invalidValue;
var ret = await hks.importKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_05800
- * @tc.name HUKS_ABNORMAL_PROMISE_05800
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPaddingTagForImportKeyPromise
+ * @tc.desc Invalid value of alg tag for padding key promise.
*/
it('HUKS_ABNORMAL_PROMISE_05800', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[2].value = invalidValue;
var ret = await hks.importKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_05900
- * @tc.name HUKS_ABNORMAL_PROMISE_05900
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidDigestTagForImportKeyPromise
+ * @tc.desc Invalid value of alg tag for digest key promise.
*/
it('HUKS_ABNORMAL_PROMISE_05900', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[3].value = invalidValue;
var ret = await hks.importKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
-
+
/**
* @tc.number HUKS_ABNORMAL_PROMISE_06000
- * @tc.name HUKS_ABNORMAL_PROMISE_06000
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidIndataOfOptionForImportKeyPromise
+ * @tc.desc Invalid indata of option for import key promise.
*/
it('HUKS_ABNORMAL_PROMISE_06000', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.inData = new Uint8Array(0);
var ret = await hks.importKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done()
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_06100
- * @tc.name HUKS_ABNORMAL_PROMISE_06100
- * @tc.desc Abnormal with promise.
+ * @tc.name ExportKeyPromiseNotExistAlias
+ * @tc.desc Export key promise with not exist alias.
*/
it('HUKS_ABNORMAL_PROMISE_06100', 0, async function (done) {
var ret = await hks.exportKey(aliasNotExist, emptyOption);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_06200
- * @tc.name HUKS_ABNORMAL_PROMISE_06200
- * @tc.desc Abnormal with promise.
+ * @tc.name ExportKeyPromiseLongAlias
+ * @tc.desc Export key promise with too long alias.
*/
it('HUKS_ABNORMAL_PROMISE_06200', 0, async function (done) {
var ret = await hks.exportKey(aliasTooLong, emptyOption);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_06300
- * @tc.name HUKS_ABNORMAL_PROMISE_06300
- * @tc.desc Abnormal with promise.
+ * @tc.name ExportKeyPromiseEmptyAlias
+ * @tc.desc Export key promise with empty alias.
*/
it('HUKS_ABNORMAL_PROMISE_06300', 0, async function (done) {
var ret = await hks.exportKey(aliasEmpty, emptyOption);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_06400
- * @tc.name HUKS_ABNORMAL_PROMISE_06400
- * @tc.desc Abnormal with promise.
+ * @tc.name SignPromiseNotExistAlias
+ * @tc.desc Sign promise with not exist alias.
*/
it('HUKS_ABNORMAL_PROMISE_06400', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
var ret = await hks.sign(aliasNotExist, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_06500
- * @tc.name HUKS_ABNORMAL_PROMISE_06500
- * @tc.desc Abnormal with promise.
+ * @tc.name SignPromiseLongAlias
+ * @tc.desc Sign promise with too long alias.
*/
it('HUKS_ABNORMAL_PROMISE_06500', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
var ret = await hks.sign(aliasTooLong, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_06600
- * @tc.name HUKS_ABNORMAL_PROMISE_06600
- * @tc.desc Abnormal with promise.
+ * @tc.name SignPromiseEmptyAlias
+ * @tc.desc Sign promise with empty alias.
*/
it('HUKS_ABNORMAL_PROMISE_06600', 0, async function (done) {
var option = makeSignVerifyAndImportOption(plainTextSize64);
var ret = await hks.sign(aliasEmpty, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_06700
- * @tc.name HUKS_ABNORMAL_PROMISE_06700
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidAlgTagForSignPromise
+ * @tc.desc Invalid value of alg tag for sign promise.
*/
it('HUKS_ABNORMAL_PROMISE_06700', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[0].value = invalidValue;
var ret = await hks.sign(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_06800
- * @tc.name HUKS_ABNORMAL_PROMISE_06800
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPurposeTagForSignPromise
+ * @tc.desc Invalid value of purpose tag for sign promise.
*/
it('HUKS_ABNORMAL_PROMISE_06800', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[1].value = invalidValue;
var ret = await hks.sign(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_06900
- * @tc.name HUKS_ABNORMAL_PROMISE_06900
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPaddingTagForSignPromise
+ * @tc.desc Invalid value of padding tag for sign promise.
*/
it('HUKS_ABNORMAL_PROMISE_06900', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties[2].value = invalidValue;
var ret = await hks.sign(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_07000
- * @tc.name HUKS_ABNORMAL_PROMISE_07000
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidDigestTagForSignPromise
+ * @tc.desc Invalid value of digest tag for sign promise.
*/
it('HUKS_ABNORMAL_PROMISE_07000', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties[3].value = invalidValue;
var ret = await hks.sign(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_07100
- * @tc.name HUKS_ABNORMAL_PROMISE_07100
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidIndataOfOptionForSignPromise
+ * @tc.desc Invalid indata of option for sign promise.
*/
it('HUKS_ABNORMAL_PROMISE_07100', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.inData = new Uint8Array(0);
var ret = await hks.sign(aliasEmpty, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_07200
- * @tc.name HUKS_ABNORMAL_PROMISE_07200
- * @tc.desc Abnormal with promise.
+ * @tc.name SignPromiseLackAlgTag
+ * @tc.desc Sign promise lack of alg tag.
*/
it('HUKS_ABNORMAL_PROMISE_07200', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(0, 1);
var ret = await hks.sign(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_07300
- * @tc.name HUKS_ABNORMAL_PROMISE_07300
- * @tc.desc Abnormal with promise.
+ * @tc.name SignPromiseLackPurposeTag
+ * @tc.desc Sign promise lack of purpose tag.
*/
it('HUKS_ABNORMAL_PROMISE_07300', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(1, 1);
var ret = await hks.sign(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_07400
- * @tc.name HUKS_ABNORMAL_PROMISE_07400
- * @tc.desc Abnormal with promise.
+ * @tc.name SignPromiseLackPaddingTag
+ * @tc.desc Sign promise lack of padding tag.
*/
it('HUKS_ABNORMAL_PROMISE_07400', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties.splice(2, 1);
var ret = await hks.sign(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_07500
- * @tc.name HUKS_ABNORMAL_PROMISE_07500
- * @tc.desc Abnormal with promise.
+ * @tc.name SignPromiseLackDigestTag
+ * @tc.desc Sign promise lack of digest tag.
*/
it('HUKS_ABNORMAL_PROMISE_07500', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties.splice(3, 1);
var ret = await hks.sign(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_07600
- * @tc.name HUKS_ABNORMAL_PROMISE_07600
- * @tc.desc Abnormal with promise.
+ * @tc.name VerifyPromiseNotExistAlias
+ * @tc.desc Verify promise with not exist alias.
*/
it('HUKS_ABNORMAL_PROMISE_07600', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
var ret = await hks.verify(aliasNotExist, option, plainTextSize64);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_07700
- * @tc.name HUKS_ABNORMAL_PROMISE_07700
- * @tc.desc Abnormal with promise.
+ * @tc.name VerifyPromiseLongAlias
+ * @tc.desc Verify promise with too long alias.
*/
it('HUKS_ABNORMAL_PROMISE_07700', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
var ret = await hks.verify(aliasTooLong, option, plainTextSize64);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_07800
- * @tc.name HUKS_ABNORMAL_PROMISE_07800
- * @tc.desc Abnormal with promise.
+ * @tc.name VerifyPromiseEmptyAlias
+ * @tc.desc Verify promise with empty alias.
*/
it('HUKS_ABNORMAL_PROMISE_07800', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
var ret = await hks.verify(aliasEmpty, option, plainTextSize64);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_07900
- * @tc.name HUKS_ABNORMAL_PROMISE_07900
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidAlgTagForVerifyPromise
+ * @tc.desc Invalid value of alg tag for verify promise.
*/
it('HUKS_ABNORMAL_PROMISE_07900', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties[0].value = invalidValue;
var ret = await hks.verify(alias, option, plainTextSize64);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_08000
- * @tc.name HUKS_ABNORMAL_PROMISE_08000
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPurposeTagForVerifyPromise
+ * @tc.desc Invalid value of purpose tag for verify promise.
*/
it('HUKS_ABNORMAL_PROMISE_08000', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties[1].value = invalidValue;
var ret = await hks.verify(alias, option, plainTextSize8);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_08100
- * @tc.name HUKS_ABNORMAL_PROMISE_08100
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPaddingTagForVerifyPromise
+ * @tc.desc Invalid value of padding tag for verify promise.
*/
it('HUKS_ABNORMAL_PROMISE_08100', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties[2].value = invalidValue;
var ret = await hks.verify(alias, option, plainTextSize8);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_08200
- * @tc.name HUKS_ABNORMAL_PROMISE_08200
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidDigestTagForVerifyPromise
+ * @tc.desc Invalid value of digest tag for verify promise.
*/
it('HUKS_ABNORMAL_PROMISE_08200', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties[3].value = invalidValue;
var ret = await hks.verify(alias, option, plainTextSize8);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_08300
- * @tc.name HUKS_ABNORMAL_PROMISE_08300
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidIndataOfOptionForVerifyPromise
+ * @tc.desc Invalid indata of option for verify promise.
*/
it('HUKS_ABNORMAL_PROMISE_08300', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize16);
option.inData = new Uint8Array(0);
var ret = await hks.verify(alias, option, plainTextSize64);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_08400
- * @tc.name HUKS_ABNORMAL_PROMISE_08400
- * @tc.desc Abnormal with promise.
+ * @tc.name VerifyPromiseLackAlgTag
+ * @tc.desc Verify promise lack of alg tag.
*/
it('HUKS_ABNORMAL_PROMISE_08400', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(0, 1);
var ret = await hks.verify(alias, option, plainTextSize64);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_08500
- * @tc.name HUKS_ABNORMAL_PROMISE_08500
- * @tc.desc Abnormal with promise.
+ * @tc.name VerifyPromiseLackPurposeTag
+ * @tc.desc Verify promise lack of purpose tag.
*/
it('HUKS_ABNORMAL_PROMISE_08500', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(1, 1);
var ret = await hks.verify(aliasNotExist, option, plainTextSize64);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_08600
- * @tc.name HUKS_ABNORMAL_PROMISE_08600
- * @tc.desc Abnormal with promise.
+ * @tc.name VerifyPromiseLackPaddingTag
+ * @tc.desc Verify promise lack of padding tag.
*/
it('HUKS_ABNORMAL_PROMISE_08600', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize8);
option.properties.splice(2, 1);
var ret = await hks.verify(alias, option, plainTextSize8);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_08700
- * @tc.name HUKS_ABNORMAL_PROMISE_08700
- * @tc.desc Abnormal with promise.
+ * @tc.name VerifyPromiseLackDigestTag
+ * @tc.desc Verify promise lack of digest tag.
*/
it('HUKS_ABNORMAL_PROMISE_08700', 0, async function (done) {
await generateRsaKey();
var option = makeSignVerifyAndImportOption(plainTextSize64);
option.properties.splice(3, 1);
var ret = await hks.verify(alias, option, plainTextSize64);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_08800
- * @tc.name HUKS_ABNORMAL_PROMISE_08800
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidIvTagForEncryptPromise
+ * @tc.desc Invalid value of iv tag for encrypt promise.
*/
it('HUKS_ABNORMAL_PROMISE_08800', 0, async function (done) {
- await generateRsaKey();
- var option = makeSignVerifyAndImportOption(plainTextSize64);
- option.properties[0].value = invalidValue;
- var ret = await hks.verify(alias, option, plainTextSize64);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
- deleteKeyPromise(alias, done);
+ await generateAesKey('CBC');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
+ option.properties[4].value = invalidValueUint8Array;
+ var ret = await hks.encrypt(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ await deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_08900
- * @tc.name HUKS_ABNORMAL_PROMISE_08900
- * @tc.desc Abnormal with promise.
+ * @tc.name AgreeKeyPromiseEmptyAlias
+ * @tc.desc Agree key promise with empty alias.
*/
it('HUKS_ABNORMAL_PROMISE_08900', 0, async function (done) {
var option = makeAgreeOption();
var ret = await hks.agreeKey(aliasEmpty, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_09000
- * @tc.name HUKS_ABNORMAL_PROMISE_09000
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidAlgTagForAgreeKeyPromise
+ * @tc.desc Invalid value of alg tag for agree key promise.
*/
it('HUKS_ABNORMAL_PROMISE_09000', 0, async function (done) {
await generateEccKey();
var option = makeAgreeOption();
option.properties[0].value = invalidValue;
var ret = await hks.agreeKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_09100
- * @tc.name HUKS_ABNORMAL_PROMISE_09100
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidSizeTagForAgreeKeyPromise
+ * @tc.desc Invalid value of size tag for agree key promise.
*/
it('HUKS_ABNORMAL_PROMISE_09100', 0, async function (done) {
await generateEccKey();
var option = makeAgreeOption();
option.properties[1].value = invalidValue;
var ret = await hks.agreeKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_09200
- * @tc.name HUKS_ABNORMAL_PROMISE_09200
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidIndataOfOptionForAgreeKeyPromise
+ * @tc.desc Invalid indata of option for agree key promise.
*/
it('HUKS_ABNORMAL_PROMISE_09200', 0, async function (done) {
await generateEccKey();
var option = makeAgreeOption();
option.inData = new Uint8Array(0);
var ret = await hks.agreeKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_09300
- * @tc.name HUKS_ABNORMAL_PROMISE_09300
- * @tc.desc Abnormal with promise.
+ * @tc.name AgreeKeyPromiseLackAlgTag
+ * @tc.desc Agree key promise lack of alg tag.
*/
it('HUKS_ABNORMAL_PROMISE_09300', 0, async function (done) {
await generateEccKey();
var option = makeAgreeOption();
option.properties.splice(0, 1);
var ret = await hks.agreeKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_ALG_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_ALG_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_09400
- * @tc.name HUKS_ABNORMAL_PROMISE_09400
- * @tc.desc Abnormal with promise.
+ * @tc.name AgreeKeyPromiseLackSizeTag
+ * @tc.desc Agree key promise lack of size tag.
*/
it('HUKS_ABNORMAL_PROMISE_09400', 0, async function (done) {
await generateEccKey();
var option = makeAgreeOption();
option.properties[1].value = invalidValue;
var ret = await hks.agreeKey(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_09500
- * @tc.name HUKS_ABNORMAL_PROMISE_09500
- * @tc.desc Abnormal with promise.
+ * @tc.name MacPromiseEmptyAlias
+ * @tc.desc Mac promise with empty alias.
*/
it('HUKS_ABNORMAL_PROMISE_09500', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
var ret = await hks.mac(aliasNotExist, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_NOT_EXIST);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_NOT_EXIST);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_09600
- * @tc.name HUKS_ABNORMAL_PROMISE_09600
- * @tc.desc Abnormal with promise.
+ * @tc.name MacPromiseTooLongAlias
+ * @tc.desc Mac promise with too long alias.
*/
it('HUKS_ABNORMAL_PROMISE_09600', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
var ret = await hks.mac(aliasTooLong, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_09700
- * @tc.name HUKS_ABNORMAL_PROMISE_09700
- * @tc.desc Abnormal with promise.
+ * @tc.name MacPromiseEmptyAlias
+ * @tc.desc Mac promise with empty alias.
*/
it('HUKS_ABNORMAL_PROMISE_09700', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
var ret = await hks.mac(aliasEmpty, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_09800
- * @tc.name HUKS_ABNORMAL_PROMISE_09800
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidPurposeTagForMacPromise
+ * @tc.desc Invalid value of purpose tag for mac promise.
*/
it('HUKS_ABNORMAL_PROMISE_09800', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
option.properties[0].value = invalidValue;
var ret = await hks.mac(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_PURPOSE);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_09900
- * @tc.name HUKS_ABNORMAL_PROMISE_09900
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidDigestTagForMacPromise
+ * @tc.desc Invalid value of digest tag for mac promise.
*/
it('HUKS_ABNORMAL_PROMISE_09900', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
option.properties[1].value = invalidValue;
var ret = await hks.mac(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_10000
- * @tc.name HUKS_ABNORMAL_PROMISE_10000
- * @tc.desc Abnormal with promise.
+ * @tc.name InvalidIndataOfOptionForMacPromise
+ * @tc.desc Invalid indata of option for mac promise.
*/
it('HUKS_ABNORMAL_PROMISE_10000', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
option.inData = new Uint8Array(0);
var ret = await hks.mac(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_10100
- * @tc.name HUKS_ABNORMAL_PROMISE_10100
- * @tc.desc Abnormal with promise.
+ * @tc.name MacPromiseLackPurposeTag
+ * @tc.desc Mac promise lack of purpose tag.
*/
it('HUKS_ABNORMAL_PROMISE_10100', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
option.properties.splice(0, 1);
var ret = await hks.mac(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_PURPOSE_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_PURPOSE_FAIL);
deleteKeyPromise(alias, done);
});
/**
* @tc.number HUKS_ABNORMAL_PROMISE_10200
- * @tc.name HUKS_ABNORMAL_PROMISE_10200
- * @tc.desc Abnormal with promise.
+ * @tc.name MacPromiseLackDigestTag
+ * @tc.desc Mac promise lack of digest tag.
*/
it('HUKS_ABNORMAL_PROMISE_10200', 0, async function (done) {
await generateMacKey();
var option = makeMacOption();
option.properties.splice(1, 1);
var ret = await hks.mac(alias, option);
- expect(ret.errorCode).assertEqual(hks.HksErrorCode.HKS_ERROR_CHECK_GET_DIGEST_FAIL);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_CHECK_GET_DIGEST_FAIL);
deleteKeyPromise(alias, done);
});
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_10300
+ * @tc.name LongIndataOfOptionForEncryptPromise
+ * @tc.desc Too long indata of option for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_10300', 0, async function (done) {
+ await generateAesKey('CBC');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
+ option.inData = inDataTooLong;
+ var ret = await hks.encrypt(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ await deleteKeyPromise(alias, done);
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_10400
+ * @tc.name GenerateKeyPromiseStrangeAlias
+ * @tc.desc Generate key promise with strange alias.
+ */
+ it('HUKS_ABNORMAL_PROMISE_10400', 0, async function (done) {
+ var genKeyRet = await hks.generateKey(aliasStrange, generateAesCBCKeyOption);
+ expect(genKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var deleteKeyRet = await hks.deleteKey(aliasStrange, emptyOption);
+ expect(deleteKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_10500
+ * @tc.name InvalidNonceTagForEncryptPromise
+ * @tc.desc Invalid value of nonce tag for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_10500', 0, async function (done) {
+ await generateAesKey('GCM');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
+ option.properties[4].value = invalidValueUint8Array;
+ var ret = await hks.encrypt(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ await deleteKeyPromise(alias, done);
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_10600
+ * @tc.name InvalidASSOCIATEDDATATagForEncryptPromise
+ * @tc.desc Invalid value of associated data tag for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_10600', 0, async function (done) {
+ await generateAesKey('GCM');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
+ option.properties[5].value = invalidValueUint8Array;
+ var ret = await hks.encrypt(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ await deleteKeyPromise(alias, done);
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_10700
+ * @tc.name InvalidIvTagForDecryptPromise
+ * @tc.desc Invalid value of iv tag for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_10700', 0, async function (done) {
+ await generateAesKey('CBC');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_CBC);
+ option.properties[4].value = invalidValueUint8Array;
+ var ret = await hks.decrypt(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ await deleteKeyPromise(alias, done);
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_10800
+ * @tc.name InvalidNonceTagForDecryptPromise
+ * @tc.desc Invalid value of nonce tag for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_10800', 0, async function (done) {
+ await generateAesKey('GCM');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
+ option.properties[4].value = invalidValueUint8Array;
+ var ret = await hks.decrypt(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ await deleteKeyPromise(alias, done);
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_10900
+ * @tc.name InvalidAssociatedDataTagForDecryptPromise
+ * @tc.desc Invalid value of associated data tag for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_10900', 0, async function (done) {
+ await generateAesKey('GCM');
+ var option = makeEncryptAndDecryptOptionForAbnormal(hks.HuksCipherMode.HUKS_MODE_GCM);
+ option.properties[5].value = invalidValueUint8Array;
+ var ret = await hks.decrypt(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ await deleteKeyPromise(alias, done);
+ });
});
\ No newline at end of file
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part2.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part2.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..e9b07f24af7dfadde53af49218c12705ffd70e3b
--- /dev/null
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part2.test.js
@@ -0,0 +1,1871 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hks from '@ohos.security.huks'
+import { describe, it, expect } from 'deccjsunit/index'
+import {
+ alias,
+} from '../../../../../../hks_xts_common.test'
+import {
+ aesGenerateKeyInvalidSizeOption,
+ aesGenerateKeyInvalidModeOption,
+ aesGenerateKeyInvalidAlgOption,
+ aesGenerateKeyInvalidPurposeOption,
+ rsaGenerateKeyInvalidSizeOption,
+ rsaGenerateKeyInvalidPaddingOption,
+ rsaGenerateKeyInvalidPurposeOption,
+ eccGenerateKeyInvalidSizeOption,
+ eccGenerateKeyInvalidDigestOption,
+ eccGenerateKeyInvalidPurposeOption,
+ ecdhGenerateKeyInvalidAlgOption,
+ hkdfGenerateKeyInvalidAlgOption,
+ pbkdf2GenerateKeyInvalidAlgOption,
+ ed25519GenerateKeyInvalidPurposeOption,
+ x25519GenerateKeyInvalidPurposeOption,
+ hmacGenerateKeyInvalidSizeOption,
+ hmacGenerateKeyInvalidPurposeOption,
+ dsaGenerateKeyInvalidSizeOption,
+ dsaGenerateKeyInvalidPurposeOption,
+ dhGenerateKeyInvalidPurposeOption,
+} from './hks_abnormal_common.test.js'
+
+describe('Hks_Abnormal_Promise_Part2', function () {
+ var errHmacKeySizeA = 0;
+ var errHmacKeySizeB = 9;
+ var errDsaKeySizeA = 0;
+ var errDsaKeySizeB = 9;
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_11000
+ * @tc.name InvalidAesKeySize512AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid aes key size 512 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_11000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_512);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_11100
+ * @tc.name InvalidRsaKeySize512AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 512 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_11100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_11200
+ * @tc.name InvalidRsaKeySize768AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 768 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_11200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_768);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_11300
+ * @tc.name InvalidRsaKeySize1024AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 1024 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_11300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_11400
+ * @tc.name InvalidRsaKeySize2048AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 2048 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_11400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_11500
+ * @tc.name InvalidRsaKeySize3072AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 3072 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_11500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_11600
+ * @tc.name InvalidRsaKeySize4096AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 4096 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_11600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_11700
+ * @tc.name InvalidEccKeySize224AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid ecc key size 224 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_11700', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_11800
+ * @tc.name InvalidEccKeySize256AlgAesForGenerateGKeyPromise
+ * @tc.desc Ecc key size 256 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_11800', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_11900
+ * @tc.name InvalidEccKeySize384AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid ecc key size 384 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_11900', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_12000
+ * @tc.name InvalidEccKeySize521AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid ecc key size 521 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_12000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_12100
+ * @tc.name InvalidCurve25519KeySize256AlgAesForGenerateGKeyPromise
+ * @tc.desc Curve25519 key size 256 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_12100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_12200
+ * @tc.name InvaliddhKeySize2048AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid dh key size 2048 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_12200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_12300
+ * @tc.name InvaliddhKeySize3072AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid dh key size 2048 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_12300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_12400
+ * @tc.name InvaliddhKeySize4096AlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid dh key size 4096 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_12400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_12500
+ * @tc.name InvalidPaddingOaepModeCbcAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding oaep mode cbc alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_12500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CBC,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_12600
+ * @tc.name InvalidPaddingPssModeCbcAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pss mode cbc alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_12600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(hks.HuksCipherMode.HUKS_MODE_CBC, hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_12700
+ * @tc.name InvalidPaddingPkcs1_v1_5ModeCbcAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs1_v1_5 mode cbc alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_12700', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CBC,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_12800
+ * @tc.name InvalidPaddingPkcs5ModeCbcAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs5 mode cbc alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_12800', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CBC,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_12900
+ * @tc.name InvalidPaddingOaepModeCtrAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding oaep mode ctr alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_12900', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CTR,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_13000
+ * @tc.name InvalidPaddingPssModeCtrAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pss mode ctr alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_13000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(hks.HuksCipherMode.HUKS_MODE_CTR, hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_13100
+ * @tc.name InvalidPaddingPkcs1_v1_5ModeCtrAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs1_v1_5 mode ctr alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_13100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CTR,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_13200
+ * @tc.name InvalidPaddingPkcs5ModeCtrAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs5 mode ctr alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_13200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CTR,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13300
+ * @tc.name InvalidPaddingPkcs7ModeCtrAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs7 mode ctr alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_13300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CTR,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13400
+ * @tc.name InvalidPaddingOaepModeEcbAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding oaep mode ecb alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_13400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13500
+ * @tc.name InvalidPaddingPssModeEcbAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pss mode ecb alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_13500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(hks.HuksCipherMode.HUKS_MODE_ECB, hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13600
+ * @tc.name InvalidPaddingPkcs1_v1_5ModeEcbAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs1_v1_5 mode ecb alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_13600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13700
+ * @tc.name InvalidPaddingPkcs5ModeEcbAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs5 mode ecb alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_13700', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_ECB,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13800
+ * @tc.name InvalidPaddingOaepModeGcmAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding oaep mode gcm alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_13800', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_GCM,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_13900
+ * @tc.name InvalidPaddingpssModeGcmAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pss mode gcm alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_13900', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(hks.HuksCipherMode.HUKS_MODE_GCM, hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14000
+ * @tc.name InvalidPaddingPkcs1_v1_5ModeGcmAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs1_v1_5 mode gcm alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_14000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_GCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14100
+ * @tc.name InvalidPaddingPkcs5ModeGcmAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs5 mode gcm alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_14100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_GCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14200
+ * @tc.name InvalidPaddingPkcs7ModeGcmAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs7 mode gcm alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_14200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_GCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14300
+ * @tc.name InvalidPaddingOaepModeCcmAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding oaep mode ccm alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_14300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CCM,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14400
+ * @tc.name InvalidPaddingPssModeCcmAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pss mode ccm alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_14400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(hks.HuksCipherMode.HUKS_MODE_CCM, hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14500
+ * @tc.name InvalidPaddingPkcs1_v1_5ModeCcmAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs1_v1_5 mode ccm alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_14500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14600
+ * @tc.name InvalidPaddingPkcs5ModeCcmAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs5 mode ccm alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_14600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14700
+ * @tc.name InvalidPaddingPkcs7ModeCcmAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid padding pkcs7 mode ccm alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_14700', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_CCM,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14800
+ * @tc.name InvalidModeOfbAlgAesForGenerateGKeyPromise
+ * @tc.desc Invalid mode ofb alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_14800', 0, async function (done) {
+ var option = aesGenerateKeyInvalidModeOption(
+ hks.HuksCipherMode.HUKS_MODE_OFB,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_MODE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_14900
+ * @tc.name InvalidPurposeDeriveAlgRsaAlgAesForGenerateKeyPromise.
+ * @tc.desc Invalid purpose derive alg rsa alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_14900', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15000
+ * @tc.name InvalidPurposeDeriveAlgEccAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg ecc alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_15000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15100
+ * @tc.name InvalidPurposeDeriveAlgDsaAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg dsa alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_15100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_DSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15200
+ * @tc.name InvalidPurposeDeriveAlgHkdfAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg hkdf alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_15200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_HKDF,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15300
+ * @tc.name InvalidPurposeDeriveAlgPbkdf2AlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg pbkdf2 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_15300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_PBKDF2,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15400
+ * @tc.name InvalidPurposeDeriveAlgEcdhAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg ecdh alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_15400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECDH,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15500
+ * @tc.name InvalidPurposeDeriveAlgX25519AlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg x25519 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_15500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_X25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15600
+ * @tc.name InvalidPurposeDeriveAlgEd25519AlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg ed25519 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_15600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ED25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15700
+ * @tc.name InvalidPurposeDeriveAlgDhAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg dh alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_15700', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15800
+ * @tc.name InvalidPurposeMacAlgRsaAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg rsa alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_15800', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_RSA, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_15900
+ * @tc.name InvalidPurposeMacAlgEccAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg ecc alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_15900', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECC, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16000
+ * @tc.name InvalidPurposeMacAlgDsaAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg dsa alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_16000', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DSA, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16100
+ * @tc.name InvalidPurposeMacAlgHkdfAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg hkdf alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_16100', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16200
+ * @tc.name InvalidPurposeMacAlgPbkdf2AlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg pbkdf2 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_16200', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_PBKDF2,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16300
+ * @tc.name InvalidPurposeMacAlgEcdhAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg ecdh alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_16300', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECDH, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16400
+ * @tc.name InvalidPurposeMacAlgX25519AlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg x25519 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_16400', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_X25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16500
+ * @tc.name InvalidPurposeMacAlgEd25519AlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg ed25519 alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_16500', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ED25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16600
+ * @tc.name InvalidPurposeMacAlgDhAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg dh alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_16600', 0, async function (done) {
+ var option = aesGenerateKeyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH, hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16700
+ * @tc.name InvalidPurposeSignAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose sign alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_16700', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(aesGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN;
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16800
+ * @tc.name InvalidPurposeVerifyAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose verify alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_16800', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(aesGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY;
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_16900
+ * @tc.name InvalidPurposeAgreeAlgAesForGenerateKeyPromise
+ * @tc.desc Invalid purpose agree alg aes for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_16900', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(aesGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE;
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17000
+ * @tc.name InvalidEccKeySize224AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid ecc key size 224 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_17000', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17100
+ * @tc.name InvalidEccKeySize256AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid ecc key size 256 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_17100', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17200
+ * @tc.name InvalidEccKeySize384AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid ecc key size 384 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_17200', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17300
+ * @tc.name InvalidEccKeySize521AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid ecc key size 521 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_17300', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17400
+ * @tc.name InvalidAesKeySize128AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid aes key size 128 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_17400', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_128);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17500
+ * @tc.name InvalidAesKeySize192AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid aes key size 192 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_17500', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_192);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17600
+ * @tc.name InvalidAesKeySize256AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid aes key size 256 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_17600', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_256);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17700
+ * @tc.name InvalidAesKeySize512AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid aes key size 512 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_17700', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_512);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17800
+ * @tc.name InvalidCurve25519KeySize256AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid curve25519 key size 256 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_17800', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_17900
+ * @tc.name InvalidDhKeySize2048AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid dh key size 2048 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_17900', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18000
+ * @tc.name InvalidDhKeySize3072AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid dh key size 3072 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_18000', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18100
+ * @tc.name InvalidDhKeySize4096AlgRsaForGenerateGKeyPromise
+ * @tc.desc Invalid dh key size 4096 alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_18100', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18200
+ * @tc.name InvalidPaddingPssPurposeEncryptDecryptAlgRsaForGenerateKeyPromise.
+ * @tc.desc Invalid padding pss purpose encrypt decrypt alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_18200', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18300
+ * @tc.name InvalidPaddingPkcs5PurposeEncryptDecryptAlgRsaForGenerateKeyPromise
+ * @tc.desc Invalid padding pkcs5 purpose encrypt decrypt alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_18300', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18400
+ * @tc.name InvalidPaddingPkcs7PurposeEncryptDecryptAlgRsaForGenerateKeyPromise
+ * @tc.desc Invalid padding pkcs7 purpose encrypt decrypt alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_18400', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18500
+ * @tc.name InvalidPaddingNonePurposeSignVerifyAlgRsaForGenerateKeyPromise
+ * @tc.desc Invalid padding none purpose sign verify alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_18500', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18600
+ * @tc.name InvalidPaddingOaepPurposeSignVerifyAlgRsaForGenerateKeyPromise
+ * @tc.desc Invalid padding oaep purpose sign verify alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_18600', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18700
+ * @tc.name InvalidPaddingPkcs5PurposeSignVerifyAlgRsaForGenerateKeyPromise
+ * @tc.desc Invalid padding pkcs5 purpose sign verify alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_18700', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18800
+ * @tc.name InvalidPaddingPkcs7PurposeSignVerifyAlgRsaForGenerateKeyPromise
+ * @tc.desc Invalid padding pkcs7 purpose sign verify alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_18800', 0, async function (done) {
+ var option = rsaGenerateKeyInvalidPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_18900
+ * @tc.name InvalidPurposeDeriveAlgRsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_18900', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(rsaGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE;
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19000
+ * @tc.name InvalidPurposeMacAlgRsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_19000', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(rsaGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC;
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19100
+ * @tc.name InvalidPurposeWrapAlgRsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose wrap alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_19100', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(rsaGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP;
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19200
+ * @tc.name InvalidPurposeUnwrapAlgRsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose unwrap alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_19200', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(rsaGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP;
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19300
+ * @tc.name InvalidPurposeagreeAlgRsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose agree alg rsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_19300', 0, async function (done) {
+ var option = JSON.parse(JSON.stringify(rsaGenerateKeyInvalidPurposeOption));
+ option.properties[2].value = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE;
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19400
+ * @tc.name InvalidRsaKeySize512AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 512 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_19400', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19500
+ * @tc.name InvalidRsaKeySize768AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 768 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_19500', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_768);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19600
+ * @tc.name InvalidRsaKeySize1024AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 1024 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_19600', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19700
+ * @tc.name InvalidRsaKeySize2048AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 2048 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_19700', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19800
+ * @tc.name InvalidRsaKeySize3072AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 3072 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_19800', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_19900
+ * @tc.name InvalidRsaKeySize4096AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid rsa key size 4096 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_19900', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20000
+ * @tc.name InvalidAesKeySize128AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid aes key size 128 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_20000', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_128);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20100
+ * @tc.name InvalidAesKeySize192AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid aes key size 192 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_20100', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_192);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20200
+ * @tc.name InvalidAesKeySize256AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid aes key size 256 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_20200', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_256);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20300
+ * @tc.name InvalidAesKeySize512AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid aes key size 512 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_20300', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_512);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20400
+ * @tc.name InvalidCurve25519KeySize256AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid curve25519 key size 256 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_20400', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20500
+ * @tc.name InvalidDhKeySize2048AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid dh key size 2048 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_20500', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20600
+ * @tc.name InvalidDhKeySize3072AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid dh key size 3072 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_20600', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20700
+ * @tc.name InvalidDhKeySize4096AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid dh key size 4096 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_20700', 0, async function (done) {
+ var option = eccGenerateKeyInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20800
+ * @tc.name InvalidDigestMd5AlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid digest md5 alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_20800', 0, async function (done) {
+ var option = eccGenerateKeyInvalidDigestOption(hks.HuksKeyDigest.HUKS_DIGEST_MD5);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_20900
+ * @tc.name InvalidPurposeDeriveAlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid purpose derive alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_20900', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21000
+ * @tc.name InvalidPurposeMacAlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid purpose mac alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_21000', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21100
+ * @tc.name InvalidPurposeWrapAlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid purpose wrap alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_21100', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21200
+ * @tc.name InvalidPurposeUnwrapAlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid purpose unwrap alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_21200', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21300
+ * @tc.name InvalidPurposeencryptAlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid purpose encrypt alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_21300', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21400
+ * @tc.name InvalidPurposeDecryptAlgEccForGenerateGKeyPromise
+ * @tc.desc Invalid purpose decrypt alg ecc for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_21400', 0, async function (done) {
+ var option = eccGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21500
+ * @tc.name InvalidArgumentAlgEcdhForGenerateGKeyPromise
+ * @tc.desc Invalid argument alg ecdh for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_21500', 0, async function (done) {
+ var option = ecdhGenerateKeyInvalidAlgOption();
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21600
+ * @tc.name InvalidAlgorithmAlgHkdfForGenerateGKeyPromise
+ * @tc.desc Invalid algorithm alg hkdf for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_21600', 0, async function (done) {
+ var option = hkdfGenerateKeyInvalidAlgOption();
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21700
+ * @tc.name InvalidAlgorithmAlgPbkdf2ForGenerateGKeyPromise
+ * @tc.desc Invalid algorithm alg pbkdf2 for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_21700', 0, async function (done) {
+ var option = pbkdf2GenerateKeyInvalidAlgOption();
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21800
+ * @tc.name InvalidPurposeDeriveAlgEd25519ForGenerateKeyPromise.
+ * @tc.desc Invalid purpose derive alg ed25519 for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_21800', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_21900
+ * @tc.name InvalidPurposeMacAlgEd25519ForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg ed25519 for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_21900', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22000
+ * @tc.name InvalidPurposeWrapAlgEd25519ForGenerateKeyPromise
+ * @tc.desc Invalid purpose wrap alg ed25519 for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_22000', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22100
+ * @tc.name InvalidPurposeUnwrapAlgEd25519ForGenerateKeyPromise
+ * @tc.desc Invalid purpose unwrap alg ed25519 for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_22100', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22200
+ * @tc.name InvalidPurposeEncryptAlgEd25519ForGenerateKeyPromise
+ * @tc.desc Invalid purpose encrypt alg ed25519 for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_22200', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22300
+ * @tc.name InvalidPurposeDecryptAlgEd25519ForGenerateKeyPromise
+ * @tc.desc Invalid purpose decrypt alg ed25519 for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_22300', 0, async function (done) {
+ var option = ed25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22400
+ * @tc.name InvalidPurposeDeriveAlgX25519ForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg x25519 for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_22400', 0, async function (done) {
+ var option = x25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22500
+ * @tc.name InvalidPurposeMacAlgX25519ForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg x25519 for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_22500', 0, async function (done) {
+ var option = x25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22600
+ * @tc.name InvalidPurposeEncryptAlgX25519ForGenerateKeyPromise
+ * @tc.desc Invalid purpose encrypt alg x25519 for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_22600', 0, async function (done) {
+ var option = x25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22700
+ * @tc.name InvalidPurposeDecryptAlgX25519ForGenerateKeyPromise
+ * @tc.desc Invalid purpose decrypt alg x25519 for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_22700', 0, async function (done) {
+ var option = x25519GenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22800
+ * @tc.name InvalidArgumentSizeaAlgHmacForGenerateKeyPromise
+ * @tc.desc Invalid argument sizea alg hmac for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_22800', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidSizeOption(errHmacKeySizeA);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_22900
+ * @tc.name InvalidArgumentSizebAlgHmacForGenerateKeyPromise
+ * @tc.desc Invalid argument sizeb alg hmac for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_22900', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidSizeOption(errHmacKeySizeB);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23000
+ * @tc.name InvalidPurposeDeriveAlgHmacForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg hmac for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_23000', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23100
+ * @tc.name InvalidPurposeSignAlgHmacForGenerateKeyPromise
+ * @tc.desc Invalid purpose sign alg hmac for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_23100', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23200
+ * @tc.name InvalidPurposeVerifyAlgHmacForGenerateKeyPromise
+ * @tc.desc Invalid purpose verify alg hmac for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_23200', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23300
+ * @tc.name InvalidPurposeWrapAlgHmacForGenerateKeyPromise
+ * @tc.desc Invalid purpose wrap alg hmac for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_23300', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23400
+ * @tc.name InvalidPurposeUnwrapAlgHmacForGenerateKeyPromise
+ * @tc.desc Invalid purpose unwrap alg hmac for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_23400', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23500
+ * @tc.name InvalidPurposeEncryptAlgHmacForGenerateKeyPromise
+ * @tc.desc Invalid purpose encrypt alg hmac for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_23500', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23600
+ * @tc.name InvalidPurposeDecryptAlgHmacForGenerateKeyPromise
+ * @tc.desc Invalid purpose decrypt alg hmac for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_23600', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23700
+ * @tc.name InvalidPurposeAgreeAlgHmacForGenerateKeyPromise
+ * @tc.desc Invalid purpose agree alg hmac for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_23700', 0, async function (done) {
+ var option = hmacGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23800
+ * @tc.name InvalidArgumentSizeaAlgDsaForGenerateKeyPromise
+ * @tc.desc Invalid argument sizea alg dsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_23800', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidSizeOption(errDsaKeySizeA);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_23900
+ * @tc.name InvalidArgumentSizebAlgDsaForGenerateKeyPromise
+ * @tc.desc Invalid argument sizeb alg dsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_23900', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidSizeOption(errDsaKeySizeB);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24000
+ * @tc.name InvalidPurposeDeriveAlgDsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg dsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_24000', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24100
+ * @tc.name InvalidPurposeMacAlgDsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg dsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_24100', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24200
+ * @tc.name InvalidPurposeWrapAlgDsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose wrap alg dsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_24200', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24300
+ * @tc.name InvalidPurposeUnwrapAlgDsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose unwrap alg dsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_24300', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24400
+ * @tc.name InvalidPurposeEncryptAlgDsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose encrypt alg dsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_24400', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24500
+ * @tc.name InvalidPurposeDecryptAlgDsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose decrypt alg dsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_24500', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24600
+ * @tc.name InvalidPurposeAgreeAlgDsaForGenerateKeyPromise
+ * @tc.desc Invalid purpose agree alg dsa for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_24600', 0, async function (done) {
+ var option = dsaGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24700
+ * @tc.name InvalidPurposeDeriveAlgDhForGenerateKeyPromise
+ * @tc.desc Invalid purpose derive alg dh for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_24700', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24800
+ * @tc.name InvalidPurposeMacAlgDhForGenerateKeyPromise
+ * @tc.desc Invalid purpose mac alg dh for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_24800', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_24900
+ * @tc.name InvalidPurposeWrapAlgDhForGenerateKeyPromise
+ * @tc.desc Invalid purpose wrap alg dh for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_24900', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25000
+ * @tc.name InvalidPurposeUnwrapAlgDhForGenerateKeyPromise
+ * @tc.desc Invalid purpose unwrap alg dh for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_25000', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25100
+ * @tc.name InvalidPurposeEncryptAlgDhForGenerateKeyPromise
+ * @tc.desc Invalid purpose encrypt alg dh for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_25100', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25200
+ * @tc.name InvalidPurposeDecryptAlgDhForGenerateKeyPromise
+ * @tc.desc Invalid purpose decrypt alg dh for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_25200', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25300
+ * @tc.name InvalidPurposeSignAlgDhForGenerateKeyPromise
+ * @tc.desc Invalid purpose sign alg dh for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_25300', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25400
+ * @tc.name InvalidPurposeVerifyAlgDhForGenerateKeyPromise
+ * @tc.desc Invalid purpose verify alg dh for generate key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_25400', 0, async function (done) {
+ var option = dhGenerateKeyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY);
+ var result = await hks.generateKey(alias, option);
+ expect(result.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+});
\ No newline at end of file
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part3.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part3.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..bb393b470648dadafbee349f049a3e1e3abc5e92
--- /dev/null
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part3.test.js
@@ -0,0 +1,1561 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hks from '@ohos.security.huks'
+import { describe, it, expect } from 'deccjsunit/index'
+import {
+ alias,
+} from '../../../../../../hks_xts_common.test'
+
+import {
+ generateRSAKeyOption,
+ generateAesCBCKeyOption,
+ generateAesGCMKeyOption,
+ encryptOrDecryptGenerateKeyOption,
+ encryptOrDecryptOption,
+ encryptOrDecryptInvalidAlgOption,
+ rsaEncryptInvalidSizeOption,
+ aesEncryptOrDecryptInvalidSizeOption,
+ aesEncryptOrDecryptInvalidPaddingOption,
+ aesEncryptOrDecryptInvalidDigestOption,
+ rsaEncryptOrDecryptInvalidIndataOption,
+ aesEncryptOrDecryptInvalidIndataOption,
+ aesEncryptOrDecryptInvalidPurposeOption,
+ rsaDecryptInvalidSizeOption,
+} from './hks_abnormal_common.test.js'
+
+describe('Hks_Abnormal_Promise_Part3', function () {
+
+ var cipherText = [];
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_25500
+ * @tc.name InvalidAlgorithmAlgEccForEncryptPromise
+ * @tc.desc Invalid algorithm alg ecc for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_25500', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECC);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25600
+ * @tc.name InvalidAlgorithmAlgDsaForEncryptPromise
+ * @tc.desc Invalid algorithm alg dsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_25600', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DSA);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25700
+ * @tc.name InvalidAlgorithmAlgHmacForEncryptPromise
+ * @tc.desc Invalid algorithm alg hmac for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_25700', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HMAC);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25800
+ * @tc.name InvalidAlgorithmAlgHkdfForEncryptPromise
+ * @tc.desc Invalid algorithm alg hkdf for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_25800', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_25900
+ * @tc.name InvalidAlgorithmAlgPbkdf2ForEncryptPromise
+ * @tc.desc Invalid algorithm alg pbkdf2 for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_25900', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_PBKDF2);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26000
+ * @tc.name InvalidAlgorithmAlgEcdhForEncryptPromise
+ * @tc.desc Invalid algorithm alg ecdh for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_26000', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECDH);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26100
+ * @tc.name InvalidAlgorithmAlgX25519ForEncryptPromise
+ * @tc.desc Invalid algorithm alg x25519 for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_26100', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_X25519);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26200
+ * @tc.name InvalidAlgorithmAlgEd25519ForEncryptPromise
+ * @tc.desc Invalid algorithm alg ed25519 for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_26200', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ED25519);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26300
+ * @tc.name InvalidAlgorithmAlgDhForEncryptPromise
+ * @tc.desc Invalid algorithm alg dh for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_26300', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26400
+ * @tc.name SuccessEcc224AlgRsaForEncryptPromise
+ * @tc.desc Success ecc 224 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_26400', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26500
+ * @tc.name SuccessEcc256AlgRsaForEncryptPromise
+ * @tc.desc Success ecc 256 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_26500', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26600
+ * @tc.name SuccessEcc384AlgRsaForEncryptPromise
+ * @tc.desc Success ecc 384 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_26600', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26700
+ * @tc.name SuccessEcc521AlgRsaForEncryptPromise
+ * @tc.desc Success ecc 521 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_26700', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_26800
+ * @tc.name SuccessAes128AlgRsaForEncryptPromise
+ * @tc.desc Success aes 128 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_26800', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_128);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_26900
+ * @tc.name SuccessAes192AlgRsaForEncryptPromise
+ * @tc.desc Success aes 192 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_26900', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_192);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27000
+ * @tc.name SuccessAes256AlgRsaForEncryptPromise
+ * @tc.desc Success aes 256 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_27000', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_256);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27100
+ * @tc.name SuccessAes512AlgRsaForEncryptPromise
+ * @tc.desc Success aes 512 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_27100', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_512);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27200
+ * @tc.name SuccessCurve25519256AlgRsaForEncryptPromise
+ * @tc.desc Success curve25519 256 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_27200', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27300
+ * @tc.name SuccessDh2048AlgRsaForEncryptPromise
+ * @tc.desc Success dh 2048 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_27300', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27400
+ * @tc.name SuccessDh3072AlgRsaForEncryptPromise
+ * @tc.desc Success dh 3072 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_27400', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27500
+ * @tc.name SuccessDh4096AlgRsaForEncryptPromise
+ * @tc.desc Success dh 4096 alg rsa for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_27500', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27600
+ * @tc.name SuccessRsa512AlgAesForEncryptPromise
+ * @tc.desc Success rsa 512 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_27600', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27700
+ * @tc.name SuccessRsa768AlgAesForEncryptPromise
+ * @tc.desc Success rsa 768 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_27700', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_768);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27800
+ * @tc.name SuccessRsa1024AlgAesForEncryptPromise
+ * @tc.desc Success rsa 1024 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_27800', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_27900
+ * @tc.name SuccessRsa2048AlgAesForEncryptPromise
+ * @tc.desc Success rsa 2048 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_27900', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28000
+ * @tc.name SuccessRsa3072AlgAesForEncryptPromise
+ * @tc.desc Success rsa 3072 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_28000', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28100
+ * @tc.name SuccessRsa4096AlgAesForEncryptPromise
+ * @tc.desc Success rsa 4096 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_28100', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28200
+ * @tc.name SuccessEcc224AlgAesForEncryptPromise
+ * @tc.desc Success ecc 224 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_28200', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28300
+ * @tc.name SuccessEcc256AlgAesForEncryptPromise
+ * @tc.desc Success ecc 256 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_28300', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28400
+ * @tc.name SuccessEcc384AlgAesForEncryptPromise
+ * @tc.desc Success ecc 384 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_28400', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28500
+ * @tc.name SuccessEcc521AlgAesForEncryptPromise
+ * @tc.desc Success ecc 521 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_28500', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28600
+ * @tc.name SuccessCurve25519256AlgAesForEncryptPromise
+ * @tc.desc Success curve25519 256 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_28600', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28700
+ * @tc.name SuccessDh2048AlgAesForEncryptPromise
+ * @tc.desc Success dh 2048 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_28700', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28800
+ * @tc.name SuccessDh3072AlgAesForEncryptPromise
+ * @tc.desc Success dh 3072 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_28800', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_28900
+ * @tc.name SuccessDh4096AlgAesForEncryptPromise
+ * @tc.desc Success dh 4096 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_28900', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29000
+ * @tc.name InvalidPaddingPssPurposeEncryptDecryptAlgAesForEncryptPromise
+ * @tc.desc Invalid padding pss purpose encrypt decrypt alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_29000', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29100
+ * @tc.name InvalidPaddingPkcs5PurposeEncryptDecryptAlgAesForEncryptPromise
+ * @tc.desc Invalid padding pkcs5 purpose encrypt decrypt alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_29100', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29200
+ * @tc.name InvalidPaddingPkcs7PurposeEncryptDecryptAlgAesForEncryptPromise
+ * @tc.desc Invalid padding pkcs7 purpose encrypt decrypt alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_29200', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29300
+ * @tc.name SuccessDigestMd5AlgAesForEncryptPromise
+ * @tc.desc Success digest md5 alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_29300', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidDigestOption(hks.HuksKeyDigest.HUKS_DIGEST_MD5);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29400
+ * @tc.name InvalidArgumentIndataLargerThanKeySizeRsaPaddingNoneForEncryptPromise
+ * @tc.desc Invalid argument indata is larger than key size rsa padding none for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_29400', 0, async function (done) {
+ var option = generateRSAKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = rsaEncryptOrDecryptInvalidIndataOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29500
+ * @tc.name InvalidArgumentIndataLargerThanKeySizeAesPaddingNoneForEncryptPromise
+ * @tc.desc Invalid argument indata is larger than key size aes padding none for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_29500', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidIndataOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29600
+ * @tc.name InvalidPurposeDecryptAlgAesForEncryptPromise
+ * @tc.desc Invalid purpose decrypt alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_29600', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29700
+ * @tc.name InvalidPurposeSignAlgAesForEncryptPromise
+ * @tc.desc Invalid purpose sign alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_29700', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29800
+ * @tc.name InvalidPurposeVerifyAlgAesForEncryptPromise
+ * @tc.desc Invalid purpose verify alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_29800', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_29900
+ * @tc.name InvalidPurposeDeriveAlgAesForEncryptPromise
+ * @tc.desc Invalid purpose derive alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_29900', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30000
+ * @tc.name InvalidPurposeWrapAlgAesForEncryptPromise
+ * @tc.desc Invalid purpose wrap alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_30000', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30100
+ * @tc.name InvalidPurposeUnwrapAlgAesForEncryptPromise
+ * @tc.desc Invalid purpose unwrap alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_30100', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30200
+ * @tc.name InvalidPurposeMacAlgAesForEncryptPromise
+ * @tc.desc Invalid purpose mac alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_30200', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30300
+ * @tc.name InvalidPurposeagreeAlgAesForEncryptPromise
+ * @tc.desc Invalid purpose agree alg aes for encrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_30300', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30400
+ * @tc.name InvalidAlgorithmEccForDecryptPromise
+ * @tc.desc Invalid algorithm ecc for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_30400', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECC);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30500
+ * @tc.name InvalidAlgorithmDsaForDecryptPromise
+ * @tc.desc Invalid algorithm dsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_30500', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DSA);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30600
+ * @tc.name InvalidAlgorithmHmacForDecryptPromise
+ * @tc.desc Invalid algorithm hmac for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_30600', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HMAC);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30700
+ * @tc.name InvalidAlgorithmHkdfForDecryptPromise
+ * @tc.desc Invalid algorithm hkdf for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_30700', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30800
+ * @tc.name InvalidAlgorithmPbkdf2ForDecryptPromise
+ * @tc.desc Invalid algorithm pbkdf2 for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_30800', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_PBKDF2);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_30900
+ * @tc.name InvalidAlgorithmEcdhForDecryptPromise
+ * @tc.desc Invalid algorithm ecdh for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_30900', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECDH);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31000
+ * @tc.name InvalidAlgorithmX25519ForDecryptPromise
+ * @tc.desc Invalid algorithm x25519 for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_31000', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_X25519);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31100
+ * @tc.name InvalidAlgorithmEd25519ForDecryptPromise
+ * @tc.desc Invalid algorithm ed25519 for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_31100', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ED25519);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31200
+ * @tc.name InvalidAlgorithmDhForDecryptPromise
+ * @tc.desc Invalid algorithm dh for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_31200', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = encryptOrDecryptInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31300
+ * @tc.name SuccessEcc224AlgRsaForDecryptPromise
+ * @tc.desc Success ecc 224 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_31300', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31400
+ * @tc.name SuccessEcc256AlgRsaForDecryptPromise
+ * @tc.desc Success ecc 256 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_31400', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31500
+ * @tc.name SuccessEcc384AlgRsaForDecryptPromise
+ * @tc.desc Success ecc 384 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_31500', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31600
+ * @tc.name SuccessEcc521AlgRsaForDecryptPromise
+ * @tc.desc Success ecc 521 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_31600', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31700
+ * @tc.name SuccessAes128AlgRsaForDecryptPromise
+ * @tc.desc Success aes 128 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_31700', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_128, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31800
+ * @tc.name SuccessAes192AlgRsaForDecryptPromise
+ * @tc.desc Success aes 192 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_31800', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_192, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_31900
+ * @tc.name SuccessAes256AlgRsaForDecryptPromise
+ * @tc.desc Success aes 256 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_31900', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_256, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32000
+ * @tc.name SuccessAes512AlgRsaForDecryptPromise
+ * @tc.desc Success aes 512 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_32000', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_AES_KEY_SIZE_512, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32100
+ * @tc.name SuccessCurve25519256AlgRsaForDecryptPromise
+ * @tc.desc Success curve25519 256 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_32100', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32200
+ * @tc.name SuccessDh2048AlgRsaForDecryptPromise
+ * @tc.desc Success dh 2048 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_32200', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32300
+ * @tc.name SuccessDh3072AlgRsaForDecryptPromise
+ * @tc.desc Success dh 3072 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_32300', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32400
+ * @tc.name SuccessDh4096AlgRsaForDecryptPromise
+ * @tc.desc Success dh 4096 alg rsa for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_32400', 0, async function (done) {
+ var option = encryptOrDecryptGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var encryptOption = encryptOrDecryptOption();
+ var encryptRet = await hks.encrypt(alias, encryptOption);
+ expect(encryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ cipherText = encryptRet.outData;
+ var decryptOption = rsaDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096, cipherText);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32500
+ * @tc.name SuccessRsa512AlgAesForDecryptPromise
+ * @tc.desc Success rsa 512 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_32500', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32600
+ * @tc.name SuccessRsa768AlgAesForDecryptPromise
+ * @tc.desc Success rsa 768 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_32600', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_768);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32700
+ * @tc.name SuccessRsa1024AlgAesForDecryptPromise
+ * @tc.desc Success rsa 1024 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_32700', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32800
+ * @tc.name SuccessRsa2048AlgAesForDecryptPromise
+ * @tc.desc Success rsa 2048 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_32800', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_32900
+ * @tc.name SuccessRsa3072AlgAesForDecryptPromise
+ * @tc.desc Success rsa 3072 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_32900', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33000
+ * @tc.name SuccessRsa4096AlgAesForDecryptPromise
+ * @tc.desc Success rsa 4096 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_33000', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33100
+ * @tc.name SuccessEcc224AlgAesForDecryptPromise
+ * @tc.desc Success ecc 224 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_33100', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33200
+ * @tc.name SuccessEcc256AlgAesForDecryptPromise
+ * @tc.desc Success ecc 256 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_33200', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33300
+ * @tc.name SuccessEcc384AlgAesForDecryptPromise
+ * @tc.desc Success ecc 384 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_33300', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_384);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33400
+ * @tc.name SuccessEcc521AlgAesForDecryptPromise
+ * @tc.desc Success ecc 521 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_33400', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33500
+ * @tc.name Successcurve25519256AlgAesForDecryptPromise
+ * @tc.desc Success curve25519 256 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_33500', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33600
+ * @tc.name SuccessDh2048AlgAesForDecryptPromise
+ * @tc.desc Success dh 2048 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_33600', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_2048);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33700
+ * @tc.name SuccessDh3072AlgAesForDecryptPromise
+ * @tc.desc Success dh 3072 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_33700', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_3072);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33800
+ * @tc.name SuccessDh4096AlgAesForDecryptPromise
+ * @tc.desc Success dh 4096 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_33800', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidSizeOption(hks.HuksKeySize.HUKS_DH_KEY_SIZE_4096);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_33900
+ * @tc.name InvalidPaddingPssPurposeEncryptDecryptAlgAesForDecryptPromise
+ * @tc.desc Invalid padding pss purpose encrypt decrypt alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_33900', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PSS);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34000
+ * @tc.name InvalidPaddingPkcs5PurposeEncryptDecryptAlgAesForDecryptPromise
+ * @tc.desc Invalid padding pkcs5 purpose encrypt decrypt alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_34000', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34100
+ * @tc.name InvalidPaddingPkcs7PurposeEncryptDecryptAlgAesForDecryptPromise
+ * @tc.desc Invalid padding pkcs7 purpose encrypt decrypt alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_34100', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34200
+ * @tc.name SuccessDigestMd5AlgAesForDecryptPromise
+ * @tc.desc Success digest md5 alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_34200', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidDigestOption(hks.HuksKeyDigest.HUKS_DIGEST_MD5);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34300
+ * @tc.name InvalidArgumentIndataLargerThanKeySizeRsaPaddingNoneForDecryptPromise
+ * @tc.desc Invalid argument indata is larger than key size rsa padding none for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_34300', 0, async function (done) {
+ var option = generateRSAKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = rsaEncryptOrDecryptInvalidIndataOption();
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34400
+ * @tc.name InvalidArgumentIndataLargerThanKeySizeAesPaddingNoneForDecryptPromise
+ * @tc.desc Invalid argument indata is larger than key size aes padding none for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_34400', 0, async function (done) {
+ var option = generateAesCBCKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidIndataOption();
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34500
+ * @tc.name InvalidPurposeEncryptAlgAesForDecryptPromise
+ * @tc.desc Invalid purpose encrypt alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_34500', 0, async function (done) {
+ var option = generateAesGCMKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34600
+ * @tc.name InvalidPurposeSignAlgAesForDecryptPromise
+ * @tc.desc Invalid purpose sign alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_34600', 0, async function (done) {
+ var option = generateAesGCMKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34700
+ * @tc.name InvalidPurposeVerifyAlgAesForDecryptPromise
+ * @tc.desc Invalid purpose verify alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_34700', 0, async function (done) {
+ var option = generateAesGCMKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34800
+ * @tc.name InvalidPurposeDeriveAlgAesForDecryptPromise
+ * @tc.desc Invalid purpose derive alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_34800', 0, async function (done) {
+ var option = generateAesGCMKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_34900
+ * @tc.name InvalidPurposeWrapAlgAesForDecryptPromise
+ * @tc.desc Invalid purpose wrap alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_34900', 0, async function (done) {
+ var option = generateAesGCMKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35000
+ * @tc.name InvalidPurposeUnwrapAlgAesForDecryptPromise
+ * @tc.desc Invalid purpose unwrap alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_35000', 0, async function (done) {
+ var option = generateAesGCMKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35100
+ * @tc.name InvalidPurposeMacAlgAesForDecryptPromise
+ * @tc.desc Invalid purpose mac alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_35100', 0, async function (done) {
+ var option = generateAesGCMKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_CALLBACK_35200
+ * @tc.name InvalidPurposeAgreeAlgAesForDecryptPromise
+ * @tc.desc Invalid purpose agree alg aes for decrypt promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_35200', 0, async function (done) {
+ var option = generateAesGCMKeyOption;
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var decryptOption = aesEncryptOrDecryptInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ var decryptRet = await hks.decrypt(alias, decryptOption);
+ expect(decryptRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+});
+
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part4.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part4.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..db3d6ca5a0a021089ecf0a7a2178496977659727
--- /dev/null
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part4.test.js
@@ -0,0 +1,600 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hks from '@ohos.security.huks'
+import { describe, it, expect } from 'deccjsunit/index'
+import {
+ alias,
+} from '../../../../../../hks_xts_common.test'
+import {
+ plainTextSize64,
+ signOrVerifyGenerateKeyOption,
+ signOrVerifyInvalidAlgOption,
+ signOrVerifyInvalidPurposeOption,
+ signOrVerifyInvalidPaddingOption,
+} from './hks_abnormal_common.test.js'
+
+describe('Hks_Abnormal_Promise_Part4', function () {
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_35300
+ * @tc.name InvalidAlgorithmAlgAesForSignPromise
+ * @tc.desc Invalid algorithm alg aes for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_35300', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_AES);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_35400
+ * @tc.name InvalidAlgorithmAlghmacForSignPromise
+ * @tc.desc Invalid algorithm alg hmac for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_35400', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HMAC);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_35500
+ * @tc.name InvalidAlgorithmAlgHkdfForSignPromise
+ * @tc.desc Invalid algorithm alg hkdf for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_35500', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_35600
+ * @tc.name InvalidAlgorithmAlgPbkdf2ForSignPromise
+ * @tc.desc Invalid algorithm alg pbkdf2 for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_35600', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_PBKDF2);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_35700
+ * @tc.name InvalidAlgorithmAlgEcdhForSignPromise
+ * @tc.desc Invalid algorithm alg ecdh for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_35700', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECDH);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_35800
+ * @tc.name InvalidAlgorithmAlgX25519ForSignPromise
+ * @tc.desc Invalid algorithm alg x25519 for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_35800', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_X25519);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_35900
+ * @tc.name InvalidAlgorithmAlgDhForSignPromise
+ * @tc.desc Invalid algorithm alg dh for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_35900', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_36000
+ * @tc.name InvalidPurposeEncryptForSignPromise
+ * @tc.desc Invalid purpose encrypt for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_36000', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_36100
+ * @tc.name InvalidPurposeDecryptForSignPromise
+ * @tc.desc Invalid purpose decrypt for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_36100', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_36200
+ * @tc.name InvalidPurposeVerifyForSignPromise
+ * @tc.desc Invalid purpose verify for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_36200', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_36300
+ * @tc.name InvalidPurposeDeriveForSignPromise
+ * @tc.desc Invalid purpose derive for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_36300', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_36400
+ * @tc.name InvalidPurposeWrapForSignPromise
+ * @tc.desc Invalid purpose wrap for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_36400', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_36500
+ * @tc.name InvalidPurposeUnwrapForSignPromise
+ * @tc.desc Invalid purpose unwrap for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_36500', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_36600
+ * @tc.name InvalidPurposeMacForSignPromise
+ * @tc.desc Invalid purpose mac for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_36600', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_36700
+ * @tc.name InvalidPurposeAgreeForSignPromise
+ * @tc.desc Invalid purpose agree for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_36700', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_36800
+ * @tc.name InvalidPaddingNoneAlgRsaForSignPromise
+ * @tc.desc Invalid padding none alg rsa for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_36800', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_NONE);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_36900
+ * @tc.name InvalidPaddingOaepAlgRsaForSignPromise
+ * @tc.desc Invalid padding oaep alg rsa for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_36900', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_37000
+ * @tc.name InvalidPaddingPkcs5AlgRsaForSignPromise
+ * @tc.desc Invalid padding pkcs5 alg rsa for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_37000', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_37100
+ * @tc.name InvalidPaddingPkcs7AlgRsaForSignPromise
+ * @tc.desc Invalid padding pkcs7 alg rsa for sign promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_37100', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var signOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ var signRet = await hks.sign(alias, signOption);
+ expect(signRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_37200
+ * @tc.name InvalidAlgorithmAlgAesForVerifyPromise
+ * @tc.desc Invalid algorithm alg aes for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_37200', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_AES);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_37300
+ * @tc.name InvalidAlgorithmAlgHmacForVerifyPromise
+ * @tc.desc Invalid algorithm alg hmac for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_37300', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HMAC);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_37400
+ * @tc.name InvalidAlgorithmAlgHkdfForVerifyPromise
+ * @tc.desc Invalid algorithm alg hkdf for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_37400', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_37500
+ * @tc.name InvalidAlgorithmAlgPbkdf2ForVerifyPromise
+ * @tc.desc Invalid algorithm alg pbkdf2 for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_37500', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_PBKDF2);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_37600
+ * @tc.name InvalidAlgorithmAlgEcdhForVerifyPromise
+ * @tc.desc Invalid algorithm alg ecdh for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_37600', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECDH);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_37700
+ * @tc.name InvalidAlgorithmAlgX25519ForVerifyPromise
+ * @tc.desc Invalid algorithm alg x25519 for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_37700', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_X25519);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_37800
+ * @tc.name InvalidAlgorithmAlgDhForVerifyPromise
+ * @tc.desc Invalid algorithm alg dh for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_37800', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DH);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_37900
+ * @tc.name InvalidAlgorithmEncryptForVerifyPromise
+ * @tc.desc Invalid purpose encrypt for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_37900', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_38000
+ * @tc.name InvalidAlgorithmDecryptForVerifyPromise
+ * @tc.desc Invalid purpose decrypt for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_38000', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_38100
+ * @tc.name InvalidAlgorithmSignForVerifyPromise
+ * @tc.desc Invalid purpose sign for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_38100', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_38200
+ * @tc.name InvalidAlgorithmDeriveForVerifyPromise
+ * @tc.desc Invalid purpose derive for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_38200', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_38300
+ * @tc.name InvalidAlgorithmWrapForVerifyPromise
+ * @tc.desc Invalid purpose wrap for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_38300', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_38400
+ * @tc.name InvalidAlgorithmUnwrapForVerifyPromise
+ * @tc.desc Invalid purpose unwrap for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_38400', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_38500
+ * @tc.name InvalidAlgorithmMacForVerifyPromise
+ * @tc.desc Invalid purpose mac for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_38500', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_38600
+ * @tc.name InvalidAlgorithmAgreeForVerifyPromise
+ * @tc.desc Invalid purpose agree for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_38600', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPurposeOption(hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_38700
+ * @tc.name InvalidPaddingNoneAlgRsaForVerifyPromise
+ * @tc.desc Invalid padding none alg rsa for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_38700', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_NONE);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_38800
+ * @tc.name InvalidPaddingOaepAlgRsaForVerifyPromise
+ * @tc.desc Invalid padding oaep alg rsa for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_38800', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_OAEP);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_38900
+ * @tc.name InvalidPaddingPksc5AlgRsaForVerifyPromise
+ * @tc.desc Invalid padding pksc5 alg rsa for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_38900', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS5);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_39000
+ * @tc.name InvalidPaddingPkcs7AlgRsaForVerifyPromise
+ * @tc.desc Invalid padding pkcs7 alg rsa for verify promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_39000', 0, async function (done) {
+ var option = signOrVerifyGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var verifyOption = signOrVerifyInvalidPaddingOption(hks.HuksKeyPadding.HUKS_PADDING_PKCS7);
+ var verifyRet = await hks.verify(alias, verifyOption, plainTextSize64);
+ expect(verifyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+});
\ No newline at end of file
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part5.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part5.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdd7cb4b668e15480b4dc85147d6ee644d7fb918
--- /dev/null
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part5.test.js
@@ -0,0 +1,345 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hks from '@ohos.security.huks'
+import { describe, it, expect } from 'deccjsunit/index'
+import {
+ alias,
+} from '../../../../../../hks_xts_common.test'
+import {
+ generateAgreeKeyOption,
+ hmacGenerateKeyOption,
+ agreeInvalidAlgOption,
+ hmacInvalidPurposeOption,
+} from './hks_abnormal_common.test.js'
+
+describe('Hks_Abnormal_Promise_Part5', function () {
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_39100
+ * @tc.name InvalidAlgorithmAlgRsaForAgreeKeyPromise
+ * @tc.desc Invalid algorithm alg rsa for agree key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_39100', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_RSA);
+ agreeOption.inData = exportKeyRet.outData
+ var agreeRet = await hks.agreeKey(alias, agreeOption);
+ expect(agreeRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_39200
+ * @tc.name InvalidAlgorithmAlgEccForAgreeKeyPromise
+ * @tc.desc Invalid algorithm alg ecc for agree key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_39200', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ECC);
+ agreeOption.inData = exportKeyRet.outData
+ var agreeRet = await hks.agreeKey(alias, agreeOption);
+ expect(agreeRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_39300
+ * @tc.name InvalidAlgorithmAlgDsaForAgreeKeyPromise
+ * @tc.desc Invalid algorithm alg dsa for agree key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_39300', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_DSA);
+ agreeOption.inData = exportKeyRet.outData
+ var agreeRet = await hks.agreeKey(alias, agreeOption);
+ expect(agreeRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_39400
+ * @tc.name InvalidAlgorithmAlgAesForAgreeKeyPromise
+ * @tc.desc Invalid algorithm alg aes for agree key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_39400', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_AES);
+ agreeOption.properties[1].value = hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256;
+ agreeOption.inData = exportKeyRet.outData
+ var agreeRet = await hks.agreeKey(alias, agreeOption);
+ expect(agreeRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_39500
+ * @tc.name InvalidAlgorithmAlgHmacForAgreeKeyPromise
+ * @tc.desc Invalid algorithm alg hmac for agree key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_39500', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HMAC);
+ agreeOption.inData = exportKeyRet.outData
+ var agreeRet = await hks.agreeKey(alias, agreeOption);
+ expect(agreeRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_39600
+ * @tc.name InvalidAlgorithmAlgHkdfForAgreeKeyPromise
+ * @tc.desc Invalid algorithm alg hkdf for agree key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_39600', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_HKDF);
+ agreeOption.inData = exportKeyRet.outData
+ var agreeRet = await hks.agreeKey(alias, agreeOption);
+ expect(agreeRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_39700
+ * @tc.name InvalidAlgorithmAlgPbkdf2ForAgreeKeyPromise
+ * @tc.desc Invalid algorithm alg pbkdf2 for agree key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_39700', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_PBKDF2);
+ agreeOption.inData = exportKeyRet.outData
+ var agreeRet = await hks.agreeKey(alias, agreeOption);
+ expect(agreeRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_39800
+ * @tc.name InvalidAlgorithmAlgEd25519ForAgreeKeyPromise
+ * @tc.desc Invalid algorithm alg ed25519 for agree key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_39800', 0, async function (done) {
+ var option = generateAgreeKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(alias, option);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var agreeOption = agreeInvalidAlgOption(hks.HuksKeyAlg.HUKS_ALG_ED25519);
+ agreeOption.properties[1].value = hks.HuksKeySize.HUKS_ECC_KEY_SIZE_256;
+ agreeOption.inData = exportKeyRet.outData
+ var agreeRet = await hks.agreeKey(alias, agreeOption);
+ expect(agreeRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_39900
+ * @tc.name InvalidPurposeEncryptForMacPromise
+ * @tc.desc Invalid purpose encrypt for mac promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_39900', 0, async function (done) {
+ var option = hmacGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ var macRet = await hks.mac(alias, macOption);
+ expect(macRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_40000
+ * @tc.name InvalidPurposeDecryptForMacPromise
+ * @tc.desc Invalid purpose decrypt for mac promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_40000', 0, async function (done) {
+ var option = hmacGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ var macRet = await hks.mac(alias, macOption);
+ expect(macRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_40100
+ * @tc.name InvalidPurposeSignForMacPromise
+ * @tc.desc Invalid purpose sign for mac promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_40100', 0, async function (done) {
+ var option = hmacGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ var macRet = await hks.mac(alias, macOption);
+ expect(macRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_40200
+ * @tc.name InvalidPurposeVerifyForMacPromise
+ * @tc.desc Invalid purpose verify for mac promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_40200', 0, async function (done) {
+ var option = hmacGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ var macRet = await hks.mac(alias, macOption);
+ expect(macRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_40300
+ * @tc.name InvalidPurposeDeriveForMacPromise
+ * @tc.desc Invalid purpose derive for mac promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_40300', 0, async function (done) {
+ var option = hmacGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ var macRet = await hks.mac(alias, macOption);
+ expect(macRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_40400
+ * @tc.name InvalidPurposeWrapForMacPromise
+ * @tc.desc Invalid purpose wrap for mac promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_40400', 0, async function (done) {
+ var option = hmacGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_WRAP,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ var macRet = await hks.mac(alias, macOption);
+ expect(macRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_40500
+ * @tc.name InvalidPurposeUnwrapForMacPromise
+ * @tc.desc Invalid purpose unwrap for mac promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_40500', 0, async function (done) {
+ var option = hmacGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ var macRet = await hks.mac(alias, macOption);
+ expect(macRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_40600
+ * @tc.name InvalidPurposeAgreeForMacPromise
+ * @tc.desc Invalid purpose agree for mac promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_40600', 0, async function (done) {
+ var option = hmacGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
+ hks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ var macRet = await hks.mac(alias, macOption);
+ expect(macRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_40700
+ * @tc.name InvalidDigestNoneForMacPromise
+ * @tc.desc Invalid digest none for mac promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_40700', 0, async function (done) {
+ var option = hmacGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ hks.HuksKeyDigest.HUKS_DIGEST_NONE);
+ var macRet = await hks.mac(alias, macOption);
+ expect(macRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_40800
+ * @tc.name InvalidDigestMd5ForMacPromise
+ * @tc.desc Invalid digest md5 for mac promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_40800', 0, async function (done) {
+ var option = hmacGenerateKeyOption();
+ var ret = await hks.generateKey(alias, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var macOption = hmacInvalidPurposeOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ hks.HuksKeyDigest.HUKS_DIGEST_MD5);
+ var macRet = await hks.mac(alias, macOption);
+ expect(macRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
+ done();
+ });
+});
\ No newline at end of file
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part6.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part6.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..c59e3f6f334c3bb541a2dd995fb337825b309e32
--- /dev/null
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_promise_part6.test.js
@@ -0,0 +1,669 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hks from '@ohos.security.huks'
+import { describe, it, expect } from 'deccjsunit/index'
+import {
+ aliasA,
+ aliasB,
+} from '../../../../../../hks_xts_common.test'
+import {
+ generateImportKeyOption,
+ eccGenerateKeyOption,
+ importOptionsInvalidAlgOption,
+ importOptionsInvalidSizeOption,
+ importOptionsInvalidPurposeOrPaddingOption,
+} from './hks_abnormal_common.test.js'
+
+describe('Hks_Abnormal_Promise_Part6', function () {
+ var publicKey = [];
+
+ var emptyOption = makeEmptyOptions();
+
+ function makeEmptyOptions() {
+ var emptyOptions = {
+ properties: []
+ };
+ return emptyOptions;
+ };
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_40900
+ * @tc.name InvalidPurposeDeriveAlgRsaForImportKeyPromise
+ * @tc.desc Invalid purpose derive alg rsa for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_40900', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_41000
+ * @tc.name InvalidPurposeDeriveAlgEccForImportKeyPromise
+ * @tc.desc Invalid purpose derive alg ecc for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_41000', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_41100
+ * @tc.name InvalidPurposeDeriveAlgDsaForImportKeyPromise
+ * @tc.desc Invalid purpose derive alg dsa for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_41100', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_DSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_41200
+ * @tc.name InvalidPurposeDeriveAlgHkdfForImportKeyPromise
+ * @tc.desc Invalid purpose derive alg hkdf for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_41200', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_HKDF,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_41300
+ * @tc.name InvalidPurposeDeriveAlgPbkdf2ForImportKeyPromise
+ * @tc.desc Invalid purpose derive alg pbkdf2 for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_41300', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_PBKDF2,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_41400
+ * @tc.name InvalidPurposeDeriveAlgEcdhForImportKeyPromise
+ * @tc.desc Invalid purpose derive alg ecdh for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_41400', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECDH,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_41500
+ * @tc.name InvalidPurposeDeriveAlgX25519ForImportKeyPromise
+ * @tc.desc Invalid purpose derive alg x25519 for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_41500', 0, async function (done) {
+ var option = eccGenerateKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_X25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_41600
+ * @tc.name InvalidPurposeDeriveAlgEd25519ForImportKeyPromise
+ * @tc.desc Invalid purpose derive alg ed25519 for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_41600', 0, async function (done) {
+ var option = eccGenerateKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ED25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_41700
+ * @tc.name InvalidPurposeDeriveAlgDhForImportKeyPromise
+ * @tc.desc Invalid purpose derive alg dh for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_41700', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_DH,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_41800
+ * @tc.name InvalidPurposeMacAlgRsaForImportKeyPromise
+ * @tc.desc Invalid purpose mac alg rsa for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_41800', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_RSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_41900
+ * @tc.name InvalidPurposeMacAlgEccForImportKeyPromise
+ * @tc.desc Invalid purpose mac alg ecc for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_41900', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECC,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_42000
+ * @tc.name InvalidPurposeMacAlgDsaForImportKeyPromise
+ * @tc.desc Invalid purpose mac alg dsa for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_42000', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_DSA,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_42100
+ * @tc.name InvalidPurposeMacAlgHkdfForImportKeyPromise
+ * @tc.desc Invalid purpose mac alg hkdf for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_42100', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_HKDF,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_42200
+ * @tc.name InvalidPurposeMacAlgPbkdf2ForImportKeyPromise
+ * @tc.desc Invalid purpose mac alg pbkdf2 for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_42200', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_PBKDF2,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_42300
+ * @tc.name InvalidPurposeMacAlgEcdhForImportKeyPromise
+ * @tc.desc Invalid purpose mac alg ecdh for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_42300', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ECDH,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_42400
+ * @tc.name InvalidPurposeMacAlgX25519ForImportKeyPromise
+ * @tc.desc Invalid purpose mac alg x25519 for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_42400', 0, async function (done) {
+ var option = eccGenerateKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_X25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_42500
+ * @tc.name InvalidPurposeMacAlgEd25519ForImportKeyPromise
+ * @tc.desc Invalid purpose mac alg ed25519 for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_42500', 0, async function (done) {
+ var option = eccGenerateKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_ED25519,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_42600
+ * @tc.name InvalidPurposeMacAlgDhForImportKeyPromise
+ * @tc.desc Invalid purpose mac alg dh for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_42600', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidAlgOption(
+ hks.HuksKeyAlg.HUKS_ALG_DH,
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_42700
+ * @tc.name GenerateAndImportKeySizeDifferentAesForImportKeyPromise
+ * @tc.desc Generate key and import key have different key size aes for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_42700', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidSizeOption(hks.HuksKeyAlg.HUKS_ALG_AES, publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_42800
+ * @tc.name GenerateAndImportKeySizeDifferentRsaForImportKeyPromise
+ * @tc.desc Generate key and import key have different key size rsa for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_42800', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidSizeOption(hks.HuksKeyAlg.HUKS_ALG_RSA, publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_42900
+ * @tc.name GenerateAndImportKeySizeDifferentEccForImportKeyPromise
+ * @tc.desc Generate key and import key have different key size ecc for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_42900', 0, async function (done) {
+ var option = eccGenerateKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidSizeOption(hks.HuksKeyAlg.HUKS_ALG_ECC, publicKey);
+ importOptions.properties[1].value = hks.HuksKeySize.HUKS_ECC_KEY_SIZE_521;
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_INFO);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_43000
+ * @tc.name InvalidPurposeDecryptForImportKeyPromise
+ * @tc.desc Invalid purpose decrypt for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_43000', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_43100
+ * @tc.name InvalidPurposeSignForImportKeyPromise
+ * @tc.desc Invalid purpose sign for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_43100', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_43200
+ * @tc.name InvalidPaddingNonePurposeEncryptForImportKeyPromise
+ * @tc.desc Invalid padding none purpose encrypt for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_43200', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var purpose = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT;
+ option.properties[2].value = purpose;
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PSS,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_43300
+ * @tc.name InvalidPaddingPkcs5PurposeEncryptForImportKeyPromise
+ * @tc.desc Invalid padding pkcs5 purpose encrypt for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_43300', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var purpose = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT;
+ option.properties[2].value = purpose;
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_43400
+ * @tc.name InvalidPaddingPkcs7PurposeEncryptForImportKeyPromise
+ * @tc.desc Invalid padding pkcs7 purpose encrypt for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_43400', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var purpose = hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT;
+ option.properties[2].value = purpose;
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_43500
+ * @tc.name InvalidPaddingNonePurposeVerifyForImportKeyPromise
+ * @tc.desc Invalid padding none purpose verify for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_43500', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_NONE,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_43600
+ * @tc.name InvalidPaddingOaepPurposeVerifyForImportKeyPromise
+ * @tc.desc Invalid padding oaep purpose verify for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_43600', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_43700
+ * @tc.name InvalidPaddingPkcs5PurposeVerifyForImportKeyPromise
+ * @tc.desc Invalid padding pkcs5 purpose verify for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_43700', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS5,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ABNORMAL_PROMISE_43800
+ * @tc.name InvalidPaddingPkcs7PurposeVerifyForImportKeyPromise
+ * @tc.desc Invalid padding pkcs7 purpose verify for import key promise.
+ */
+ it('HUKS_ABNORMAL_PROMISE_43800', 0, async function (done) {
+ var option = generateImportKeyOption();
+ var ret = await hks.generateKey(aliasA, option);
+ expect(ret.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ var exportKeyRet = await hks.exportKey(aliasA, emptyOption);
+ expect(exportKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_SUCCESS);
+ publicKey = exportKeyRet.outData;
+ var importOptions = importOptionsInvalidPurposeOrPaddingOption(
+ hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ hks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ publicKey);
+ var importKeyRet = await hks.importKey(aliasB, importOptions);
+ expect(importKeyRet.errorCode).assertEqual(hks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
+ done();
+ });
+});
\ No newline at end of file
diff --git a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_testList.test.js b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_testList.test.js
index 9c76a0f2cdf8bf6cad2924ac0d08ff09e1873e37..be118a2543b409da8c5a92996ad51b888bbcba71 100644
--- a/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_testList.test.js
+++ b/security/huks_standard/HuksAbnormalTest/entry/src/main/js/test/hks_abnormal_testList.test.js
@@ -13,6 +13,15 @@
* limitations under the License.
*/
-require('./hks_abnormal_promise.test.js');
-
-require('./hks_abnormal_callback.test.js');
\ No newline at end of file
+require('./hks_abnormal_promise_part1.test.js');
+require('./hks_abnormal_promise_part2.test');
+require('./hks_abnormal_promise_part3.test');
+require('./hks_abnormal_promise_part4.test');
+require('./hks_abnormal_promise_part5.test');
+require('./hks_abnormal_promise_part6.test');
+require('./hks_abnormal_callback_part1.test.js');
+require('./hks_abnormal_callback_part2.test');
+require('./hks_abnormal_callback_part3.test');
+require('./hks_abnormal_callback_part4.test');
+require('./hks_abnormal_callback_part5.test');
+require('./hks_abnormal_callback_part6.test');
diff --git a/security/huks_standard/HuksAlgCompletionTest/Test.json b/security/huks_standard/HuksAlgCompletionTest/Test.json
index fba02d79f6abeff166ab522c9f751aaf474a840b..f7121dd29833e416c14b4a9295e93dd9237539f3 100644
--- a/security/huks_standard/HuksAlgCompletionTest/Test.json
+++ b/security/huks_standard/HuksAlgCompletionTest/Test.json
@@ -2,7 +2,7 @@
"description": "Configuration for algorithm completion test",
"driver": {
"type": "JSUnitTest",
- "test-timeout": "3000000",
+ "test-timeout": "26000000",
"package": "com.example.hksxtstest",
"shell-timeout": "60000"
},
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/common/images/Wallpaper.png b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/common/images/Wallpaper.png
new file mode 100644
index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48
Binary files /dev/null and b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/common/images/Wallpaper.png differ
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/common/images/bg-tv.jpg b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/common/images/bg-tv.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89
Binary files /dev/null and b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/common/images/bg-tv.jpg differ
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.css b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.css
index d9193e94fd6a911f2027c0320833f5111a6e4dec..f96e198556759fe591de240be0baaaa43dafc110 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.css
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.css
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
.container {
flex-direction: column;
justify-content: center;
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.hml b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.hml
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..546cd8296b727c1639d551d2301a0bca055c1457 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.hml
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.hml
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
{{ $t('strings.hello') }} {{ title }}
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.js b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.js
index f2a68b26402ba97deeb5157fdceb24a2317f084c..97a9962320e534900da6449525c42dcd7b40e65e 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.js
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/default/pages/index/index.js
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_ca.test.js b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_ca.test.js
index 609c21b685130a771e292d001e43da32e47e6478..a2446e4859560704c55ea537706d98b7aa1f1c8a 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_ca.test.js
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_ca.test.js
@@ -32,16 +32,16 @@ describe('HuksTest_JSApiTest_CA', function () {
*/
it('HuksTest_JSApiTest_CA_00100', 0, async function (done) {
var attestKeyRet = await huks.attestKey(alias, emptyOption);
- expect(attestKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(attestKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
var getCertificateChainRet = await huks.getCertificateChain(alias, emptyOption);
- expect(getCertificateChainRet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(getCertificateChainRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
var wrapKeyRet = await huks.wrapKey(alias, targetAlias, emptyOption);
- expect(wrapKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(wrapKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
var unwrapKeyRet = await huks.unwrapKey(alias, targetAlias, inDataOption);
- expect(unwrapKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(unwrapKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
done();
setTimeout(function () {
@@ -50,48 +50,48 @@ describe('HuksTest_JSApiTest_CA', function () {
/**
* @tc.number HuksTest_JSApiTest_CA_00200
- * @tc.name JSAPI_Test_CA
+ * @tc.name JSAPI_Test_attestKey
* @tc.desc Test for attestKey.
*/
it('HuksTest_JSApiTest_CA_00200', 0, async function (done) {
huks.attestKey(alias, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
done();
});
});
/**
* @tc.number HuksTest_JSApiTest_CA_00300
- * @tc.name JSAPI_Test_CA
- * @tc.desc Test for attestKey.
+ * @tc.name JSAPI_Test_getCertificateChain
+ * @tc.desc Test for getCertificateChain.
*/
it('HuksTest_JSApiTest_CA_00300', 0, async function (done) {
huks.getCertificateChain(alias, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
done();
});
});
/**
* @tc.number HuksTest_JSApiTest_CA_00400
- * @tc.name JSAPI_Test_CA
- * @tc.desc Test for attestKey.
+ * @tc.name JSAPI_Test_wrapKey
+ * @tc.desc Test for wrapKey.
*/
it('HuksTest_JSApiTest_CA_00400', 0, async function (done) {
huks.wrapKey(alias, targetAlias, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
done();
});
});
/**
* @tc.number HuksTest_JSApiTest_CA_00500
- * @tc.name JSAPI_Test_CA
- * @tc.desc Test for attestKey.
+ * @tc.name JSAPI_Test_unwrapKey
+ * @tc.desc Test for unwrapKey.
*/
it('HuksTest_JSApiTest_CA_00500', 0, async function (done) {
huks.unwrapKey(alias, targetAlias, inDataOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
done();
});
});
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_deriveKey.test.js b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_deriveKey.test.js
index f69e32050ad94fe8aa8929bf47c116d08c8ed3ed..502dc7878c7ecc68b5bf81ad6d84212880eec244 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_deriveKey.test.js
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_deriveKey.test.js
@@ -25,23 +25,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
function makeGenerateKeyOption(digest) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_AES
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_AES
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: huks.HksKeySize.HKS_AES_KEY_SIZE_128
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
+ value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_DERIVE
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
- value: huks.HksCipherMode.HKS_MODE_CBC
+ tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
+ value: huks.HuksCipherMode.HUKS_MODE_CBC
};
properties[4] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
value: digest
};
var options = {
@@ -53,15 +53,15 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
function makeHKDFDeriveOption(digest) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_HKDF
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_HKDF
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_DERIVE
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
value: digest
};
var options = {
@@ -73,23 +73,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
function makePBKDF2DeriveOption(digest, iteration, salt) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_PBKDF2
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_PBKDF2
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_DERIVE
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DERIVE
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
value: digest
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_ITERATION,
+ tag: huks.HuksTag.HUKS_TAG_ITERATION,
value: iteration
};
properties[4] = {
- tag: huks.HksTag.HKS_TAG_SALT,
+ tag: huks.HuksTag.HUKS_TAG_SALT,
value: salt
};
var options = {
@@ -100,7 +100,7 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
function deleteKey(done) {
huks.deleteKey('alias1', emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
isKeyExist(done);
});
};
@@ -114,23 +114,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_00100
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromiseGenerateSha256HkdfDeriveNone
+ * @tc.desc Promise generate key digest sha256 hkdf derive key digest none.
*/
it('HuksTest_JSApiTest_DeriveKey_00100', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_00100 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_NONE);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_NONE);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(deriveKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(deriveKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
var deleteKeyResult = await huks.deleteKey('alias1', emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_00100 end');
@@ -141,23 +141,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_00200
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromiseGenerateSha256HkdfDeriveMd5
+ * @tc.desc Promise generate key digest sha256 hkdf derive key digest md5.
*/
it('HuksTest_JSApiTest_DeriveKey_00200', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_00200 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_MD5);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_MD5);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(deriveKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(deriveKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
var deleteKeyResult = await huks.deleteKey('alias1', emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_00200 end');
@@ -168,23 +168,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_00300
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromiseGenerateSha256HkdfDeriveSha1
+ * @tc.desc Promise generate key digest sha256 hkdf derive key digest sha1.
*/
it('HuksTest_JSApiTest_DeriveKey_00300', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_00300 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA1);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA1);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT).assertEqual(deriveKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT).assertEqual(deriveKeyResult.errorCode);
var deleteKeyResult = await huks.deleteKey('alias1', emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_00300 end');
@@ -195,23 +195,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_00400
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromiseGenerateSha256HkdfDeriveSha224
+ * @tc.desc Promise generate key digest sha256 hkdf derive key digest sha224.
*/
it('HuksTest_JSApiTest_DeriveKey_00400', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_00400 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA224);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA224);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT).assertEqual(deriveKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT).assertEqual(deriveKeyResult.errorCode);
var deleteKeyResult = await huks.deleteKey('alias1', emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_00400 end');
@@ -222,23 +222,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_00500
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromiseGenerateSha256HkdfDeriveSha256
+ * @tc.desc Promise generate key digest sha256 hkdf derive key digest sha256.
*/
it('HuksTest_JSApiTest_DeriveKey_00500', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_00500 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(deriveKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deriveKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var deleteResult = await huks.deleteKey('alias1', emptyOption);
- expect(deleteResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deleteResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_00500 end');
@@ -249,23 +249,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_00600
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromiseGenerateSha384HkdfDeriveSha384
+ * @tc.desc Promise generate key digest sha384 hkdf derive key digest sha384.
*/
it('HuksTest_JSApiTest_DeriveKey_00600', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_00500 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA384);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA384);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA384);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA384);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(deriveKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deriveKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var deleteResult = await huks.deleteKey('alias1', emptyOption);
- expect(deleteResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deleteResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_00500 end');
@@ -276,23 +276,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_00700
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromiseGenerateSha512HkdfDeriveSha512
+ * @tc.desc Promise generate key digest sha512 hkdf derive key digest sha512.
*/
it('HuksTest_JSApiTest_DeriveKey_00700', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_00700 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA512);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA512);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA512);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA512);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(deriveKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deriveKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var deleteResult = await huks.deleteKey('alias1', emptyOption);
- expect(deleteResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deleteResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_00700 end');
@@ -303,21 +303,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_00800
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackGenerateSha256HkdfDeriveNone
+ * @tc.desc Callback generate key digest sha256 hkdf derive key digest none.
*/
it('HuksTest_JSApiTest_DeriveKey_00800', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_00800 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_NONE);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_NONE);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('data' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log('HuksTest_JSApiTest_DeriveKey_00800 end');
deleteKey(done);
});
@@ -327,21 +327,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_00900
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackGenerateSha256HkdfDeriveMd5
+ * @tc.desc Callback generate key digest sha256 hkdf derive key digest md5.
*/
it('HuksTest_JSApiTest_DeriveKey_00900', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_00900 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_MD5);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_MD5);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('data' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log('HuksTest_JSApiTest_DeriveKey_00900 end');
deleteKey(done);
});
@@ -351,21 +351,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_01000
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackGenerateSha256HkdfDeriveSha1
+ * @tc.desc Callback generate key digest sha256 hkdf derive key digest sha1.
*/
it('HuksTest_JSApiTest_DeriveKey_01000', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_01000 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA1);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA1);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('data' + JSON.stringify(data));
- expect(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT).assertEqual(data.errorCode);
+ expect(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT).assertEqual(data.errorCode);
console.log('HuksTest_JSApiTest_DeriveKey_01000 end');
deleteKey(done);
});
@@ -375,21 +375,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_01100
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackGenerateSha256HkdfDeriveSha224
+ * @tc.desc Callback generate key digest sha256 hkdf derive key digest sha224.
*/
it('HuksTest_JSApiTest_DeriveKey_01100', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_01100 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA224);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA224);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('data' + JSON.stringify(data));
- expect(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT).assertEqual(data.errorCode);
+ expect(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT).assertEqual(data.errorCode);
console.log('HuksTest_JSApiTest_DeriveKey_01100 end');
deleteKey(done);
});
@@ -399,21 +399,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_01200
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackGenerateSha256HkdfDeriveSha256
+ * @tc.desc Callback generate key digest sha256 hkdf derive key digest sha256.
*/
it('HuksTest_JSApiTest_DeriveKey_01200', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_01200 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('data' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HuksTest_JSApiTest_DeriveKey_01200 end');
deleteKey(done);
});
@@ -423,21 +423,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_01300
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackGenerateSha384HkdfDeriveSha384
+ * @tc.desc Callback generate key digest sha384 hkdf derive key digest sha384.
*/
it('HuksTest_JSApiTest_DeriveKey_01300', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_01300 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA384);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA384);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA384);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA384);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('data' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HuksTest_JSApiTest_DeriveKey_01300 end');
deleteKey(done);
});
@@ -447,21 +447,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_01400
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackGenerateSha512HkdfDeriveSha512
+ * @tc.desc Callback generate key digest sha512 hkdf derive key digest sha512.
*/
it('HuksTest_JSApiTest_DeriveKey_01400', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_01400 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA512);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA512);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA512);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makeHKDFDeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA512);
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('data' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HuksTest_JSApiTest_DeriveKey_01400 end');
deleteKey(done);
});
@@ -471,23 +471,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_01500
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromiseGenerateSha256Pbkdf2DeriveSha256
+ * @tc.desc Promise generate key digest sha256 pbkdf2 derive key digest sha256.
*/
it('HuksTest_JSApiTest_DeriveKey_01500', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_01500 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makePBKDF2DeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA256, 1000, new Uint8Array(16));
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makePBKDF2DeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 1000, new Uint8Array(16));
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(deriveKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deriveKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var deleteKeyResult = await huks.deleteKey('alias1', emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_01500 end');
@@ -498,23 +498,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_01600
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromiseGenerateSha256Pbkdf2DeriveSha384
+ * @tc.desc Promise generate key digest sha256 pbkdf2 derive key digest sha384.
*/
it('HuksTest_JSApiTest_DeriveKey_01600', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_01600 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makePBKDF2DeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA384, 1000, new Uint8Array(16));
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makePBKDF2DeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 1000, new Uint8Array(16));
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT).assertEqual(deriveKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT).assertEqual(deriveKeyResult.errorCode);
var deleteKeyResult = await huks.deleteKey('alias1', emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_01600 end');
@@ -525,23 +525,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_01700
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromiseGenerateSha256Pbkdf2DeriveSha512
+ * @tc.desc Promise generate key digest sha256 pbkdf2 derive key digest sha512.
*/
it('HuksTest_JSApiTest_DeriveKey_01700', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_01700 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makePBKDF2DeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA512, 1000, new Uint8Array(16));
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makePBKDF2DeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 1000, new Uint8Array(16));
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(deriveKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(deriveKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
var deleteKeyResult = await huks.deleteKey('alias1', emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_01700 end');
@@ -552,23 +552,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_01800
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromisePbkdf2DeriveIterationAbnormal
+ * @tc.desc Promise pbkdf2 derive key iteration abnormal.
*/
it('HuksTest_JSApiTest_DeriveKey_01800', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_01800 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makePBKDF2DeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA256, 999, new Uint8Array(16));
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makePBKDF2DeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 999, new Uint8Array(16));
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(deriveKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ITERATION);
+ expect(deriveKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ITERATION);
var deleteKeyResult = await huks.deleteKey('alias1', emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_01800 end');
@@ -579,23 +579,23 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_01900
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name PromisePbkdf2DeriveSaltAbnormal
+ * @tc.desc Promise pbkdf2 derive key salt abnormal.
*/
it('HuksTest_JSApiTest_DeriveKey_01900', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_01900 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makePBKDF2DeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA256, 1000, new Uint8Array(15));
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makePBKDF2DeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 1000, new Uint8Array(15));
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
var deriveKeyResult = await huks.deriveKey('alias1', deriveKeyOption);
console.log('deriveKeyResult' + JSON.stringify(deriveKeyResult));
- expect(deriveKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_SALT);
+ expect(deriveKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_SALT);
var deleteKeyResult = await huks.deleteKey('alias1', emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist('alias1', emptyOption);
expect(isKeyExistResult).assertEqual(false);
console.log('HuksTest_JSApiTest_DeriveKey_01900 end');
@@ -606,21 +606,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_02000
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackGenerateSha256Pbkdf2DeriveSha256
+ * @tc.desc Callback generate key digest sha256 pbkdf2 derive key digest sha256.
*/
it('HuksTest_JSApiTest_DeriveKey_02000', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_02000 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makePBKDF2DeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA256, 1000, new Uint8Array(16));
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makePBKDF2DeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 1000, new Uint8Array(16));
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('deriveKeyResult' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HuksTest_JSApiTest_DeriveKey_02000 end');
deleteKey(done);
});
@@ -630,21 +630,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_02100
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackGenerateSha256Pbkdf2DeriveSha384
+ * @tc.desc Callback generate key digest sha256 pbkdf2 derive key digest sha384.
*/
it('HuksTest_JSApiTest_DeriveKey_02100', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_02100 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makePBKDF2DeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA384, 1000, new Uint8Array(16));
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makePBKDF2DeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 1000, new Uint8Array(16));
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('deriveKeyResult' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HuksTest_JSApiTest_DeriveKey_02000 end');
deleteKey(done);
});
@@ -654,21 +654,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_02200
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackGenerateSha256Pbkdf2DeriveSha512
+ * @tc.desc Callback generate key digest sha256 pbkdf2 derive key digest sha512.
*/
it('HuksTest_JSApiTest_DeriveKey_02200', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_02200 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makePBKDF2DeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA512, 1000, new Uint8Array(16));
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makePBKDF2DeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 1000, new Uint8Array(16));
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('deriveKeyResult' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HuksTest_JSApiTest_DeriveKey_02000 end');
deleteKey(done);
});
@@ -678,21 +678,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_02300
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackPbkdf2DeriveIterationAbnormal
+ * @tc.desc Callback pbkdf2 derive key iteration abnormal.
*/
it('HuksTest_JSApiTest_DeriveKey_02300', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_02300 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makePBKDF2DeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA256, 999, new Uint8Array(16));
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makePBKDF2DeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 999, new Uint8Array(16));
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('deriveKeyResult' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ITERATION);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ITERATION);
console.log('HuksTest_JSApiTest_DeriveKey_02300 end');
deleteKey(done);
});
@@ -702,21 +702,21 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
/**
* @tc.number HuksTest_JSApiTest_DeriveKey_02400
- * @tc.name JSAPI_Test_DeriveKey
- * @tc.desc Test for DeriveKey.
+ * @tc.name CallbackPbkdf2DeriveSaltAbnormal
+ * @tc.desc Callback pbkdf2 derive key salt abnormal.
*/
it('HuksTest_JSApiTest_DeriveKey_02400', 0, async function (done) {
console.log('HuksTest_JSApiTest_DeriveKey_02400 start');
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyDigest.HKS_DIGEST_SHA256);
+ var generateKeyOption = makeGenerateKeyOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256);
console.log('generateKeyOption' + JSON.stringify(generateKeyOption));
var generateKeyResult = await huks.generateKey('alias1', generateKeyOption);
console.log('generateKeyResult' + JSON.stringify(generateKeyResult));
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makePBKDF2DeriveOption(huks.HksKeyDigest.HKS_DIGEST_SHA256, 1000, new Uint8Array(15));
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var deriveKeyOption = makePBKDF2DeriveOption(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 1000, new Uint8Array(15));
console.log('deriveKeyOption' + JSON.stringify(deriveKeyOption));
huks.deriveKey('alias1', deriveKeyOption, function (err, data) {
console.log('deriveKeyResult' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_SALT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_SALT);
console.log('HuksTest_JSApiTest_DeriveKey_02000 end');
deleteKey(done);
});
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_generateKey.test.js b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_generateKey.test.js
index 934a556ccba2b8880dbdac0b38a126bb5971870b..a3ddf48015ddc731c4aa4b573cdddcc2a7b10d03 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_generateKey.test.js
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_generateKey.test.js
@@ -25,41 +25,41 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
var dsaKeySize = 1024;
var defaultAlias = 'defaultAlias';
- var aes128Option = makeGenerateAESKeyOptions(huks.HksKeySize.HKS_AES_KEY_SIZE_128);
- var aes192Option = makeGenerateAESKeyOptions(huks.HksKeySize.HKS_AES_KEY_SIZE_192);
- var aes256Option = makeGenerateAESKeyOptions(huks.HksKeySize.HKS_AES_KEY_SIZE_256);
- var rsa512Option = makeGenerateRSAKeyOptions(huks.HksKeySize.HKS_RSA_KEY_SIZE_512);
- var rsa768Option = makeGenerateRSAKeyOptions(huks.HksKeySize.HKS_RSA_KEY_SIZE_768);
- var rsa1024Option = makeGenerateRSAKeyOptions(huks.HksKeySize.HKS_RSA_KEY_SIZE_1024);
- var rsa2048Option = makeGenerateRSAKeyOptions(huks.HksKeySize.HKS_RSA_KEY_SIZE_2048);
- var rsa3072Option = makeGenerateRSAKeyOptions(huks.HksKeySize.HKS_RSA_KEY_SIZE_3072);
- var rsa4096Option = makeGenerateRSAKeyOptions(huks.HksKeySize.HKS_RSA_KEY_SIZE_4096);
- var ecc224Option = makeGenerateECCKeyOptions(huks.HksKeySize.HKS_ECC_KEY_SIZE_224);
- var ecc256Option = makeGenerateECCKeyOptions(huks.HksKeySize.HKS_ECC_KEY_SIZE_256);
- var ecc384Option = makeGenerateECCKeyOptions(huks.HksKeySize.HKS_ECC_KEY_SIZE_384);
- var ecc521Option = makeGenerateECCKeyOptions(huks.HksKeySize.HKS_ECC_KEY_SIZE_521);
+ var aes128Option = makeGenerateAESKeyOptions(huks.HuksKeySize.HUKS_AES_KEY_SIZE_128);
+ var aes192Option = makeGenerateAESKeyOptions(huks.HuksKeySize.HUKS_AES_KEY_SIZE_192);
+ var aes256Option = makeGenerateAESKeyOptions(huks.HuksKeySize.HUKS_AES_KEY_SIZE_256);
+ var rsa512Option = makeGenerateRSAKeyOptions(huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
+ var rsa768Option = makeGenerateRSAKeyOptions(huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768);
+ var rsa1024Option = makeGenerateRSAKeyOptions(huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024);
+ var rsa2048Option = makeGenerateRSAKeyOptions(huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048);
+ var rsa3072Option = makeGenerateRSAKeyOptions(huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072);
+ var rsa4096Option = makeGenerateRSAKeyOptions(huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096);
+ var ecc224Option = makeGenerateECCKeyOptions(huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ var ecc256Option = makeGenerateECCKeyOptions(huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256);
+ var ecc384Option = makeGenerateECCKeyOptions(huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384);
+ var ecc521Option = makeGenerateECCKeyOptions(huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521);
var dsaOption = makeGenerateDSAKeyOptions();
function makeWrongOption(alg, size, purpose, padding, mode) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: alg
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
value: purpose
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
+ tag: huks.HuksTag.HUKS_TAG_PADDING,
value: padding
};
properties[4] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
+ tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
value: mode
};
var options = {
@@ -71,24 +71,24 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
function makeGenerateAESKeyOptions(size) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_AES
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_AES
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_NONE
+ tag: huks.HuksTag.HUKS_TAG_PADDING,
+ value: huks.HuksKeyPadding.HUKS_PADDING_NONE
};
properties[4] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
- value: huks.HksCipherMode.HKS_MODE_CBC
+ tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
+ value: huks.HuksCipherMode.HUKS_MODE_CBC
};
var options = {
properties: properties
@@ -99,32 +99,32 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
function makeGenerateRSAKeyOptions(size) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_RSA
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_RSA
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_NONE
+ tag: huks.HuksTag.HUKS_TAG_PADDING,
+ value: huks.HuksKeyPadding.HUKS_PADDING_NONE
};
properties[4] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
- value: huks.HksCipherMode.HKS_MODE_ECB
+ tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
+ value: huks.HuksCipherMode.HUKS_MODE_ECB
};
properties[5] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_NONE
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
+ value: huks.HuksKeyDigest.HUKS_DIGEST_NONE
};
properties[6] = {
- tag: huks.HksTag.HKS_TAG_KEY_GENERATE_TYPE,
- value: huks.HksKeyGenerateType.HKS_KEY_GENERATE_TYPE_DEFAULT
+ tag: huks.HuksTag.HUKS_TAG_KEY_GENERATE_TYPE,
+ value: huks.HuksKeyGenerateType.HUKS_KEY_GENERATE_TYPE_DEFAULT
};
var options = {
properties: properties
@@ -135,20 +135,20 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
function makeGenerateECCKeyOptions(size) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_ECC
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_ECC
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_NONE
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
+ value: huks.HuksKeyDigest.HUKS_DIGEST_NONE
};
var options = {
properties: properties
@@ -159,23 +159,19 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
function makeGenerateMACKeyOptions(digest, size) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_HMAC
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_HMAC
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
value: digest
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_KEY_TYPE,
- value: huks.HksKeyType.HKS_KEY_TYPE_HMAC
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
var options = {
@@ -187,20 +183,20 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
function makeGenerateDSAKeyOptions() {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_DSA
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_DSA
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: dsaKeySize
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_SHA1
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
+ value: huks.HuksKeyDigest.HUKS_DIGEST_SHA1
};
var options = {
properties: properties
@@ -218,7 +214,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
function deleteKeyFun(alias, done) {
var option = makeEmptyOptions();
huks.deleteKey(alias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
done();
});
};
@@ -231,14 +227,14 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_00100', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_00100 start');
var aes128Result = await huks.generateKey(defaultAlias, aes128Option);
- expect(aes128Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(aes128Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var aes192Result = await huks.generateKey(defaultAlias, aes192Option);
- expect(aes192Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(aes192Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var aes256Result = await huks.generateKey(defaultAlias, aes256Option);
- expect(aes256Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(aes256Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var deleteKeyOption = makeEmptyOptions();
var deleteKeyResult = await huks.deleteKey(defaultAlias, deleteKeyOption);
- expect(deleteKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deleteKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_00100 end');
done();
@@ -254,7 +250,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_00200', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_00200 start')
huks.generateKey(defaultAlias, aes128Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
deleteKeyFun(defaultAlias, done);
});
setTimeout(function () {
@@ -269,7 +265,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_00300', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_00300 start');
huks.generateKey(defaultAlias, aes192Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_00300 end');
deleteKeyFun(defaultAlias, done);
});
@@ -285,7 +281,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_00400', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_00400 start');
huks.generateKey(defaultAlias, aes256Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_00400 end');
deleteKeyFun(defaultAlias, done);
});
@@ -301,17 +297,17 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_00500', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_00500 start');
var rsa512Result = await huks.generateKey(defaultAlias, rsa512Option);
- expect(rsa512Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(rsa512Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var rsa768Result = await huks.generateKey(defaultAlias, rsa768Option);
- expect(rsa768Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(rsa768Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var rsa1024Result = await huks.generateKey(defaultAlias, rsa1024Option);
- expect(rsa1024Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(rsa1024Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var rsa2048Result = await huks.generateKey(defaultAlias, rsa2048Option);
- expect(rsa2048Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(rsa2048Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var rsa3072Result = await huks.generateKey(defaultAlias, rsa3072Option);
- expect(rsa3072Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(rsa3072Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var rsa4096Result = await huks.generateKey(defaultAlias, rsa4096Option);
- expect(rsa4096Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(rsa4096Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_00500 end');
done();
setTimeout(function () {
@@ -326,7 +322,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_00600', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_00600 start');
huks.generateKey(defaultAlias, rsa512Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_00600 end');
deleteKeyFun(defaultAlias, done);
});
@@ -342,7 +338,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_00700', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_00700 start');
huks.generateKey(defaultAlias, rsa768Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_00700 end');
deleteKeyFun(defaultAlias, done);
});
@@ -358,7 +354,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_00800', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_00800 start');
huks.generateKey(defaultAlias, rsa1024Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_00800 end');
deleteKeyFun(defaultAlias, done);
});
@@ -374,7 +370,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_00900', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_00900 start');
huks.generateKey(defaultAlias, rsa2048Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_00900 end');
deleteKeyFun(defaultAlias, done);
});
@@ -390,7 +386,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_01000', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_01000 start');
huks.generateKey(defaultAlias, rsa3072Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_01000 end');
deleteKeyFun(defaultAlias, done);
});
@@ -406,7 +402,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_01100', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_01100 start');
huks.generateKey(defaultAlias, rsa4096Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_01100 end');
deleteKeyFun(defaultAlias, done);
});
@@ -422,13 +418,13 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_01200', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_01200 start');
var ecc224Result = await huks.generateKey(defaultAlias, ecc224Option);
- expect(ecc224Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(ecc224Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var ecc256Result = await huks.generateKey(defaultAlias, ecc256Option);
- expect(ecc256Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(ecc256Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var ecc384Result = await huks.generateKey(defaultAlias, ecc384Option);
- expect(ecc384Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(ecc384Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var ecc521Result = await huks.generateKey(defaultAlias, ecc521Option);
- expect(ecc521Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(ecc521Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_01200 end');
done();
setTimeout(function () {
@@ -443,7 +439,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_01300', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_01300 start');
huks.generateKey(defaultAlias, ecc224Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_01300 end');
deleteKeyFun(defaultAlias, done);
});
@@ -459,7 +455,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_01400', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_01400 start');
huks.generateKey(defaultAlias, ecc256Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_01400 end');
deleteKeyFun(defaultAlias, done);
});
@@ -475,7 +471,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_01500', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_01500 start');
huks.generateKey(defaultAlias, ecc384Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_01500 end');
deleteKeyFun(defaultAlias, done);
});
@@ -491,7 +487,7 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
it('HUKS_JSAPI_GenerateKey_Test_01600', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_01600 start');
huks.generateKey(defaultAlias, ecc521Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_01600 end');
deleteKeyFun(defaultAlias, done);
});
@@ -506,21 +502,21 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_01700', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_01700 start');
- var hmacSHA1Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA1, 160);
- var hmacSHA224Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA224, 224);
- var hmacSHA256Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA256, 256);
- var hmacSHA384Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA384, 384);
- var hmacSHA512Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA512, 512);
+ var hmacSHA1Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA1, 160);
+ var hmacSHA224Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA224, 224);
+ var hmacSHA256Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 256);
+ var hmacSHA384Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 384);
+ var hmacSHA512Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 512);
var hmacSHA1Result = await huks.generateKey(defaultAlias, hmacSHA1Option);
- expect(hmacSHA1Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA1Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var hmacSHA224Result = await huks.generateKey(defaultAlias, hmacSHA224Option);
- expect(hmacSHA224Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA224Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var hmacSHA256Result = await huks.generateKey(defaultAlias, hmacSHA256Option);
- expect(hmacSHA256Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA256Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var hmacSHA384Result = await huks.generateKey(defaultAlias, hmacSHA384Option);
- expect(hmacSHA384Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA384Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var hmacSHA512Result = await huks.generateKey(defaultAlias, hmacSHA512Option);
- expect(hmacSHA512Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA512Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_01700 end');
done();
setTimeout(function () {
@@ -534,9 +530,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_01800', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_01800 start');
- var hmacSHA1Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA1, 160);
+ var hmacSHA1Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA1, 160);
huks.generateKey(defaultAlias, hmacSHA1Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_01800 end');
deleteKeyFun(defaultAlias, done);
});
@@ -551,9 +547,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_01900', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_01900 start');
- var hmacSHA224Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA224, 224);
+ var hmacSHA224Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA224, 224);
huks.generateKey(defaultAlias, hmacSHA224Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_01900 end');
deleteKeyFun(defaultAlias, done);
});
@@ -568,9 +564,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_02000', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_02000 start');
- var hmacSHA256Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA256, 256);
+ var hmacSHA256Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 256);
huks.generateKey(defaultAlias, hmacSHA256Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_02000 end');
deleteKeyFun(defaultAlias, done);
});
@@ -585,9 +581,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_02100', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_02100 start');
- var hmacSHA384Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA384, 384);
+ var hmacSHA384Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 384);
huks.generateKey(defaultAlias, hmacSHA384Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_02100 end');
deleteKeyFun(defaultAlias, done);
});
@@ -602,9 +598,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_02200', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_02200 start');
- var hmacSHA512Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA512, 512);
+ var hmacSHA512Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 512);
huks.generateKey(defaultAlias, hmacSHA512Option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_02200 end');
deleteKeyFun(defaultAlias, done);
});
@@ -621,10 +617,10 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
console.log('HUKS_JSAPI_GenerateKey_Test_02300 start');
var dsaResult = await huks.generateKey(defaultAlias, dsaOption);
if (useLib == 'mbedtls') {
- expect(dsaResult.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(dsaResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
done();
} else {
- expect(dsaResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(dsaResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_02300 end');
deleteKeyFun(defaultAlias, done);
}
@@ -639,10 +635,10 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
console.log('HUKS_JSAPI_GenerateKey_Test_02400 start');
huks.generateKey(defaultAlias, dsaOption, function (err, data) {
if (useLib == 'mbedtls') {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
done();
} else {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_02400 end');
deleteKeyFun(defaultAlias, done);
}
@@ -662,14 +658,14 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
console.log('HUKS_JSAPI_GenerateKey_Test_02500_01 start');
var option = makeWrongOption(
notExistAlg,
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC
);
var result = await huks.generateKey(defaultAlias, option);
- expect(result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
console.log('HUKS_JSAPI_GenerateKey_Test_02500 end');
done();
@@ -686,15 +682,15 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
console.log('HUKS_JSAPI_GenerateKey_Test_02600 start');
var notExistSize = -1;
var option = makeWrongOption(
- huks.HksKeyAlg.HKS_ALG_AES,
+ huks.HuksKeyAlg.HUKS_ALG_AES,
notExistSize,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC
);
var result = await huks.generateKey(defaultAlias, option);
- expect(result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_KEY_SIZE);
+ expect(result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
console.log('HUKS_JSAPI_GenerateKey_Test_02600 end');
done();
@@ -711,15 +707,15 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
console.log('HUKS_JSAPI_GenerateKey_Test_02700 start');
var notExistPurpose = -1;
var option = makeWrongOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
+ huks.HuksKeyAlg.HUKS_ALG_AES,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
notExistPurpose,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC
);
var result = await huks.generateKey(defaultAlias, option);
- expect(result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_PURPOSE);
+ expect(result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
console.log('HUKS_JSAPI_GenerateKey_Test_02700 end');
done();
@@ -736,15 +732,15 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
console.log('HUKS_JSAPI_GenerateKey_Test_02800 start');
var notExistPadding = -1;
var option = makeWrongOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyAlg.HUKS_ALG_AES,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
notExistPadding,
- huks.HksCipherMode.HKS_MODE_CBC
+ huks.HuksCipherMode.HUKS_MODE_CBC
);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_PADDING);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
console.log('HUKS_JSAPI_GenerateKey_Test_02800 end');
done();
});
@@ -762,14 +758,14 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
var notExistAlg = -1;
var option = makeWrongOption(
notExistAlg,
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC
);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
console.log('HUKS_JSAPI_GenerateKey_Test_02900 end');
done();
});
@@ -787,15 +783,15 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
console.log('HUKS_JSAPI_GenerateKey_Test_03000 start');
var notExistSize = -1;
var option = makeWrongOption(
- huks.HksKeyAlg.HKS_ALG_AES,
+ huks.HuksKeyAlg.HUKS_ALG_AES,
notExistSize,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC
);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_KEY_SIZE);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
console.log('HUKS_JSAPI_GenerateKey_Test_03000 end');
done();
});
@@ -812,15 +808,15 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
console.log('HUKS_JSAPI_GenerateKey_Test_03100 start');
var notExistPurpose = -1;
var option = makeWrongOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
+ huks.HuksKeyAlg.HUKS_ALG_AES,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
notExistPurpose,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC
);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_PURPOSE);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
console.log('HUKS_JSAPI_GenerateKey_Test_03100 end');
done();
});
@@ -837,15 +833,15 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
console.log('HUKS_JSAPI_GenerateKey_Test_03200 start');
var notExistPadding = -1;
var option = makeWrongOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyAlg.HUKS_ALG_AES,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
notExistPadding,
- huks.HksCipherMode.HKS_MODE_CBC
+ huks.HuksCipherMode.HUKS_MODE_CBC
);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_PADDING);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_PADDING);
console.log('HUKS_JSAPI_GenerateKey_Test_03200 end');
done();
});
@@ -860,45 +856,45 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_03300', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_03300 start');
- var hmacSHA1OptionSize8 = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA1, 8);
+ var hmacSHA1OptionSize8 = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA1, 8);
var hmacSHA1ResultSize8 = await huks.generateKey(defaultAlias, hmacSHA1OptionSize8);
- expect(hmacSHA1ResultSize8.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA1ResultSize8.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
- var hmacSHA1OptionSize1024 = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA1, 1024);
+ var hmacSHA1OptionSize1024 = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA1, 1024);
var hmacSHA1ResultSize1024 = await huks.generateKey(defaultAlias, hmacSHA1OptionSize1024);
- expect(hmacSHA1ResultSize1024.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA1ResultSize1024.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
- var hmacSHA224OptionSize8 = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA224, 8);
+ var hmacSHA224OptionSize8 = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA224, 8);
var hmacSHA224ResultSize8 = await huks.generateKey(defaultAlias, hmacSHA224OptionSize8);
- expect(hmacSHA224ResultSize8.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA224ResultSize8.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
- var hmacSHA224OptionSize1024 = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA224, 1024);
+ var hmacSHA224OptionSize1024 = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA224, 1024);
var hmacSHA224ResultSize1024 = await huks.generateKey(defaultAlias, hmacSHA224OptionSize1024);
- expect(hmacSHA224ResultSize1024.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA224ResultSize1024.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
- var hmacSHA256OptionSize8 = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA256, 8);
+ var hmacSHA256OptionSize8 = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 8);
var hmacSHA256ResultSize8 = await huks.generateKey(defaultAlias, hmacSHA256OptionSize8);
- expect(hmacSHA256ResultSize8.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA256ResultSize8.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
- var hmacSHA256OptionSize1024 = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA256, 1024);
+ var hmacSHA256OptionSize1024 = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 1024);
var hmacSHA256ResultSize1024 = await huks.generateKey(defaultAlias, hmacSHA256OptionSize1024);
- expect(hmacSHA256ResultSize1024.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA256ResultSize1024.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
- var hmacSHA384OptionSize8 = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA384, 8);
+ var hmacSHA384OptionSize8 = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 8);
var hmacSHA384ResultSize8 = await huks.generateKey(defaultAlias, hmacSHA384OptionSize8);
- expect(hmacSHA384ResultSize8.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA384ResultSize8.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
- var hmacSHA384OptionSize1024 = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA384, 1024);
+ var hmacSHA384OptionSize1024 = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 1024);
var hmacSHA384ResultSize1024 = await huks.generateKey(defaultAlias, hmacSHA384OptionSize1024);
- expect(hmacSHA384ResultSize1024.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA384ResultSize1024.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
- var hmacSHA512OptionSize8 = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA512, 8);
+ var hmacSHA512OptionSize8 = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 8);
var hmacSHA512ResultSize8 = await huks.generateKey(defaultAlias, hmacSHA512OptionSize8);
- expect(hmacSHA512ResultSize8.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA512ResultSize8.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
- var hmacSHA512OptionSize1024 = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA512, 1024);
+ var hmacSHA512OptionSize1024 = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 1024);
var hmacSHA512ResultSize1024 = await huks.generateKey(defaultAlias, hmacSHA512OptionSize1024);
- expect(hmacSHA512ResultSize1024.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA512ResultSize1024.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_03300 end');
done();
@@ -913,9 +909,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_03400', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_03400 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA1, 8);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA1, 8);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_03400 end');
deleteKeyFun(defaultAlias, done);
});
@@ -928,9 +924,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_03500', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_03500 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA1, 1024);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA1, 1024);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_03500 end');
deleteKeyFun(defaultAlias, done);
});
@@ -943,9 +939,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_03600', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_03600 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA224, 8);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA224, 8);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_03600 end');
deleteKeyFun(defaultAlias, done);
});
@@ -958,9 +954,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_03700', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_03700 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA224, 1024);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA224, 1024);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_03700 end');
deleteKeyFun(defaultAlias, done);
});
@@ -973,9 +969,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_03800', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_03800 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA256, 8);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 8);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_03800 end');
deleteKeyFun(defaultAlias, done);
});
@@ -988,9 +984,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_03900', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_03900 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA256, 1024);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 1024);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_03600 end');
deleteKeyFun(defaultAlias, done);
});
@@ -1003,9 +999,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_04000', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_04000 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA384, 8);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 8);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_04000 end');
deleteKeyFun(defaultAlias, done);
});
@@ -1018,9 +1014,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_04100', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_04100 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA384, 1024);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 1024);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_04100 end');
deleteKeyFun(defaultAlias, done);
});
@@ -1033,9 +1029,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_04200', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_04200 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA512, 8);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 8);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_04200 end');
deleteKeyFun(defaultAlias, done);
});
@@ -1048,9 +1044,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_04300', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_04300 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA512, 1024);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 1024);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('HUKS_JSAPI_GenerateKey_Test_04300 end');
deleteKeyFun(defaultAlias, done);
});
@@ -1063,45 +1059,45 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_04400', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_04400 start');
- var hmacSHA1Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA1, 7);
+ var hmacSHA1Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA1, 7);
var hmacSHA1Result = await huks.generateKey(defaultAlias, hmacSHA1Option);
- expect(hmacSHA1Result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(hmacSHA1Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
- hmacSHA1Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA1, 1025);
+ hmacSHA1Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA1, 1025);
hmacSHA1Result = await huks.generateKey(defaultAlias, hmacSHA1Option);
- expect(hmacSHA1Result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(hmacSHA1Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
- var hmacSHA224Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA224, 7);
+ var hmacSHA224Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA224, 7);
var hmacSHA224Result = await huks.generateKey(defaultAlias, hmacSHA224Option);
- expect(hmacSHA224Result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(hmacSHA224Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
- hmacSHA224Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA224, 1025);
+ hmacSHA224Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA224, 1025);
hmacSHA224Result = await huks.generateKey(defaultAlias, hmacSHA224Option);
- expect(hmacSHA224Result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(hmacSHA224Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
- var hmacSHA256Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA256, 7);
+ var hmacSHA256Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 7);
var hmacSHA256Result = await huks.generateKey(defaultAlias, hmacSHA256Option);
- expect(hmacSHA256Result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(hmacSHA256Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
- hmacSHA256Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA256, 1025);
+ hmacSHA256Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 1025);
hmacSHA256Result = await huks.generateKey(defaultAlias, hmacSHA256Option);
- expect(hmacSHA256Result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(hmacSHA256Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
- var hmacSHA384Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA384, 7);
+ var hmacSHA384Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 7);
var hmacSHA384Result = await huks.generateKey(defaultAlias, hmacSHA384Option);
- expect(hmacSHA384Result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(hmacSHA384Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
- hmacSHA384Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA384, 1025);
+ hmacSHA384Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 1025);
hmacSHA384Result = await huks.generateKey(defaultAlias, hmacSHA384Option);
- expect(hmacSHA384Result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(hmacSHA384Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
- var hmacSHA512Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA512, 7);
+ var hmacSHA512Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 7);
var hmacSHA512Result = await huks.generateKey(defaultAlias, hmacSHA512Option);
- expect(hmacSHA512Result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(hmacSHA512Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
- hmacSHA512Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA512, 1025);
+ hmacSHA512Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 1025);
hmacSHA512Result = await huks.generateKey(defaultAlias, hmacSHA512Option);
- expect(hmacSHA512Result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(hmacSHA512Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HUKS_JSAPI_GenerateKey_Test_04400 end');
done();
@@ -1116,9 +1112,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_04500', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_04500 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA1, 7);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA1, 7);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HUKS_JSAPI_GenerateKey_Test_04500 end');
done();
});
@@ -1131,9 +1127,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_04600', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_04600 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA1, 1025);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA1, 1025);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HUKS_JSAPI_GenerateKey_Test_04600 end');
done();
});
@@ -1146,9 +1142,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_04700', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_04700 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA224, 7);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA224, 7);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HUKS_JSAPI_GenerateKey_Test_04700 end');
done();
});
@@ -1161,9 +1157,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_04800', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_04800 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA224, 1025);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA224, 1025);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HUKS_JSAPI_GenerateKey_Test_04800 end');
done();
});
@@ -1176,9 +1172,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_04900', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_04900 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA256, 7);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 7);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HUKS_JSAPI_GenerateKey_Test_04900 end');
done();
});
@@ -1191,9 +1187,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_05000', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_05000 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA256, 1025);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA256, 1025);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HUKS_JSAPI_GenerateKey_Test_05000 end');
done();
});
@@ -1206,9 +1202,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_05100', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_05100 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA384, 7);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 7);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HUKS_JSAPI_GenerateKey_Test_05100 end');
done();
});
@@ -1221,9 +1217,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_05200', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_05200 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA384, 1025);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA384, 1025);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HUKS_JSAPI_GenerateKey_Test_05200 end');
done();
});
@@ -1236,9 +1232,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_05300', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_05300 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA512, 7);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 7);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HUKS_JSAPI_GenerateKey_Test_05300 end');
done();
});
@@ -1251,9 +1247,9 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
*/
it('HUKS_JSAPI_GenerateKey_Test_05400', 0, async function (done) {
console.log('HUKS_JSAPI_GenerateKey_Test_05400 start');
- var option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA512, 1025);
+ var option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA512, 1025);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
console.log('HUKS_JSAPI_GenerateKey_Test_05400 end');
done();
});
@@ -1268,15 +1264,15 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
console.log('HUKS_JSAPI_GenerateKey_Test_05500 start');
var notExistMode = -1;
var option = makeWrongOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_AES,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
notExistMode
);
var result = await huks.generateKey(defaultAlias, option);
- expect(result.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_MODE);
+ expect(result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_MODE);
console.log('HUKS_JSAPI_GenerateKey_Test_05500 end');
done();
@@ -1293,15 +1289,15 @@ describe('HuksTest_JSApiTest_GenerateKey', function () {
console.log('HUKS_JSAPI_GenerateKey_Test_05600 start');
var notExistMode = -1;
var option = makeWrongOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_AES,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
notExistMode
);
huks.generateKey(defaultAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_MODE);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_MODE);
console.log('HUKS_JSAPI_GenerateKey_Test_05600 end');
done();
});
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_getKeyProperties.test.js b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_getKeyProperties.test.js
index 9cecf4af4c9ccc96befd2b3d27991d4e63e0763e..f0cdc244140b2f8b6350dd7e97b72962f9914779 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_getKeyProperties.test.js
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_jsApi_getKeyProperties.test.js
@@ -21,38 +21,38 @@ import {
timer
} from '../../../../../../hks_xts_common.test.js'
-describe('HuksTest_JSApiTest_DeriveKey', function () {
+describe('HuksTest_JSApiTest_GetKeyProperties', function () {
var dsaKeySize = 1024;
var defaultAlias = 'defaultAlias';
- var signAndVerify = huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY;
- var encryptAndDecrypt = huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT;
- var aes128Option = makeGenerateAESKeyOptions(huks.HksKeySize.HKS_AES_KEY_SIZE_128);
- var rsa512Option = makeGenerateRSAKeyOptions(huks.HksKeySize.HKS_RSA_KEY_SIZE_512);
- var ecc224Option = makeGenerateECCKeyOptions(huks.HksKeySize.HKS_ECC_KEY_SIZE_224);
- var hmacSHA1Option = makeGenerateMACKeyOptions(huks.HksKeyDigest.HKS_DIGEST_SHA1, 160);
+ var signAndVerify = huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY;
+ var encryptAndDecrypt = huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT;
+ var aes128Option = makeGenerateAESKeyOptions(huks.HuksKeySize.HUKS_AES_KEY_SIZE_128);
+ var rsa512Option = makeGenerateRSAKeyOptions(huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
+ var ecc224Option = makeGenerateECCKeyOptions(huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
+ var hmacSHA1Option = makeGenerateMACKeyOptions(huks.HuksKeyDigest.HUKS_DIGEST_SHA1, 160);
var dsaOption = makeGenerateDSAKeyOptions();
function makeGenerateAESKeyOptions(size) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_AES
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_AES
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_NONE
+ tag: huks.HuksTag.HUKS_TAG_PADDING,
+ value: huks.HuksKeyPadding.HUKS_PADDING_NONE
};
properties[4] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
- value: huks.HksCipherMode.HKS_MODE_CBC
+ tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
+ value: huks.HuksCipherMode.HUKS_MODE_CBC
};
var options = {
properties: properties
@@ -63,32 +63,32 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
function makeGenerateRSAKeyOptions(size) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_RSA
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_RSA
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_NONE
+ tag: huks.HuksTag.HUKS_TAG_PADDING,
+ value: huks.HuksKeyPadding.HUKS_PADDING_NONE
};
properties[4] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
- value: huks.HksCipherMode.HKS_MODE_ECB
+ tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
+ value: huks.HuksCipherMode.HUKS_MODE_ECB
};
properties[5] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_NONE
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
+ value: huks.HuksKeyDigest.HUKS_DIGEST_NONE
};
properties[6] = {
- tag: huks.HksTag.HKS_TAG_KEY_GENERATE_TYPE,
- value: huks.HksKeyGenerateType.HKS_KEY_GENERATE_TYPE_DEFAULT
+ tag: huks.HuksTag.HUKS_TAG_KEY_GENERATE_TYPE,
+ value: huks.HuksKeyGenerateType.HUKS_KEY_GENERATE_TYPE_DEFAULT
};
var options = {
properties: properties
@@ -99,20 +99,20 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
function makeGenerateECCKeyOptions(size) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_ECC
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_ECC
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_NONE
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
+ value: huks.HuksKeyDigest.HUKS_DIGEST_NONE
};
var options = {
properties: properties
@@ -123,23 +123,19 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
function makeGenerateMACKeyOptions(digest, size) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_HMAC
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_HMAC
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
value: digest
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_KEY_TYPE,
- value: huks.HksKeyType.HKS_KEY_TYPE_HMAC
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
var options = {
@@ -151,20 +147,20 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
function makeGenerateDSAKeyOptions() {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_DSA
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_DSA
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: dsaKeySize
};
properties[3] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_SHA1
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
+ value: huks.HuksKeyDigest.HUKS_DIGEST_SHA1
};
var options = {
properties: properties
@@ -181,7 +177,7 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
function deleteKeyFun(done) {
huks.deleteKey(defaultAlias, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
isKeyExistFun(done);
});
};
@@ -193,18 +189,18 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
*/
it('HuksTest_JSApiTest_getKeyProperties_00100', 0, async function (done) {
var aes128Result = await huks.generateKey(defaultAlias, aes128Option);
- expect(aes128Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(aes128Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var getKeyPropertiesRet = await huks.getKeyProperties(defaultAlias, emptyOption);
- expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('getKeyPropertiesRet ' + JSON.stringify(getKeyPropertiesRet));
- expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(getKeyPropertiesRet.properties[0].value).assertEqual(huks.HksKeyAlg.HKS_ALG_AES);
- expect(getKeyPropertiesRet.properties[1].value).assertEqual(huks.HksKeySize.HKS_AES_KEY_SIZE_128);
+ expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ expect(getKeyPropertiesRet.properties[0].value).assertEqual(huks.HuksKeyAlg.HUKS_ALG_AES);
+ expect(getKeyPropertiesRet.properties[1].value).assertEqual(huks.HuksKeySize.HUKS_AES_KEY_SIZE_128);
expect(getKeyPropertiesRet.properties[2].value).assertEqual(encryptAndDecrypt);
- expect(getKeyPropertiesRet.properties[3].value).assertEqual(huks.HksKeyPadding.HKS_PADDING_NONE);
- expect(getKeyPropertiesRet.properties[4].value).assertEqual(huks.HksCipherMode.HKS_MODE_CBC);
+ expect(getKeyPropertiesRet.properties[3].value).assertEqual(huks.HuksKeyPadding.HUKS_PADDING_NONE);
+ expect(getKeyPropertiesRet.properties[4].value).assertEqual(huks.HuksCipherMode.HUKS_MODE_CBC);
var deleteKeyResult = await huks.deleteKey(defaultAlias, emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist(defaultAlias, emptyOption);
expect(isKeyExistResult).assertEqual(false);
done();
@@ -219,16 +215,16 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
*/
it('HuksTest_JSApiTest_getKeyProperties_00200', 0, async function (done) {
var aes128Result = await huks.generateKey(defaultAlias, aes128Option);
- expect(aes128Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(aes128Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
huks.getKeyProperties(defaultAlias, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('getKeyPropertiesRet ' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(data.properties[0].value).assertEqual(huks.HksKeyAlg.HKS_ALG_AES);
- expect(data.properties[1].value).assertEqual(huks.HksKeySize.HKS_AES_KEY_SIZE_128);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ expect(data.properties[0].value).assertEqual(huks.HuksKeyAlg.HUKS_ALG_AES);
+ expect(data.properties[1].value).assertEqual(huks.HuksKeySize.HUKS_AES_KEY_SIZE_128);
expect(data.properties[2].value).assertEqual(encryptAndDecrypt);
- expect(data.properties[3].value).assertEqual(huks.HksKeyPadding.HKS_PADDING_NONE);
- expect(data.properties[4].value).assertEqual(huks.HksCipherMode.HKS_MODE_CBC);
+ expect(data.properties[3].value).assertEqual(huks.HuksKeyPadding.HUKS_PADDING_NONE);
+ expect(data.properties[4].value).assertEqual(huks.HuksCipherMode.HUKS_MODE_CBC);
deleteKeyFun(done);
});
setTimeout(function () {
@@ -242,17 +238,17 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
*/
it('HuksTest_JSApiTest_getKeyProperties_00300', 0, async function (done) {
var rsa512Result = await huks.generateKey(defaultAlias, rsa512Option);
- expect(rsa512Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(rsa512Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var getKeyPropertiesRet = await huks.getKeyProperties(defaultAlias, emptyOption);
- expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('getKeyPropertiesRet ' + JSON.stringify(getKeyPropertiesRet));
- expect(getKeyPropertiesRet.properties[0].value).assertEqual(huks.HksKeyAlg.HKS_ALG_RSA);
- expect(getKeyPropertiesRet.properties[1].value).assertEqual(huks.HksKeySize.HKS_RSA_KEY_SIZE_512);
+ expect(getKeyPropertiesRet.properties[0].value).assertEqual(huks.HuksKeyAlg.HUKS_ALG_RSA);
+ expect(getKeyPropertiesRet.properties[1].value).assertEqual(huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
expect(getKeyPropertiesRet.properties[2].value).assertEqual(encryptAndDecrypt);
- expect(getKeyPropertiesRet.properties[3].value).assertEqual(huks.HksKeyPadding.HKS_PADDING_NONE);
- expect(getKeyPropertiesRet.properties[4].value).assertEqual(huks.HksCipherMode.HKS_MODE_ECB);
+ expect(getKeyPropertiesRet.properties[3].value).assertEqual(huks.HuksKeyPadding.HUKS_PADDING_NONE);
+ expect(getKeyPropertiesRet.properties[4].value).assertEqual(huks.HuksCipherMode.HUKS_MODE_ECB);
var deleteKeyResult = await huks.deleteKey(defaultAlias, emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist(defaultAlias, emptyOption);
expect(isKeyExistResult).assertEqual(false);
done();
@@ -267,16 +263,16 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
*/
it('HuksTest_JSApiTest_getKeyProperties_00400', 0, async function (done) {
var rsa512Result = await huks.generateKey(defaultAlias, rsa512Option);
- expect(rsa512Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(rsa512Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
huks.getKeyProperties(defaultAlias, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
console.log('getKeyPropertiesRet ' + JSON.stringify(data));
- expect(data.properties[0].value).assertEqual(huks.HksKeyAlg.HKS_ALG_RSA);
- expect(data.properties[1].value).assertEqual(huks.HksKeySize.HKS_RSA_KEY_SIZE_512);
+ expect(data.properties[0].value).assertEqual(huks.HuksKeyAlg.HUKS_ALG_RSA);
+ expect(data.properties[1].value).assertEqual(huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512);
expect(data.properties[2].value).assertEqual(encryptAndDecrypt);
- expect(data.properties[3].value).assertEqual(huks.HksKeyPadding.HKS_PADDING_NONE);
- expect(data.properties[4].value).assertEqual(huks.HksCipherMode.HKS_MODE_ECB);
+ expect(data.properties[3].value).assertEqual(huks.HuksKeyPadding.HUKS_PADDING_NONE);
+ expect(data.properties[4].value).assertEqual(huks.HuksCipherMode.HUKS_MODE_ECB);
deleteKeyFun(done);
});
setTimeout(function () {
@@ -290,16 +286,16 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
*/
it('HuksTest_JSApiTest_getKeyProperties_00500', 0, async function (done) {
var ecc224Result = await huks.generateKey(defaultAlias, ecc224Option);
- expect(ecc224Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(ecc224Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var getKeyPropertiesRet = await huks.getKeyProperties(defaultAlias, emptyOption);
- expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(getKeyPropertiesRet.properties[0].value).assertEqual(huks.HksKeyAlg.HKS_ALG_ECC);
- expect(getKeyPropertiesRet.properties[1].value).assertEqual(huks.HksKeySize.HKS_ECC_KEY_SIZE_224);
+ expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ expect(getKeyPropertiesRet.properties[0].value).assertEqual(huks.HuksKeyAlg.HUKS_ALG_ECC);
+ expect(getKeyPropertiesRet.properties[1].value).assertEqual(huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
expect(getKeyPropertiesRet.properties[2].value).assertEqual(signAndVerify);
- expect(getKeyPropertiesRet.properties[3].value).assertEqual(huks.HksKeyDigest.HKS_DIGEST_NONE);
+ expect(getKeyPropertiesRet.properties[3].value).assertEqual(huks.HuksKeyDigest.HUKS_DIGEST_NONE);
console.log('getKeyPropertiesRet ' + JSON.stringify(getKeyPropertiesRet));
var deleteKeyResult = await huks.deleteKey(defaultAlias, emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist(defaultAlias, emptyOption);
expect(isKeyExistResult).assertEqual(false);
done();
@@ -314,14 +310,14 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
*/
it('HuksTest_JSApiTest_getKeyProperties_00600', 0, async function (done) {
var ecc224Result = await huks.generateKey(defaultAlias, ecc224Option);
- expect(ecc224Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(ecc224Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
huks.getKeyProperties(defaultAlias, emptyOption, function (err, data) {
console.log('getKeyPropertiesRet ' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(data.properties[0].value).assertEqual(huks.HksKeyAlg.HKS_ALG_ECC);
- expect(data.properties[1].value).assertEqual(huks.HksKeySize.HKS_ECC_KEY_SIZE_224);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ expect(data.properties[0].value).assertEqual(huks.HuksKeyAlg.HUKS_ALG_ECC);
+ expect(data.properties[1].value).assertEqual(huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224);
expect(data.properties[2].value).assertEqual(signAndVerify);
- expect(data.properties[3].value).assertEqual(huks.HksKeyDigest.HKS_DIGEST_NONE);
+ expect(data.properties[3].value).assertEqual(huks.HuksKeyDigest.HUKS_DIGEST_NONE);
deleteKeyFun(done);
});
setTimeout(function () {
@@ -335,17 +331,16 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
*/
it('HuksTest_JSApiTest_getKeyProperties_00700', 0, async function (done) {
var hmacSHA1Result = await huks.generateKey(defaultAlias, hmacSHA1Option);
- expect(hmacSHA1Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA1Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var getKeyPropertiesRet = await huks.getKeyProperties(defaultAlias, emptyOption);
- expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(getKeyPropertiesRet.properties[0].value).assertEqual(huks.HksKeyAlg.HKS_ALG_HMAC);
- expect(getKeyPropertiesRet.properties[1].value).assertEqual(huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC);
- expect(getKeyPropertiesRet.properties[2].value).assertEqual(huks.HksKeyDigest.HKS_DIGEST_SHA1);
- expect(getKeyPropertiesRet.properties[3].value).assertEqual(huks.HksKeyType.HKS_KEY_TYPE_HMAC);
- expect(getKeyPropertiesRet.properties[4].value).assertEqual(160);
+ expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ expect(getKeyPropertiesRet.properties[0].value).assertEqual(huks.HuksKeyAlg.HUKS_ALG_HMAC);
+ expect(getKeyPropertiesRet.properties[1].value).assertEqual(huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ expect(getKeyPropertiesRet.properties[2].value).assertEqual(huks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ expect(getKeyPropertiesRet.properties[3].value).assertEqual(160);
console.log('getKeyPropertiesRet ' + JSON.stringify(getKeyPropertiesRet));
var deleteKeyResult = await huks.deleteKey(defaultAlias, emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist(defaultAlias, emptyOption);
expect(isKeyExistResult).assertEqual(false);
done();
@@ -360,15 +355,14 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
*/
it('HuksTest_JSApiTest_getKeyProperties_00800', 0, async function (done) {
var hmacSHA1Result = await huks.generateKey(defaultAlias, hmacSHA1Option);
- expect(hmacSHA1Result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(hmacSHA1Result.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
huks.getKeyProperties(defaultAlias, emptyOption, function (err, data) {
console.log('getKeyPropertiesRet ' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(data.properties[0].value).assertEqual(huks.HksKeyAlg.HKS_ALG_HMAC);
- expect(data.properties[1].value).assertEqual(huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC);
- expect(data.properties[2].value).assertEqual(huks.HksKeyDigest.HKS_DIGEST_SHA1);
- expect(data.properties[3].value).assertEqual(huks.HksKeyType.HKS_KEY_TYPE_HMAC);
- expect(data.properties[4].value).assertEqual(160);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ expect(data.properties[0].value).assertEqual(huks.HuksKeyAlg.HUKS_ALG_HMAC);
+ expect(data.properties[1].value).assertEqual(huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC);
+ expect(data.properties[2].value).assertEqual(huks.HuksKeyDigest.HUKS_DIGEST_SHA1);
+ expect(data.properties[3].value).assertEqual(160);
deleteKeyFun(done);
});
setTimeout(function () {
@@ -383,19 +377,19 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
it('HuksTest_JSApiTest_getKeyProperties_00900', 0, async function (done) {
var dsaResult = await huks.generateKey(defaultAlias, dsaOption);
if (useLib == 'mbedtls') {
- expect(dsaResult.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(dsaResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
} else {
- expect(dsaResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(dsaResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var getKeyPropertiesRet = await huks.getKeyProperties(defaultAlias, emptyOption);
- expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(getKeyPropertiesRet.properties[0].value).assertEqual(huks.HksKeyAlg.HKS_ALG_DSA);
+ expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ expect(getKeyPropertiesRet.properties[0].value).assertEqual(huks.HuksKeyAlg.HUKS_ALG_DSA);
expect(getKeyPropertiesRet.properties[1].value).assertEqual(signAndVerify);
expect(getKeyPropertiesRet.properties[2].value).assertEqual(dsaKeySize);
- expect(getKeyPropertiesRet.properties[3].value).assertEqual(huks.HksKeyDigest.HKS_DIGEST_SHA1);
+ expect(getKeyPropertiesRet.properties[3].value).assertEqual(huks.HuksKeyDigest.HUKS_DIGEST_SHA1);
console.log('getKeyPropertiesRet ' + JSON.stringify(getKeyPropertiesRet));
var deleteKeyResult = await huks.deleteKey(defaultAlias, emptyOption);
- expect(huks.HksErrorCode.HKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
+ expect(huks.HuksErrorCode.HUKS_SUCCESS).assertEqual(deleteKeyResult.errorCode);
var isKeyExistResult = await huks.isKeyExist(defaultAlias, emptyOption);
expect(isKeyExistResult).assertEqual(false);
}
@@ -412,17 +406,17 @@ describe('HuksTest_JSApiTest_DeriveKey', function () {
it('HuksTest_JSApiTest_getKeyProperties_01000', 0, async function (done) {
var dsaResult = await huks.generateKey(defaultAlias, dsaOption);
if (useLib == 'mbedtls') {
- expect(dsaResult.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ expect(dsaResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
done();
} else {
- expect(dsaResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(dsaResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
huks.getKeyProperties(defaultAlias, emptyOption, function (err, data) {
console.log('getKeyPropertiesRet ' + JSON.stringify(data));
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(data.properties[0].value).assertEqual(huks.HksKeyAlg.HKS_ALG_DSA);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ expect(data.properties[0].value).assertEqual(huks.HuksKeyAlg.HUKS_ALG_DSA);
expect(data.properties[1].value).assertEqual(signAndVerify);
expect(data.properties[2].value).assertEqual(dsaKeySize);
- expect(data.properties[3].value).assertEqual(huks.HksKeyDigest.HKS_DIGEST_SHA1);
+ expect(data.properties[3].value).assertEqual(huks.HuksKeyDigest.HUKS_DIGEST_SHA1);
deleteKeyFun(done);
});
}
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_agree.test.js b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_agree.test.js
index b6659691cce77b89f30bff828f8e416dac2dbe81..1acf62041cff19dafc03a2eb9f0c05729b78b9ae 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_agree.test.js
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_agree.test.js
@@ -32,11 +32,11 @@ var keyB = [];
function makeAgreeOptions(alg, size, publicKey) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: alg
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
var options = {
@@ -48,101 +48,101 @@ function makeAgreeOptions(alg, size, publicKey) {
describe('Hks_XtsTest_AlgCompletion_Agree', function () {
- /**
- * @tc.number HUKS_ALG_COMPLETION_37300
- * @tc.name DH2048_DH_Promise
- * @tc.desc Test for algorithm completion(agree with DH).
- */
- it('HUKS_ALG_COMPLETION_37300', 0, async function (done) {
- agreePromise(
- huks.HksKeyAlg.HKS_ALG_DH,
- huks.HksKeySize.HKS_DH_KEY_SIZE_2048,
- done,
- 'HUKS_ALG_COMPLETION_37300'
- );
- setTimeout(function () {
- }, timer);
- });
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_37300
+ * @tc.name DH2048_DH_Promise
+ * @tc.desc Test for algorithm completion(agree with DH).
+ */
+ it('HUKS_ALG_COMPLETION_37300', 0, async function (done) {
+ agreePromise(
+ huks.HuksKeyAlg.HUKS_ALG_DH,
+ huks.HuksKeySize.HUKS_DH_KEY_SIZE_2048,
+ done,
+ 'HUKS_ALG_COMPLETION_37300'
+ );
+ setTimeout(function () {
+ }, timer);
+ });
- /**
- * @tc.number HUKS_ALG_COMPLETION_37400
- * @tc.name DH3072_DH_Promise
- * @tc.desc Test for algorithm completion(agree with DH).
- */
- it('HUKS_ALG_COMPLETION_37400', 0, async function (done) {
- agreePromise(
- huks.HksKeyAlg.HKS_ALG_DH,
- huks.HksKeySize.HKS_DH_KEY_SIZE_3072,
- done,
- 'HUKS_ALG_COMPLETION_37400'
- );
- setTimeout(function () {
- }, timer);
- });
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_37400
+ * @tc.name DH3072_DH_Promise
+ * @tc.desc Test for algorithm completion(agree with DH).
+ */
+ it('HUKS_ALG_COMPLETION_37400', 0, async function (done) {
+ agreePromise(
+ huks.HuksKeyAlg.HUKS_ALG_DH,
+ huks.HuksKeySize.HUKS_DH_KEY_SIZE_3072,
+ done,
+ 'HUKS_ALG_COMPLETION_37400'
+ );
+ setTimeout(function () {
+ }, timer);
+ });
- /**
- * @tc.number HUKS_ALG_COMPLETION_37500
- * @tc.name DH4096_DH_Promise
- * @tc.desc Test for algorithm completion(agree with DH).
- */
- it('HUKS_ALG_COMPLETION_37500', 0, async function (done) {
- agreePromise(
- huks.HksKeyAlg.HKS_ALG_DH,
- huks.HksKeySize.HKS_DH_KEY_SIZE_4096,
- done,
- 'HUKS_ALG_COMPLETION_37500'
- );
- setTimeout(function () {
- }, timer);
- });
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_37500
+ * @tc.name DH4096_DH_Promise
+ * @tc.desc Test for algorithm completion(agree with DH).
+ */
+ it('HUKS_ALG_COMPLETION_37500', 0, async function (done) {
+ agreePromise(
+ huks.HuksKeyAlg.HUKS_ALG_DH,
+ huks.HuksKeySize.HUKS_DH_KEY_SIZE_4096,
+ done,
+ 'HUKS_ALG_COMPLETION_37500'
+ );
+ setTimeout(function () {
+ }, timer);
+ });
- /**
- * @tc.number HUKS_ALG_COMPLETION_37600
- * @tc.name DH2048_DH_AsyncCallback
- * @tc.desc Test for algorithm completion(agree with DH).
- */
- it('HUKS_ALG_COMPLETION_37600', 0, async function (done) {
- agreeCallback(
- huks.HksKeyAlg.HKS_ALG_DH,
- huks.HksKeySize.HKS_DH_KEY_SIZE_2048,
- done,
- 'HUKS_ALG_COMPLETION_37600'
- );
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_ALG_COMPLETION_37700
- * @tc.name DH3072_DH_AsyncCallback
- * @tc.desc Test for algorithm completion(agree with DH).
- */
- it('HUKS_ALG_COMPLETION_37700', 0, async function (done) {
- agreeCallback(
- huks.HksKeyAlg.HKS_ALG_DH,
- huks.HksKeySize.HKS_DH_KEY_SIZE_3072,
- done,
- 'HUKS_ALG_COMPLETION_37700'
- );
- setTimeout(function () {
- }, timer);
- });
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_37600
+ * @tc.name DH2048_DH_AsyncCallback
+ * @tc.desc Test for algorithm completion(agree with DH).
+ */
+ it('HUKS_ALG_COMPLETION_37600', 0, async function (done) {
+ agreeCallback(
+ huks.HuksKeyAlg.HUKS_ALG_DH,
+ huks.HuksKeySize.HUKS_DH_KEY_SIZE_2048,
+ done,
+ 'HUKS_ALG_COMPLETION_37600'
+ );
+ setTimeout(function () {
+ }, timer);
+ });
+
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_37700
+ * @tc.name DH3072_DH_AsyncCallback
+ * @tc.desc Test for algorithm completion(agree with DH).
+ */
+ it('HUKS_ALG_COMPLETION_37700', 0, async function (done) {
+ agreeCallback(
+ huks.HuksKeyAlg.HUKS_ALG_DH,
+ huks.HuksKeySize.HUKS_DH_KEY_SIZE_3072,
+ done,
+ 'HUKS_ALG_COMPLETION_37700'
+ );
+ setTimeout(function () {
+ }, timer);
+ });
- /**
- * @tc.number HUKS_ALG_COMPLETION_37800
- * @tc.name DH4096_DH_AsyncCallback
- * @tc.desc Test for algorithm completion(agree with DH).
- */
- it('HUKS_ALG_COMPLETION_37800', 0, async function (done) {
- agreeCallback(
- huks.HksKeyAlg.HKS_ALG_DH,
- huks.HksKeySize.HKS_DH_KEY_SIZE_4096,
- done,
- 'HUKS_ALG_COMPLETION_37800'
- );
- setTimeout(function () {
- }, timer);
- });
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_37800
+ * @tc.name DH4096_DH_AsyncCallback
+ * @tc.desc Test for algorithm completion(agree with DH).
+ */
+ it('HUKS_ALG_COMPLETION_37800', 0, async function (done) {
+ agreeCallback(
+ huks.HuksKeyAlg.HUKS_ALG_DH,
+ huks.HuksKeySize.HUKS_DH_KEY_SIZE_4096,
+ done,
+ 'HUKS_ALG_COMPLETION_37800'
+ );
+ setTimeout(function () {
+ }, timer);
+ });
/**
* @tc.number HUKS_ALG_COMPLETION_37900
@@ -151,8 +151,8 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_37900', 0, async function (done) {
agreePromise(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
done,
'HUKS_ALG_COMPLETION_37900'
);
@@ -167,8 +167,8 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_38000', 0, async function (done) {
agreePromise(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
done,
'HUKS_ALG_COMPLETION_38000'
);
@@ -183,8 +183,8 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_38100', 0, async function (done) {
agreePromise(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
done,
'HUKS_ALG_COMPLETION_38100'
);
@@ -199,8 +199,8 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_38200', 0, async function (done) {
agreePromise(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
done,
'HUKS_ALG_COMPLETION_38200'
);
@@ -215,8 +215,8 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_38300', 0, async function (done) {
agreeCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
done,
'HUKS_ALG_COMPLETION_38300'
);
@@ -229,12 +229,12 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
* @tc.name ECDH256_AsyncCallback
* @tc.desc Test for algorithm completion(agree with ECDH).
*/
- it('HUKS_ALG_COMPLETION_38300', 0, async function (done) {
+ it('HUKS_ALG_COMPLETION_38400', 0, async function (done) {
agreeCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
done,
- 'HUKS_ALG_COMPLETION_38300'
+ 'HUKS_ALG_COMPLETION_38400'
);
setTimeout(function () {
}, timer);
@@ -247,8 +247,8 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_38500', 0, async function (done) {
agreeCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
done,
'HUKS_ALG_COMPLETION_38500'
);
@@ -263,8 +263,8 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_38600', 0, async function (done) {
agreeCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
done,
'HUKS_ALG_COMPLETION_38600'
);
@@ -279,8 +279,8 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_38700', 0, async function (done) {
agreePromise(
- huks.HksKeyAlg.HKS_ALG_X25519,
- huks.HksKeySize.HKS_CURVE25519_KEY_SIZE_256,
+ huks.HuksKeyAlg.HUKS_ALG_X25519,
+ huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256,
done,
'HUKS_ALG_COMPLETION_38700'
);
@@ -295,8 +295,8 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_38800', 0, async function (done) {
agreeCallback(
- huks.HksKeyAlg.HKS_ALG_X25519,
- huks.HksKeySize.HKS_CURVE25519_KEY_SIZE_256,
+ huks.HuksKeyAlg.HUKS_ALG_X25519,
+ huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256,
done,
'HUKS_ALG_COMPLETION_38800'
);
@@ -312,14 +312,14 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
it('HUKS_ALG_COMPLETION_38900', 0, async function (done) {
var generateKeyOptions = makeGenerateKeyOption(
-1,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
null,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
var generateKeyRet = await huks.generateKey(defaultAliasA, generateKeyOptions);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(generateKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
done();
setTimeout(function () {
}, timer);
@@ -333,14 +333,14 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
it('HUKS_ALG_COMPLETION_39000', 0, async function (done) {
var generateKeyOptions = makeGenerateKeyOption(
-1,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
null,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
huks.generateKey(defaultAliasA, generateKeyOptions, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
done();
});
setTimeout(function () {
@@ -354,15 +354,15 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_39100', 0, async function (done) {
var generateKeyOptions = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
-1,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
null,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
var generateKeyRet = await huks.generateKey(defaultAliasA, generateKeyOptions);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_KEY_SIZE);
+ expect(generateKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
done();
setTimeout(function () {
}, timer);
@@ -375,15 +375,15 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_39200', 0, async function (done) {
var generateKeyOptions = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
-1,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
null,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
huks.generateKey(defaultAliasA, generateKeyOptions, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_KEY_SIZE);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_SIZE);
done();
});
setTimeout(function () {
@@ -397,15 +397,15 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_39300', 0, async function (done) {
var generateKeyOptions = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
-1,
null,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
var generateKeyRet = await huks.generateKey(defaultAliasA, generateKeyOptions);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_PURPOSE);
+ expect(generateKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
done();
setTimeout(function () {
}, timer);
@@ -418,15 +418,15 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_39400', 0, async function (done) {
var generateKeyOptions = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
-1,
null,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
huks.generateKey(defaultAliasA, generateKeyOptions, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_PURPOSE);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_PURPOSE);
done();
});
setTimeout(function () {
@@ -440,15 +440,15 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_39500', 0, async function (done) {
var generateKeyOptions = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
null,
null,
-1
);
var generateKeyRet = await huks.generateKey(defaultAliasA, generateKeyOptions);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(generateKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
done();
setTimeout(function () {
}, timer);
@@ -461,15 +461,15 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_39600', 0, async function (done) {
var generateKeyOptions = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
null,
null,
-1
);
huks.generateKey(defaultAliasA, generateKeyOptions, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
done();
});
setTimeout(function () {
@@ -483,17 +483,17 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_39700', 0, async function (done) {
var generateKeyOptions = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
null,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
var generateKeyARet = await huks.generateKey(defaultAliasA, generateKeyOptions);
- expect(generateKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(generateKeyARet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var generateKeyBRet = await huks.generateKey(defaultAliasB, generateKeyOptions);
- expect(generateKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(generateKeyBRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var exportKeyARet = await huks.exportKey(defaultAliasA, emptyOption);
publicKeyA = exportKeyARet.outData;
@@ -503,14 +503,14 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
var agreeKeyAOption = makeAgreeOptions(
-1,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
publicKeyB
);
var agreeKeyARet = await huks.agreeKey(defaultAliasB, agreeKeyAOption);
- expect(agreeKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(agreeKeyARet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
huks.agreeKey(defaultAliasA, agreeKeyAOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ALGORITHM);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ALGORITHM);
done();
});
@@ -525,30 +525,30 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
*/
it('HUKS_ALG_COMPLETION_39800', 0, async function (done) {
var generateKeyOptions = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
null,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
var generateKeyARet = await huks.generateKey(defaultAliasA, generateKeyOptions);
- expect(generateKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(generateKeyARet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var generateKeyBRet = await huks.generateKey(defaultAliasB, generateKeyOptions);
- expect(generateKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(generateKeyBRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var exportKeyARet = await huks.exportKey(defaultAliasA, emptyOption);
publicKeyA = exportKeyARet.outData;
var exportKeyBRet = await huks.exportKey(defaultAliasB, emptyOption);
publicKeyB = exportKeyBRet.outData;
var agreeKeyAOption = makeAgreeOptions(
- huks.HksKeyAlg.HKS_ALG_ECDH,
+ huks.HuksKeyAlg.HUKS_ALG_ECDH,
-1,
publicKeyB
);
var agreeKeyARet = await huks.agreeKey(defaultAliasB, agreeKeyAOption);
- expect(agreeKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(agreeKeyARet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
huks.agreeKey(defaultAliasA, agreeKeyAOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
});
setTimeout(function () {
@@ -572,14 +572,14 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
function deleteKeyB(caseId, done) {
huks.deleteKey(defaultAliasB, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
isKeyAExist(caseId, done);
});
};
function deleteKeyA(caseId, done) {
huks.deleteKey(defaultAliasA, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
deleteKeyB(caseId, done);
});
};
@@ -587,7 +587,7 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
function agreeKeyB(alg, size, done, caseId) {
var agreeKeyAOption = makeAgreeOptions(alg, size, publicKeyB);
huks.agreeKey(defaultAliasA, agreeKeyAOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
keyB = data.outData;
expect(JSON.stringify(keyB)).assertEqual(JSON.stringify(keyA));
deleteKeyA(caseId, done);
@@ -595,12 +595,12 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
};
function agreeKeyA(alg, size, done, caseId) {
- if (alg == huks.HksKeyAlg.HKS_ALG_ECC) {
- alg = huks.HksKeyAlg.HKS_ALG_ECDH
+ if (alg == huks.HuksKeyAlg.HUKS_ALG_ECC) {
+ alg = huks.HuksKeyAlg.HUKS_ALG_ECDH
}
var agreeKeyAOption = makeAgreeOptions(alg, size, publicKeyB);
huks.agreeKey(defaultAliasA, agreeKeyAOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
keyA = data.outData;
agreeKeyB(alg, size, done, caseId);
});
@@ -608,11 +608,11 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
function exportKeyB(alg, size, done, caseId) {
huks.exportKey(defaultAliasB, emptyOption, function (err, data) {
- if (useLib == 'openssl' && alg == huks.HksKeyAlg.HKS_ALG_X25519) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ if (useLib == 'openssl' && alg == huks.HuksKeyAlg.HUKS_ALG_X25519) {
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
} else {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
publicKeyB = data.outData;
agreeKeyA(alg, size, done, caseId);
}
@@ -621,10 +621,10 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
function exportKeyA(alg, size, done, caseId) {
huks.exportKey(defaultAliasA, emptyOption, function (err, data) {
- if (useLib == 'openssl' && alg == huks.HksKeyAlg.HKS_ALG_X25519) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ if (useLib == 'openssl' && alg == huks.HuksKeyAlg.HUKS_ALG_X25519) {
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
} else {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
publicKeyA = data.outData;
}
exportKeyB(alg, size, done, caseId);
@@ -635,13 +635,13 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
var generateKeyBOption = makeGenerateKeyOption(
alg,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
null,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
huks.generateKey(defaultAliasB, generateKeyBOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
exportKeyA(alg, size, done, caseId);
});
};
@@ -650,13 +650,13 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
var generateKeyAOption = makeGenerateKeyOption(
alg,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE,
null,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
huks.generateKey(defaultAliasA, generateKeyAOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
generateKeyB(alg, size, done, caseId);
});
};
@@ -667,41 +667,41 @@ describe('Hks_XtsTest_AlgCompletion_Agree', function () {
async function agreePromise(alg, size, done, caseId){
var generateKeyAOption = makeGenerateKeyOption(
- alg, size, huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE, null, null, huks.HksKeyDigest.HKS_DIGEST_NONE
+ alg, size, huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE, null, null, huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
var generateKeyARet = await huks.generateKey(defaultAliasA, generateKeyAOption);
- expect(generateKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(generateKeyARet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var generateKeyBOption = makeGenerateKeyOption(
- alg, size, huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE, null, null, huks.HksKeyDigest.HKS_DIGEST_NONE
+ alg, size, huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE, null, null, huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
var generateKeyBRet = await huks.generateKey(defaultAliasB, generateKeyBOption);
- expect(generateKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(generateKeyBRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var exportKeyARet = await huks.exportKey(defaultAliasA, emptyOption);
var exportKeyBRet = await huks.exportKey(defaultAliasB, emptyOption);
- if (useLib == 'openssl' && alg == huks.HksKeyAlg.HKS_ALG_X25519) {
- expect(exportKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
- expect(exportKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_ARGUMENT);
+ if (useLib == 'openssl' && alg == huks.HuksKeyAlg.HUKS_ALG_X25519) {
+ expect(exportKeyARet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
+ expect(exportKeyBRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_ARGUMENT);
done();
} else {
- expect(exportKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(exportKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(exportKeyARet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ expect(exportKeyBRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
publicKeyA = exportKeyARet.outData;
publicKeyB = exportKeyBRet.outData;
- if (alg == huks.HksKeyAlg.HKS_ALG_ECC) {
- alg = huks.HksKeyAlg.HKS_ALG_ECDH
+ if (alg == huks.HuksKeyAlg.HUKS_ALG_ECC) {
+ alg = huks.HuksKeyAlg.HUKS_ALG_ECDH
}
var agreeKeyAOption = makeAgreeOptions(alg, size, publicKeyB);
var agreeKeyARet = await huks.agreeKey(defaultAliasA, agreeKeyAOption);
- expect(agreeKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(agreeKeyARet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var agreeKeyBOption = makeAgreeOptions(alg, size, publicKeyA);
var agreeKeyBRet = await huks.agreeKey(defaultAliasB, agreeKeyBOption);
- expect(agreeKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(agreeKeyBRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
expect(JSON.stringify(agreeKeyARet.outData)).assertEqual(JSON.stringify(agreeKeyBRet.outData));
var deleteKeyARet = await huks.deleteKey(defaultAliasA, emptyOption);
- expect(deleteKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deleteKeyARet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var deleteKeyBRet = await huks.deleteKey(defaultAliasB, emptyOption);
- expect(deleteKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deleteKeyBRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var isKeyAExist = await huks.isKeyExist(defaultAliasA, emptyOption);
expect(isKeyAExist).assertEqual(false);
var isKeyBExist = await huks.isKeyExist(defaultAliasA, emptyOption);
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_encryptAndDecrypt_aes.test.js b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_encryptAndDecrypt_aes.test.js
index 0f829516059bf3602411a558280812091a0233be..cd39f08989269855d16d638e8c31e7cf4ba0a759 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_encryptAndDecrypt_aes.test.js
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_encryptAndDecrypt_aes.test.js
@@ -29,9 +29,9 @@ var alias = '';
function makeAesGenerateKeyOption (size, padding, mode) {
var option = makeGenerateKeyOption (
- huks.HksKeyAlg.HKS_ALG_AES,
+ huks.HuksKeyAlg.HUKS_ALG_AES,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
padding,
mode
);
@@ -40,8 +40,8 @@ function makeAesGenerateKeyOption (size, padding, mode) {
function makeAesEncryptOption (padding, mode) {
var option = makeEncryptAndDecryptOption (
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyAlg.HUKS_ALG_AES,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
padding,
mode,
null,
@@ -53,8 +53,8 @@ function makeAesEncryptOption (padding, mode) {
function makeAesDecryptOption (padding, mode, ciphertext) {
var option = makeEncryptAndDecryptOption (
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyAlg.HUKS_ALG_AES,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
padding,
mode,
null,
@@ -73,9 +73,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_00100', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_00100'
);
@@ -88,9 +88,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_00200', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_00200'
);
@@ -103,9 +103,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_00300', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_00300'
);
@@ -118,9 +118,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_00400', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_00400'
);
@@ -133,9 +133,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_00500', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_00500'
);
@@ -148,9 +148,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_00600', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_00600'
);
@@ -163,9 +163,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_00700', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_00700'
);
@@ -178,9 +178,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_00800', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_00800'
);
@@ -193,9 +193,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_00900', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_00900'
);
@@ -208,9 +208,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_01000', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_01000'
);
@@ -223,9 +223,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_01100', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_01100'
);
@@ -238,9 +238,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_01200', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_CBC,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_CBC,
done,
'HUKS_ALG_COMPLETION_01200'
);
@@ -253,9 +253,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_01300', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CTR,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CTR,
done,
'HUKS_ALG_COMPLETION_01300'
);
@@ -268,9 +268,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_01400', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CTR,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CTR,
done,
'HUKS_ALG_COMPLETION_01400'
);
@@ -283,9 +283,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_01500', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CTR,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CTR,
done,
'HUKS_ALG_COMPLETION_01500'
);
@@ -298,9 +298,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_01600', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CTR,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CTR,
done,
'HUKS_ALG_COMPLETION_01600'
);
@@ -313,9 +313,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_01700', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CTR,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CTR,
done,
'HUKS_ALG_COMPLETION_01700'
);
@@ -328,9 +328,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_01800', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CTR,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_CTR,
done,
'HUKS_ALG_COMPLETION_01800'
);
@@ -343,9 +343,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_01900', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_01900'
);
@@ -358,9 +358,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_02000', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_02000'
);
@@ -373,9 +373,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_02100', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_02100'
);
@@ -388,9 +388,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_02200', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_02200'
);
@@ -403,9 +403,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_02300', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_02300'
);
@@ -418,9 +418,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_02400', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_02400'
);
@@ -433,9 +433,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_02500', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_02500'
);
@@ -448,9 +448,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_02600', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_02600'
);
@@ -463,9 +463,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_02700', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_02700'
);
@@ -478,9 +478,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_02800', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_02800'
);
@@ -493,9 +493,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_02900', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_02900'
);
@@ -508,9 +508,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_03000', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_PKCS7,
- huks.HksCipherMode.HKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS7,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
done,
'HUKS_ALG_COMPLETION_03000'
);
@@ -523,9 +523,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_03100', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_GCM,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_GCM,
done,
'HUKS_ALG_COMPLETION_03100'
);
@@ -538,9 +538,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_03200', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_GCM,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_GCM,
done,
'HUKS_ALG_COMPLETION_03200'
);
@@ -553,9 +553,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_03300', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_GCM,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_GCM,
done,
'HUKS_ALG_COMPLETION_03300'
);
@@ -568,9 +568,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_03400', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_192,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_GCM,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_192,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_GCM,
done,
'HUKS_ALG_COMPLETION_03400'
);
@@ -583,9 +583,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_03500', 0, async function (done) {
encryptAndDecryptWithPromise (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_GCM,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_GCM,
done,
'HUKS_ALG_COMPLETION_03500'
);
@@ -598,9 +598,9 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
*/
it ('HUKS_ALG_COMPLETION_03600', 0, async function (done) {
encryptAndDecryptWithCallback (
- huks.HksKeySize.HKS_AES_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_GCM,
+ huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_GCM,
done,
'HUKS_ALG_COMPLETION_03600'
);
@@ -609,42 +609,42 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
async function encryptAndDecryptWithPromise (size, padding, mode, done, caseId) {
var generateKeyOption = makeAesGenerateKeyOption (size, padding, mode);
var generateKeyResult = await huks.generateKey (caseId, generateKeyOption);
- expect (generateKeyResult.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (generateKeyResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var isKeyExist = await huks.isKeyExist (caseId, emptyOption);
expect (isKeyExist).assertEqual (true);
var encryptOption = makeAesEncryptOption (padding, mode);
var encryptResult = await huks.encrypt (caseId, encryptOption);
if (useLib == 'openssl') {
- expect (encryptResult.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (encryptResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var decryptOption = makeAesDecryptOption (padding, mode, encryptResult.outData);
var decryptResult = await huks.decrypt (caseId, decryptOption);
- expect (decryptResult.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (decryptResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
expect (JSON.stringify (plainText)).assertEqual (JSON.stringify (decryptResult.outData));
var deleteKeyResult = await huks.deleteKey (caseId, emptyOption);
- expect (deleteKeyResult.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (deleteKeyResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var isKeyExist = await huks.isKeyExist (caseId, emptyOption);
expect (isKeyExist).assertEqual (false);
} else {
- if (mode == huks.HksCipherMode.HKS_MODE_CBC
- || mode == huks.HksCipherMode.HKS_MODE_CTR
- || mode == huks.HksCipherMode.HKS_MODE_GCM) {
- expect (encryptResult.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ if (mode == huks.HuksCipherMode.HUKS_MODE_CBC
+ || mode == huks.HuksCipherMode.HUKS_MODE_CTR
+ || mode == huks.HuksCipherMode.HUKS_MODE_GCM) {
+ expect (encryptResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var decryptOption = makeAesDecryptOption (padding, mode, encryptResult.outData);
var decryptResult = await huks.decrypt (caseId, decryptOption);
- expect (decryptResult.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (decryptResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
expect (JSON.stringify (plainText)).assertEqual (JSON.stringify (decryptResult.outData));
var deleteKeyResult = await huks.deleteKey (caseId, emptyOption);
- expect (deleteKeyResult.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (deleteKeyResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var isKeyExist = await huks.isKeyExist (caseId, emptyOption);
expect (isKeyExist).assertEqual (false);
- } else if (huks.HksCipherMode.HKS_MODE_ECB) {
- if (padding == huks.HksKeyPadding.HKS_PADDING_PKCS7) {
- expect (encryptResult.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ } else if (huks.HuksCipherMode.HUKS_MODE_ECB) {
+ if (padding == huks.HuksKeyPadding.HUKS_PADDING_PKCS7) {
+ expect (encryptResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
} else {
- expect (encryptResult.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect (encryptResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
}
} else {
- expect (encryptResult.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect (encryptResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
}
}
console.log (caseId + ' end');
@@ -665,7 +665,7 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
function deleteKeyWithCallback (done, caseId) {
huks.deleteKey (caseId, emptyOption, function (err, data) {
- expect (data.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (data.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
checkKeyIsExistAfterDeleteKey (done, caseId);
});
};
@@ -673,7 +673,7 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
function decryptWithCallback (size, padding, mode, ciphertext, done, caseId) {
var decryptOption = makeAesDecryptOption (padding, mode, ciphertext);
huks.decrypt (caseId, decryptOption, function (err, data) {
- expect (data.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (data.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
expect (JSON.stringify (plainText)).assertEqual (JSON.stringify (data.outData));
deleteKeyWithCallback (done, caseId);
});
@@ -686,23 +686,23 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
decryptWithCallback (size, padding, mode, data.outData, done, caseId);
} else {
switch (mode) {
- case huks.HksCipherMode.HKS_MODE_CBC:
- case huks.HksCipherMode.HKS_MODE_CTR:
- case huks.HksCipherMode.HKS_MODE_GCM:
- expect (data.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ case huks.HuksCipherMode.HUKS_MODE_CBC:
+ case huks.HuksCipherMode.HUKS_MODE_CTR:
+ case huks.HuksCipherMode.HUKS_MODE_GCM:
+ expect (data.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
decryptWithCallback (size, padding, mode, data.outData, done, caseId);
break;
- case huks.HksCipherMode.HKS_MODE_ECB:
- if (padding == huks.HksKeyPadding.HKS_PADDING_PKCS7) {
- expect (data.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ case huks.HuksCipherMode.HUKS_MODE_ECB:
+ if (padding == huks.HuksKeyPadding.HUKS_PADDING_PKCS7) {
+ expect (data.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
done ();
} else {
- expect (data.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect (data.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
done ();
}
break;
default:
- expect (data.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect (data.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
done ();
}
}
@@ -719,7 +719,7 @@ describe ('Hks_XtsTest_algCompletion_Aes_Encrypt_Decrypt', function () {
function encryptAndDecryptWithCallback (size, padding, mode, done, caseId) {
var generateKeyOption = makeAesGenerateKeyOption (size, padding, mode);
huks.generateKey (caseId, generateKeyOption, function (err, data) {
- expect (data.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (data.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
checkKeyIsExistAfterGenerateKey (size, padding, mode, done, caseId);
});
};
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_encryptAndDecrypt_rsa.test.js b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_encryptAndDecrypt_rsa.test.js
index b2c2f70f5cf6e1e9eebc09fe59ac51f937950cde..d7755d4254eca9591b5d862430ba3cb5d4257394 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_encryptAndDecrypt_rsa.test.js
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_encryptAndDecrypt_rsa.test.js
@@ -33,32 +33,32 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
function makePlainTextSize(size,padding,digest){
var plainTextSize = 0;
- if (padding == huks.HksKeyPadding.HKS_PADDING_OAEP) {
- if (digest == huks.HksKeyDigest.HKS_DIGEST_SHA224 && size == huks.HksKeySize.HKS_RSA_KEY_SIZE_512) {
+ if (padding == huks.HuksKeyPadding.HUKS_PADDING_OAEP) {
+ if (digest == huks.HuksKeyDigest.HUKS_DIGEST_SHA224 && size == huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512) {
plainTextSize = 4;
} else {
plainTextSize = 16;
}
- } else if (padding == huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5) {
+ } else if (padding == huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5) {
plainTextSize = 8;
} else {
switch (size) {
- case huks.HksKeySize.HKS_RSA_KEY_SIZE_512:
+ case huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512:
plainTextSize = 64;
break;
- case huks.HksKeySize.HKS_RSA_KEY_SIZE_768:
+ case huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768:
plainTextSize = 96;
break;
- case huks.HksKeySize.HKS_RSA_KEY_SIZE_1024:
+ case huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024:
plainTextSize = 128;
break;
- case huks.HksKeySize.HKS_RSA_KEY_SIZE_2048:
+ case huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048:
plainTextSize = 256;
break;
- case huks.HksKeySize.HKS_RSA_KEY_SIZE_3072:
+ case huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072:
plainTextSize = 384;
break;
- case huks.HksKeySize.HKS_RSA_KEY_SIZE_4096:
+ case huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096:
plainTextSize = 512;
break;
default:
@@ -72,44 +72,44 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
var plainTextSize = makePlainTextSize(size, padding,digest);
var plainText = makeRandomArr(plainTextSize);
var genKeyOpt = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_RSA,size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,padding,mode,digest
+ huks.HuksKeyAlg.HUKS_ALG_RSA,size,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,padding,mode,digest
);
var genKeyRet = await huks.generateKey(aliasForRSADecrypt, genKeyOpt);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(genKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var exportKeyRet = await huks.exportKey(aliasForRSADecrypt, emptyOption);
- expect(exportKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(exportKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
publicKey = exportKeyRet.outData;
var importKeyOpt = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_RSA,size,huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,padding,mode,digest,publicKey
+ huks.HuksKeyAlg.HUKS_ALG_RSA,size,huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,padding,mode,digest,publicKey
);
var importRet = await huks.importKey(aliasForRSAEncrypt, importKeyOpt);
- expect(importRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(importRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var isEncryptKeyExist = await huks.isKeyExist(aliasForRSAEncrypt, emptyOption);
expect(isEncryptKeyExist).assertEqual(true);
var isDecryptKeyExist = await huks.isKeyExist(aliasForRSADecrypt, emptyOption);
expect(isDecryptKeyExist).assertEqual(true);
var encryptOpt = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_RSA,huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,padding,mode,size,digest,plainText
+ huks.HuksKeyAlg.HUKS_ALG_RSA,huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,padding,mode,size,digest,plainText
);
var encryptRet = await huks.encrypt(aliasForRSAEncrypt, encryptOpt);
if (useLib == 'mbedtls'
- && mode == huks.HksCipherMode.HKS_MODE_ECB
- && padding == huks.HksKeyPadding.HKS_PADDING_NONE){
- expect(encryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ && mode == huks.HuksCipherMode.HUKS_MODE_ECB
+ && padding == huks.HuksKeyPadding.HUKS_PADDING_NONE){
+ expect(encryptRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
} else {
- expect(encryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(encryptRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
ciphertext = encryptRet.outData;
var decryptOpt = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_RSA,huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,padding,mode,size,digest,ciphertext
+ huks.HuksKeyAlg.HUKS_ALG_RSA,huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,padding,mode,size,digest,ciphertext
);
var decryptRet = await huks.decrypt(aliasForRSADecrypt, decryptOpt);
- expect(decryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(decryptRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
expect(JSON.stringify(plainText)).assertEqual(JSON.stringify(decryptRet.outData));
var deleteEncryptKeyRet = await huks.deleteKey(aliasForRSAEncrypt, emptyOption);
- expect(deleteEncryptKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deleteEncryptKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var deleteDecryptKeyRet = await huks.deleteKey(aliasForRSADecrypt, emptyOption);
- expect(deleteDecryptKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deleteDecryptKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
isEncryptKeyExist = await huks.isKeyExist(aliasForRSAEncrypt, emptyOption);
expect(isEncryptKeyExist).assertEqual(false);
isDecryptKeyExist = await huks.isKeyExist(aliasForRSADecrypt, emptyOption);
@@ -136,22 +136,22 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
function deleteDecryptKeyWithCallback(done, caseId) {
huks.deleteKey(aliasForRSADecrypt, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
checkEncryptKeyDeletedWithCallback(done, caseId);
});
};
function deleteEncryptKeyWithCallback(done, caseId) {
huks.deleteKey(aliasForRSAEncrypt, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
deleteDecryptKeyWithCallback(done, caseId);
});
};
function decryptWithCallback(size, padding, mode, digest, plainText, ciphertext, done, caseId) {
var decryptOpt = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
padding,
mode,
size,
@@ -168,8 +168,8 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
var plainTextSize = makePlainTextSize(size, padding,digest);
var plainText = makeRandomArr(plainTextSize);
var encryptOpt = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
padding,
mode,
size,
@@ -178,12 +178,12 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
);
huks.encrypt(aliasForRSAEncrypt, encryptOpt, function (err, data) {
if (useLib == 'mbedtls'
- && mode == huks.HksCipherMode.HKS_MODE_ECB
- && padding == huks.HksKeyPadding.HKS_PADDING_NONE){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ && mode == huks.HuksCipherMode.HUKS_MODE_ECB
+ && padding == huks.HuksKeyPadding.HUKS_PADDING_NONE){
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
done();
} else {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
decryptWithCallback(size, padding, mode, digest, plainText, data.outData, done, caseId);
}
});
@@ -205,23 +205,23 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
function importWithCallback(size, padding, mode, digest, done, caseId) {
var importKeyOpt = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
padding,
mode,
digest,
publicKey
);
huks.importKey(aliasForRSAEncrypt, importKeyOpt, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
checkEncryptKeyExistWithCallback(size, padding, mode, digest, done, caseId);
});
};
function exportWithCallback(size, padding, mode, digest, done, caseId) {
huks.exportKey(aliasForRSADecrypt, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
publicKey = data.outData;
importWithCallback(size, padding, mode, digest, done, caseId);
});
@@ -229,15 +229,15 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
function encryptAndDecryptWithCallback(size, padding, mode, digest, done, caseId) {
var genKeyOpt = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
padding,
mode,
digest
);
huks.generateKey(aliasForRSADecrypt, genKeyOpt, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
exportWithCallback(size, padding, mode, digest, done, caseId);
});
};
@@ -249,10 +249,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_03700', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_03700'
);
@@ -265,10 +265,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_03800', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_03800'
);
@@ -283,10 +283,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_03900', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_03900'
);
@@ -299,10 +299,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_04000', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_04000'
);
@@ -315,10 +315,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_04100', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_04100'
);
@@ -331,10 +331,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_04200', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_04200'
);
@@ -347,10 +347,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_04300', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_04300'
);
@@ -363,10 +363,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_04400', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_04400'
);
@@ -379,10 +379,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_04500', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_04500'
);
@@ -395,10 +395,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_04600', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_04600'
);
@@ -411,10 +411,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_04700', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_04700'
);
@@ -427,10 +427,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_04800', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_04800'
);
@@ -443,10 +443,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_04900', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_04900'
);
@@ -459,10 +459,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_05000', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_05000'
);
@@ -475,10 +475,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_05100', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_05100'
);
@@ -491,10 +491,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_05200', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_05200'
);
@@ -507,10 +507,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_05300', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_05300'
);
@@ -523,10 +523,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_05400', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_05400'
);
@@ -539,10 +539,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_05500', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_05500'
);
@@ -555,10 +555,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_05600', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_05600'
);
@@ -571,10 +571,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_05700', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_05700'
);
@@ -587,10 +587,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_05800', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_05800'
);
@@ -603,10 +603,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_05900', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_05900'
);
@@ -619,10 +619,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_06000', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_06000'
);
@@ -635,10 +635,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_06100', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_06100'
);
@@ -651,10 +651,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_06200', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_06200'
);
@@ -667,10 +667,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_06300', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_06300'
);
@@ -683,10 +683,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_06400', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_06400'
);
@@ -699,10 +699,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_06500', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_06500'
);
@@ -715,10 +715,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_06600', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_06600'
);
@@ -731,10 +731,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_06700', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_06700'
);
@@ -747,10 +747,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_06800', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_06800'
);
@@ -763,10 +763,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_06900', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_06900'
);
@@ -779,10 +779,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_07000', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_07000'
);
@@ -795,10 +795,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_07100', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_07100'
);
@@ -811,10 +811,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_07200', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_07200'
);
@@ -827,10 +827,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_07300', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_07300'
);
@@ -843,10 +843,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_07400', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_07400'
);
@@ -859,10 +859,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_07500', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_07500'
);
@@ -875,10 +875,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_07600', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_07600'
);
@@ -891,10 +891,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_07700', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_07700'
);
@@ -907,10 +907,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_07800', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_07800'
);
@@ -923,10 +923,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_07900', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_07900'
);
@@ -939,10 +939,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_08000', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_08000'
);
@@ -955,10 +955,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_08100', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_08100'
);
@@ -971,10 +971,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_08200', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_08200'
);
@@ -987,10 +987,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_08300', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_08300'
);
@@ -1003,10 +1003,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_08400', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_08400'
);
@@ -1019,10 +1019,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_08700', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_08700'
);
@@ -1035,10 +1035,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_08800', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_08800'
);
@@ -1051,10 +1051,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_08900', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_08900'
);
@@ -1067,10 +1067,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_09000', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_09000'
);
@@ -1083,10 +1083,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_09100', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_09100'
);
@@ -1099,10 +1099,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_09200', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_09200'
);
@@ -1115,10 +1115,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_09300', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_09300'
);
@@ -1131,10 +1131,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_09400', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_09400'
);
@@ -1147,10 +1147,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_09500', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_09500'
);
@@ -1163,15 +1163,141 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_09600', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_09600'
);
});
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_09700
+ * @tc.name RSA512_RSA_ECB_OAEPWithSHA-384AndMGF1Padding_Promise
+ * @tc.desc Test for algorithm completion.
+ */
+ it('HUKS_ALG_COMPLETION_09700', 0, async function (done) {
+ var generateKeyOption = makeGenerateKeyOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
+ );
+ var generateKeyResult = await huks.generateKey('alias',generateKeyOption);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var text = makeRandomArr(256);
+ var encryptOption = makeEncryptAndDecryptOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
+ text
+ );
+ var encryptResult = await huks.encrypt('alias',encryptOption);
+ expect(encryptResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_FILE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_09800
+ * @tc.name RSA512_RSA_ECB_OAEPWithSHA-384AndMGF1Padding_AsyncCallback
+ * @tc.desc Test for algorithm completion.
+ */
+ it('HUKS_ALG_COMPLETION_09800', 0, async function (done) {
+ var generateKeyOption = makeGenerateKeyOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
+ );
+ var generateKeyResult = await huks.generateKey('alias',generateKeyOption);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var text = makeRandomArr(256);
+ var encryptOption = makeEncryptAndDecryptOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
+ text
+ );
+ huks.encrypt('alias',encryptOption,function(err,data){
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_FILE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_09900
+ * @tc.name RSA768_RSA_ECB_OAEPWithSHA-384AndMGF1Padding_Promise
+ * @tc.desc Test for algorithm completion.
+ */
+ it('HUKS_ALG_COMPLETION_09900', 0, async function (done) {
+ var generateKeyOption = makeGenerateKeyOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
+ );
+ var generateKeyResult = await huks.generateKey('alias',generateKeyOption);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var text = makeRandomArr(256);
+ var encryptOption = makeEncryptAndDecryptOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
+ text
+ );
+ var encryptResult = await huks.encrypt('alias',encryptOption);
+ expect(encryptResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_FILE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_10000
+ * @tc.name RSA768_RSA_ECB_OAEPWithSHA-384AndMGF1Padding_AsyncCallback
+ * @tc.desc Test for algorithm completion.
+ */
+ it('HUKS_ALG_COMPLETION_10000', 0, async function (done) {
+ var generateKeyOption = makeGenerateKeyOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
+ );
+ var generateKeyResult = await huks.generateKey('alias',generateKeyOption);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var text = makeRandomArr(256);
+ var encryptOption = makeEncryptAndDecryptOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
+ text
+ );
+ huks.encrypt('alias',encryptOption,function(err,data){
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_FILE);
+ done();
+ });
+ });
+
/**
* @tc.number HUKS_ALG_COMPLETION_10100
* @tc.name RSA1024_RSA_ECB_OAEPWithSHA-384AndMGF1Padding_Promise
@@ -1179,10 +1305,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_10100', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_10100'
);
@@ -1195,10 +1321,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_10200', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_10200'
);
@@ -1211,10 +1337,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_10300', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_10300'
);
@@ -1227,10 +1353,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_10400', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_10400'
);
@@ -1243,10 +1369,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_10500', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_10500'
);
@@ -1259,10 +1385,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_10600', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_10600'
);
@@ -1275,10 +1401,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_10700', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_10700'
);
@@ -1291,15 +1417,204 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_10800', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_10800'
);
});
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_10900
+ * @tc.name RSA512_RSA_ECB_OAEPWithSHA-512AndMGF1Padding_Promise
+ * @tc.desc Test for algorithm completion.
+ */
+ it('HUKS_ALG_COMPLETION_10900', 0, async function (done) {
+ var generateKeyOption = makeGenerateKeyOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
+ );
+ var generateKeyResult = await huks.generateKey('alias',generateKeyOption);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var text = makeRandomArr(256);
+ var encryptOption = makeEncryptAndDecryptOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
+ text
+ );
+ var encryptResult = await huks.encrypt('alias',encryptOption);
+ expect(encryptResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_FILE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_11000
+ * @tc.name RSA512_RSA_ECB_OAEPWithSHA-512AndMGF1Padding_AsyncCallback
+ * @tc.desc Test for algorithm completion.
+ */
+ it('HUKS_ALG_COMPLETION_11000', 0, async function (done) {
+ var generateKeyOption = makeGenerateKeyOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
+ );
+ var generateKeyResult = await huks.generateKey('alias',generateKeyOption);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var text = makeRandomArr(256);
+ var encryptOption = makeEncryptAndDecryptOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
+ text
+ );
+ huks.encrypt('alias',encryptOption,function(err,data){
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_FILE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_11100
+ * @tc.name RSA768_RSA_ECB_OAEPWithSHA-512AndMGF1Padding_Promise
+ * @tc.desc Test for algorithm completion.
+ */
+ it('HUKS_ALG_COMPLETION_11100', 0, async function (done) {
+ var generateKeyOption = makeGenerateKeyOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
+ );
+ var generateKeyResult = await huks.generateKey('alias',generateKeyOption);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var text = makeRandomArr(256);
+ var encryptOption = makeEncryptAndDecryptOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
+ text
+ );
+ var encryptResult = await huks.encrypt('alias',encryptOption);
+ expect(encryptResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_FILE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_11200
+ * @tc.name RSA768_RSA_ECB_OAEPWithSHA-384AndMGF1Padding_AsyncCallback
+ * @tc.desc Test for algorithm completion.
+ */
+ it('HUKS_ALG_COMPLETION_11200', 0, async function (done) {
+ var generateKeyOption = makeGenerateKeyOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
+ );
+ var generateKeyResult = await huks.generateKey('alias',generateKeyOption);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var text = makeRandomArr(256);
+ var encryptOption = makeEncryptAndDecryptOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
+ text
+ );
+ huks.encrypt('alias',encryptOption,function(err,data){
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_FILE);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_11300
+ * @tc.name RSA1024_RSA_ECB_OAEPWithSHA-512AndMGF1Padding_Promise
+ * @tc.desc Test for algorithm completion.
+ */
+ it('HUKS_ALG_COMPLETION_11300', 0, async function (done) {
+ var generateKeyOption = makeGenerateKeyOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
+ );
+ var generateKeyResult = await huks.generateKey('alias',generateKeyOption);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var text = makeRandomArr(256);
+ var encryptOption = makeEncryptAndDecryptOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
+ text
+ );
+ var encryptResult = await huks.encrypt('alias',encryptOption);
+ expect(encryptResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_FILE);
+ done();
+ });
+
+ /**
+ * @tc.number HUKS_ALG_COMPLETION_11400
+ * @tc.name RSA1024_RSA_ECB_OAEPWithSHA-512AndMGF1Padding_AsyncCallback
+ * @tc.desc Test for algorithm completion.
+ */
+ it('HUKS_ALG_COMPLETION_11400', 0, async function (done) {
+ var generateKeyOption = makeGenerateKeyOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
+ );
+ var generateKeyResult = await huks.generateKey('alias',generateKeyOption);
+ expect(generateKeyResult.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
+ var text = makeRandomArr(256);
+ var encryptOption = makeEncryptAndDecryptOption(
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
+ text
+ );
+ huks.encrypt('alias',encryptOption,function(err,data){
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_KEY_FILE);
+ done();
+ });
+ });
+
/**
* @tc.number HUKS_ALG_COMPLETION_11500
* @tc.name RSA2048_RSA_ECB_OAEPWithSHA-512AndMGF1Padding_Promise
@@ -1307,10 +1622,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_11500', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_11500'
);
@@ -1323,10 +1638,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_11600', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_11600'
);
@@ -1339,10 +1654,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_11700', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_11700'
);
@@ -1355,10 +1670,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_11800', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_11800'
);
@@ -1371,10 +1686,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_11900', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_11900'
);
@@ -1387,10 +1702,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_12000', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_12000'
);
@@ -1403,10 +1718,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_12100', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_12100'
);
@@ -1419,10 +1734,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_12200', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_12200'
);
@@ -1435,10 +1750,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_12300', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_12300'
);
@@ -1451,10 +1766,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_12400', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_12400'
);
@@ -1467,10 +1782,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_12500', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_12500'
);
@@ -1483,10 +1798,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_12600', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_12600'
);
@@ -1499,10 +1814,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_12700', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_12700'
);
@@ -1515,10 +1830,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_12800', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_12800'
);
@@ -1531,10 +1846,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_12900', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_12900'
);
@@ -1547,10 +1862,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_13000', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_13000'
);
@@ -1563,10 +1878,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_13100', 0, async function (done) {
encryptAndDecryptWithPromise(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_13100'
);
@@ -1579,10 +1894,10 @@ describe('Hks_XtsTest_ALGCOMPLETION_RSA_ENCRYPT_DECRYPT', function () {
*/
it('HUKS_ALG_COMPLETION_13200', 0, async function (done) {
encryptAndDecryptWithCallback(
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_OAEP,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_OAEP,
+ huks.HuksCipherMode.HUKS_MODE_ECB,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_13200'
);
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_mac.test.js b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_mac.test.js
index 55b5f9cc399433f8e60bf536cc72e641cbdc8088..d21bb7aced252deee38996e6044b255a82389715 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_mac.test.js
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_mac.test.js
@@ -34,7 +34,7 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
*/
it('HUKS_ALG_COMPLETION_39900', 0, async function (done) {
macPromise(
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
160,
done,
'HUKS_ALG_COMPLETION_39900'
@@ -48,7 +48,7 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
*/
it('HUKS_ALG_COMPLETION_40000', 0, async function (done) {
macPromise(
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
224,
done,
'HUKS_ALG_COMPLETION_40000'
@@ -62,7 +62,7 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
*/
it('HUKS_ALG_COMPLETION_40100', 0, async function (done) {
macPromise(
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
256,
done,
'HUKS_ALG_COMPLETION_40100'
@@ -76,7 +76,7 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
*/
it('HUKS_ALG_COMPLETION_40200', 0, async function (done) {
macPromise(
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
384,
done,
'HUKS_ALG_COMPLETION_40200'
@@ -90,7 +90,7 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
*/
it('HUKS_ALG_COMPLETION_40300', 0, async function (done) {
macPromise(
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
512,
done,
'HUKS_ALG_COMPLETION_40300'
@@ -107,7 +107,7 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
function deleteKey(done, caseId){
huks.deleteKey(defaultAlias, emptyOption, function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
isKeyExist(done, caseId);
});
};
@@ -115,17 +115,17 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
function doMac(digest, size, done, caseId){
var macOption = makeMacOption(size, digest);
huks.mac(defaultAlias, macOption,function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
deleteKey(done,caseId);
});
};
function macCallback(digest, size, done, caseId) {
var generateKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_HMAC, size, huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC, null, null, digest
+ huks.HuksKeyAlg.HUKS_ALG_HMAC, size, huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC, null, null, digest
);
huks.generateKey(defaultAlias, generateKeyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
doMac(digest, size, done, caseId);
});
};
@@ -137,7 +137,7 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
*/
it('HUKS_ALG_COMPLETION_40400', 0, async function (done) {
macCallback(
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
160,
done,
'HUKS_ALG_COMPLETION_40400'
@@ -153,7 +153,7 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
*/
it('HUKS_ALG_COMPLETION_40500', 0, async function (done) {
macCallback(
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
224,
done,
'HUKS_ALG_COMPLETION_40500'
@@ -169,7 +169,7 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
*/
it('HUKS_ALG_COMPLETION_40600', 0, async function (done) {
macCallback(
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
256,
done,
'HUKS_ALG_COMPLETION_40600'
@@ -185,7 +185,7 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
*/
it('HUKS_ALG_COMPLETION_40700', 0, async function (done) {
macCallback(
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
384,
done,
'HUKS_ALG_COMPLETION_40700'
@@ -201,7 +201,7 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
*/
it('HUKS_ALG_COMPLETION_40800', 0, async function (done) {
macCallback(
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
512,
done,
'HUKS_ALG_COMPLETION_40800'
@@ -213,15 +213,15 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
function makeMacOption(size, digest) {
var properties = new Array();
properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_HMAC
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_HMAC
};
properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC
};
properties[2] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
+ tag: huks.HuksTag.HUKS_TAG_DIGEST,
value: digest
};
var options = {
@@ -233,17 +233,17 @@ describe('Hks_XtsTest_AlgCompletion_Mac', function () {
async function macPromise(digest, size, done, caseId) {
var generateKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_HMAC, size, huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC, null, null, digest
+ huks.HuksKeyAlg.HUKS_ALG_HMAC, size, huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC, null, null, digest
);
var generateKeyRet = await huks.generateKey(defaultAlias, generateKeyOption);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(generateKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var macOption = makeMacOption(size, digest);
var macRet = await huks.mac(defaultAlias, macOption);
- expect(macRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(macRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var deleteKeyRet = await huks.deleteKey(defaultAlias, emptyOption);
- expect(deleteKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(deleteKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var isKeyExist = await huks.isKeyExist(defaultAlias, emptyOption);
expect(isKeyExist).assertEqual(false);
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_signAndVerify_callback.test.js b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_signAndVerify_callback.test.js
index 181b5fd34f8c8fba4ff9fbb45871b943a9f6a020..f076c880f8207dceb2aba2bc1428bca2762d1fc5 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_signAndVerify_callback.test.js
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_signAndVerify_callback.test.js
@@ -39,10 +39,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_17500', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_17500'
);
@@ -57,10 +57,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_17600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_17600'
);
@@ -75,10 +75,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_17700', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_17700'
);
@@ -93,10 +93,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_17800', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_17800'
);
@@ -111,10 +111,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_17900', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_17900'
);
@@ -129,10 +129,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_18000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_18000'
);
@@ -147,10 +147,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_18100', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_18100'
);
@@ -165,10 +165,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_18200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_18200'
);
@@ -183,10 +183,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_18300', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_18300'
);
@@ -201,10 +201,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_18400', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_18400'
);
@@ -219,10 +219,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_18500', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_18500'
);
@@ -237,10 +237,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_18600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_18600'
);
@@ -255,10 +255,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_18700', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_18700'
);
@@ -273,10 +273,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_18800', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_18800'
);
@@ -291,10 +291,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_18900', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_18900'
);
@@ -309,10 +309,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_19000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_19000'
);
@@ -327,10 +327,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_19100', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_19100'
);
@@ -345,10 +345,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_19200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_19200'
);
@@ -363,10 +363,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_19300', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_19300'
);
@@ -381,10 +381,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_19400', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_19400'
);
@@ -399,10 +399,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_19500', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_19500'
);
@@ -417,10 +417,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_19600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_19600'
);
@@ -435,10 +435,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_19700', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_19700'
);
@@ -453,10 +453,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_19800', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_19800'
);
@@ -471,10 +471,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_19900', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_19900'
);
@@ -489,10 +489,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_20000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_20000'
);
@@ -507,10 +507,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_20100', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_20100'
);
@@ -525,10 +525,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_20200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_20200'
);
@@ -543,10 +543,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_20300', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_20300'
);
@@ -561,10 +561,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_20400', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_20400'
);
@@ -580,26 +580,26 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
it('HUKS_ALG_COMPLETION_20500', 0, async function (done) {
var plainText = makeRandomArr(16);
var generateKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
null,
- huks.HksKeyDigest.HKS_DIGEST_SHA384
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384
);
var generateKeyRet = await huks.generateKey(aliasA, generateKeyOption);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(generateKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var signOption = makeSignAndVerifyOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
plainText
);
huks.sign(aliasA, signOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
console.log('HUKS_ALG_COMPLETION_20500 end');
done();
});
@@ -614,10 +614,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_20600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_20600'
);
@@ -632,10 +632,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_20700', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_20700'
);
@@ -650,10 +650,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_20800', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_20800'
);
@@ -668,10 +668,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_20900', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_20900'
);
@@ -686,10 +686,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_21000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_21000'
);
@@ -705,26 +705,26 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
it('HUKS_ALG_COMPLETION_21100', 0, async function (done) {
var plainText = makeRandomArr(16);
var generateKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
null,
- huks.HksKeyDigest.HKS_DIGEST_SHA512
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512
);
var generateKeyRet = await huks.generateKey(aliasA, generateKeyOption);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(generateKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var signOption = makeSignAndVerifyOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
plainText
);
huks.sign(aliasA, signOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
console.log('HUKS_ALG_COMPLETION_21100 end');
done();
});
@@ -739,10 +739,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_21200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_21200'
);
@@ -757,10 +757,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_21300', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_21300'
);
@@ -775,10 +775,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_21400', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_21400'
);
@@ -793,10 +793,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_21500', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_21500'
);
@@ -811,10 +811,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_21600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_21600'
);
@@ -831,10 +831,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_25900', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_25900'
);
@@ -849,10 +849,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_26000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_26000'
);
@@ -867,10 +867,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_26100', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_26100'
);
@@ -885,10 +885,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_26200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_26200'
);
@@ -903,10 +903,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_26300', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_26300'
);
@@ -921,10 +921,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_26400', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_26400'
);
@@ -939,10 +939,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_26500', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_26500'
);
@@ -957,10 +957,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_26600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_26600'
);
@@ -975,10 +975,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_26700', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_26700'
);
@@ -993,10 +993,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_26800', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_26800'
);
@@ -1011,10 +1011,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_26900', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_26900'
);
@@ -1029,10 +1029,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_27000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_27000'
);
@@ -1047,10 +1047,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_27100', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_27100'
);
@@ -1065,10 +1065,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_27200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_27200'
);
@@ -1083,10 +1083,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_27300', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_27300'
);
@@ -1101,10 +1101,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_27400', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_27400'
);
@@ -1119,10 +1119,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_27500', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_27500'
);
@@ -1137,10 +1137,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_27600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_27600'
);
@@ -1155,10 +1155,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_27700', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_27700'
);
@@ -1173,10 +1173,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_27800', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_27800'
);
@@ -1191,10 +1191,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_27900', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_27900'
);
@@ -1209,10 +1209,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_28000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_28000'
);
@@ -1227,10 +1227,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_28100', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_28100'
);
@@ -1245,10 +1245,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_28200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_28200'
);
@@ -1263,10 +1263,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_28300', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_28300'
);
@@ -1281,10 +1281,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_28400', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_28400'
);
@@ -1299,10 +1299,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_28500', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_28500'
);
@@ -1317,10 +1317,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_28600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_28600'
);
@@ -1335,10 +1335,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_28700', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_28700'
);
@@ -1353,10 +1353,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_28800', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_28800'
);
@@ -1371,10 +1371,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_28900', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_28900'
);
@@ -1389,10 +1389,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_29000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_29000'
);
@@ -1407,10 +1407,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_29100', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_29100'
);
@@ -1425,10 +1425,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_29200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_29200'
);
@@ -1443,10 +1443,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_29300', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_29300'
);
@@ -1461,10 +1461,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_29400', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_29400'
);
@@ -1480,26 +1480,26 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
it('HUKS_ALG_COMPLETION_29500', 0, async function (done) {
var plainText = makeRandomArr(16);
var generateKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_PSS,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
null,
- huks.HksKeyDigest.HKS_DIGEST_SHA512
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512
);
var generateKeyRet = await huks.generateKey(aliasA, generateKeyOption);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(generateKeyRet.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
var signOption = makeSignAndVerifyOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
plainText
);
huks.sign(aliasA, signOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
console.log('HUKS_ALG_COMPLETION_29500 end');
done();
});
@@ -1514,10 +1514,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_29600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_29600'
);
@@ -1532,10 +1532,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_29700', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_29700'
);
@@ -1550,10 +1550,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_29800', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_29800'
);
@@ -1568,10 +1568,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_29900', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_29900'
);
@@ -1586,10 +1586,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_30000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_30000'
);
@@ -1606,15 +1606,15 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_30800', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_MD5
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5
);
huks.generateKey(aliasA, generateKeyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log('HUKS_ALG_COMPLETION_30800 end');
done();
});
@@ -1629,15 +1629,15 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_30900', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
huks.generateKey(aliasA, generateKeyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log('HUKS_ALG_COMPLETION_30900 end');
done();
});
@@ -1652,10 +1652,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_31000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_31000'
);
@@ -1670,10 +1670,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_31100', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_31100'
);
@@ -1688,10 +1688,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_31200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_31200'
);
@@ -1706,10 +1706,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_31300', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_31300'
);
@@ -1724,10 +1724,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_31400', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_31400'
);
@@ -1744,15 +1744,15 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_32200', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_MD5
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5
);
huks.generateKey(aliasA, generateKeyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log('HUKS_ALG_COMPLETION_32200 end');
done();
});
@@ -1767,10 +1767,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_32300', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_32300'
);
@@ -1785,10 +1785,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_32400', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_32400'
);
@@ -1803,10 +1803,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_32500', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_32500'
);
@@ -1821,10 +1821,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_32600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_32600'
);
@@ -1839,10 +1839,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_32700', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_32700'
);
@@ -1857,10 +1857,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_32800', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_32800'
);
@@ -1877,15 +1877,15 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_33600', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_MD5
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5
);
huks.generateKey(aliasA, generateKeyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log('HUKS_ALG_COMPLETION_33600 end');
done();
});
@@ -1900,10 +1900,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_33700', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_33700'
);
@@ -1918,10 +1918,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_33800', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_33800'
);
@@ -1936,10 +1936,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_33900', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_33900'
);
@@ -1954,10 +1954,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_34000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_34000'
);
@@ -1972,10 +1972,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_34100', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_34100'
);
@@ -1990,10 +1990,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_34200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_34200'
);
@@ -2008,15 +2008,15 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_35000', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_MD5
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5
);
huks.generateKey(aliasA, generateKeyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log('HUKS_ALG_COMPLETION_35000 end');
done();
});
@@ -2031,10 +2031,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_35100', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_35100'
);
@@ -2049,10 +2049,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_35200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_35200'
);
@@ -2067,10 +2067,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_35300', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_35300'
);
@@ -2085,10 +2085,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_35400', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_35400'
);
@@ -2103,10 +2103,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_35500', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_35500'
);
@@ -2121,10 +2121,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_35600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_35600'
);
@@ -2139,15 +2139,15 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_36400', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_MD5
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5
);
huks.generateKey(aliasA, generateKeyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log('HUKS_ALG_COMPLETION_36400 end');
done();
});
@@ -2162,10 +2162,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_36500', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_36500'
);
@@ -2180,10 +2180,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_36600', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_36600'
);
@@ -2198,10 +2198,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_36700', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_36700'
);
@@ -2216,10 +2216,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_36800', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_36800'
);
@@ -2234,10 +2234,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_36900', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_36900'
);
@@ -2252,10 +2252,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_37000', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_37000'
);
@@ -2270,10 +2270,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
*/
it('HUKS_ALG_COMPLETION_37200', 0, async function (done) {
signAndVerifyCallback(
- huks.HksKeyAlg.HKS_ALG_ED25519,
- huks.HksKeySize.HKS_CURVE25519_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ED25519,
+ huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_37200'
);
@@ -2298,14 +2298,14 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
function deleteAliasB(done, caseId) {
huks.deleteKey(aliasB, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
isAliasAExist(done, caseId);
})
};
function deleteAliasA(done, caseId) {
huks.deleteKey(aliasA, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
deleteAliasB(done, caseId);
})
};
@@ -2314,13 +2314,13 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
var verifyOptions = makeSignAndVerifyOption(
alg,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
padding,
digest,
plainText
);
huks.verify(aliasB, verifyOptions, signedText, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
deleteAliasA(done, caseId);
});
};
@@ -2329,21 +2329,21 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
var importOption = makeImportOption(
alg,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
padding,
null,
digest,
publicKey
);
huks.importKey(aliasB, importOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
verifyWithCallback(alg, size, padding, digest, plainText, done, caseId);
});
};
function exportWithCallback(alg, size, padding, digest, plainText, done, caseId) {
huks.exportKey(aliasA, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
publicKey = data.outData;
importWithCallback(alg, size, padding, digest, plainText, done, caseId);
});
@@ -2354,7 +2354,7 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
var signOption = makeSignAndVerifyOption(
alg,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
padding,
digest,
plainText
@@ -2364,10 +2364,10 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
caseId == 'HUKS_ALG_COMPLETION_28900' ||
caseId == 'HUKS_ALG_COMPLETION_29500' ||
caseId == 'HUKS_ALG_COMPLETION_29600')) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
done();
} else {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
signedText = data.outData;
console.log('signedText ' + JSON.stringify(signedText));
exportWithCallback(alg, size, padding, digest, plainText, done, caseId);
@@ -2379,18 +2379,18 @@ describe('Hks_XtsTest_AlgCompletion_Sign_Verify', function () {
var generateKeyOption = makeGenerateKeyOption(
alg,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
padding,
null,
digest
);
huks.generateKey(aliasA, generateKeyOption, function (err, data) {
- if (useLib == 'mbedtls' && alg == huks.HksKeyAlg.HKS_ALG_DSA) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ if (useLib == 'mbedtls' && alg == huks.HuksKeyAlg.HUKS_ALG_DSA) {
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
console.log(caseId + ' end');
done();
} else {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
+ expect(data.errorCode).assertEqual(huks.HuksErrorCode.HUKS_SUCCESS);
signWithCallback(alg, size, padding, digest, done, caseId);
}
});
diff --git a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_signAndVerify_promise.test.js b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_signAndVerify_promise.test.js
index 15ca9a8cec29287ed07bc9b6300663890c75b708..9825112ebf12f5687a451264224941084418eea5 100644
--- a/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_signAndVerify_promise.test.js
+++ b/security/huks_standard/HuksAlgCompletionTest/entry/src/main/js/test/hks_xtsTest_algCompletion_signAndVerify_promise.test.js
@@ -35,7 +35,7 @@ function makeSignGenerateKeyOption (alg, size, padding, digest) {
var option = makeGenerateKeyOption (
alg,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
padding,
null,
digest
@@ -47,7 +47,7 @@ function makeSignOption (alg, size, padding, digest) {
var option = makeSignAndVerifyOption (
alg,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
padding,
digest,
plainText,
@@ -59,7 +59,7 @@ function makeVerifyOption (alg, size, padding, digest) {
var option = makeSignAndVerifyOption (
alg,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
padding,
digest,
plainText,
@@ -71,7 +71,7 @@ function makeImportKeyOption (alg, size, padding, digest) {
var option = makeImportOption (
alg,
size,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
padding,
null,
digest,
@@ -89,10 +89,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_13300', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_13300'
);
@@ -107,10 +107,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_13400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_13400'
);
@@ -125,10 +125,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_13500', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_13500'
);
@@ -143,10 +143,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_13600', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_13600'
);
@@ -161,10 +161,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_13700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_13700'
);
@@ -179,10 +179,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_13800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_13800'
);
@@ -197,10 +197,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_13900', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_13900'
);
@@ -215,10 +215,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_14000', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_14000'
);
@@ -233,10 +233,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_14100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_14100'
);
@@ -251,10 +251,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_14200', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_14200'
);
@@ -269,10 +269,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_14300', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_14300'
);
@@ -287,10 +287,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_14400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_14400'
);
@@ -305,10 +305,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_14500', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_14500'
);
@@ -323,10 +323,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_14600', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_14600'
);
@@ -341,10 +341,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_14700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_14700'
);
@@ -359,10 +359,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_14800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_14800'
);
@@ -377,10 +377,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_14900', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_14900'
);
@@ -395,10 +395,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_15000', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_15000'
);
@@ -413,10 +413,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_15100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_15100'
);
@@ -431,10 +431,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_15200', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_15200'
);
@@ -449,10 +449,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_15300', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_15300'
);
@@ -467,10 +467,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_15400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_15400'
);
@@ -485,10 +485,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_15500', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_15500'
);
@@ -503,10 +503,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_15600', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_15600'
);
@@ -521,10 +521,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_15700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_15700'
);
@@ -539,10 +539,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_15800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_15800'
);
@@ -557,10 +557,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_15900', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_15900'
);
@@ -575,10 +575,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_16000', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_16000'
);
@@ -593,10 +593,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_16100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_16100'
);
@@ -611,10 +611,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_16200', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_16200'
);
@@ -629,26 +629,26 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_16300', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
null,
- huks.HksKeyDigest.HKS_DIGEST_SHA384
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384
);
var generateKeyRet = await huks.generateKey (aliasA, generateKeyOption);
- expect (generateKeyRet.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (generateKeyRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var signOption = makeSignAndVerifyOption (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
plainText
);
var signRet = await huks.sign (aliasA, signOption);
- expect (signRet.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect (signRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
console.log ('HUKS_ALG_COMPLETION_16300 end');
done ();
setTimeout (function () {
@@ -662,10 +662,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_16400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_16400'
);
@@ -680,10 +680,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_16500', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_16500'
);
@@ -698,10 +698,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_16600', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_16600'
);
@@ -716,10 +716,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_16700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_16700'
);
@@ -734,10 +734,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_16800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_16800'
);
@@ -752,26 +752,26 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_16900', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
null,
- huks.HksKeyDigest.HKS_DIGEST_SHA512
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512
);
var generateKeyRet = await huks.generateKey (aliasA, generateKeyOption);
- expect (generateKeyRet.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (generateKeyRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var signOption = makeSignAndVerifyOption (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
plainText
);
var signRet = await huks.sign (aliasA, signOption);
- expect (signRet.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect (signRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
console.log ('HUKS_ALG_COMPLETION_16900 end');
done ();
setTimeout (function () {
@@ -785,10 +785,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_17000', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_17000'
);
@@ -803,10 +803,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_17100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_17100'
);
@@ -821,10 +821,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_17200', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_17200'
);
@@ -839,10 +839,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_17300', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_17300'
);
@@ -857,10 +857,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_17400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_17400'
);
@@ -876,10 +876,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_21700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_21700'
);
@@ -894,10 +894,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_21800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_21800'
);
@@ -912,10 +912,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_21900', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_21900'
);
@@ -930,10 +930,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_22000', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_22000'
);
@@ -948,10 +948,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_22100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_22100'
);
@@ -966,10 +966,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_22200', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_MD5,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5,
done,
'HUKS_ALG_COMPLETION_22200'
);
@@ -984,10 +984,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_22300', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_22300'
);
@@ -1002,10 +1002,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_22400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_22400'
);
@@ -1020,10 +1020,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_22500', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_22500'
);
@@ -1038,10 +1038,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_22600', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_22600'
);
@@ -1056,10 +1056,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_22700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_22700'
);
@@ -1074,10 +1074,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_22800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_22800'
);
@@ -1092,10 +1092,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_22900', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_22900'
);
@@ -1110,10 +1110,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_23000', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_23000'
);
@@ -1128,10 +1128,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_23100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_23100'
);
@@ -1146,10 +1146,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_23200', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_23200'
);
@@ -1164,10 +1164,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_23300', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_23300'
);
@@ -1182,10 +1182,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_23400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_23400'
);
@@ -1200,10 +1200,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_23500', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_23500'
);
@@ -1218,10 +1218,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_23600', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_23600'
);
@@ -1236,10 +1236,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_23700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_23700'
);
@@ -1254,10 +1254,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_23800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_23800'
);
@@ -1272,10 +1272,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_23900', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_23900'
);
@@ -1290,10 +1290,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_24000', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_24000'
);
@@ -1308,10 +1308,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_24100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_24100'
);
@@ -1326,10 +1326,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_24200', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_24200'
);
@@ -1344,10 +1344,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_24300', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_24300'
);
@@ -1362,10 +1362,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_24400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_24400'
);
@@ -1380,10 +1380,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_24500', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_24500'
);
@@ -1398,10 +1398,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_24600', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_24600'
);
@@ -1416,10 +1416,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_24700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_24700'
);
@@ -1434,10 +1434,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_24800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_24800'
);
@@ -1452,10 +1452,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_24900', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_24900'
);
@@ -1470,10 +1470,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_25000', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_25000'
);
@@ -1488,10 +1488,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_25100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_25100'
);
@@ -1506,10 +1506,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_25200', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_25200'
);
@@ -1525,26 +1525,26 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
it ('HUKS_ALG_COMPLETION_25300', 0, async function (done) {
var plainText = makeRandomArr (16);
var generateKeyOption = makeGenerateKeyOption (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_PSS,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
null,
- huks.HksKeyDigest.HKS_DIGEST_SHA512
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512
);
var generateKeyRet = await huks.generateKey (aliasA, generateKeyOption);
- expect (generateKeyRet.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (generateKeyRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var signOption = makeSignAndVerifyOption (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_512,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
plainText
);
var signRet = await huks.sign (aliasA, signOption);
- expect (signRet.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect (signRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
console.log ('HUKS_ALG_COMPLETION_25300 end');
done ();
setTimeout (function () {
@@ -1558,10 +1558,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_25400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_768,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_768,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_25400'
);
@@ -1576,10 +1576,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_25500', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_1024,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_25500'
);
@@ -1594,10 +1594,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_25600', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_2048,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_25600'
);
@@ -1612,10 +1612,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_25700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_3072,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_25700'
);
@@ -1630,10 +1630,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_25800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_4096,
- huks.HksKeyPadding.HKS_PADDING_PSS,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_RSA,
+ huks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096,
+ huks.HuksKeyPadding.HUKS_PADDING_PSS,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_25800'
);
@@ -1648,15 +1648,15 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_30100', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption (
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_MD5
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5
);
var generateKeyRet = await huks.generateKey (aliasA, generateKeyOption);
- expect (generateKeyRet.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect (generateKeyRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log ('HUKS_ALG_COMPLETION_30100 end');
done ();
setTimeout (function () {
@@ -1670,15 +1670,15 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_30200', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption (
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE
);
var generateKeyRet = await huks.generateKey (aliasA, generateKeyOption);
- expect (generateKeyRet.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect (generateKeyRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log ('HUKS_ALG_COMPLETION_30200 end');
done ();
setTimeout (function () {
@@ -1692,10 +1692,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_30300', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_30300'
);
@@ -1710,10 +1710,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_30400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_30400'
);
@@ -1728,10 +1728,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_30500', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_30500'
);
@@ -1746,10 +1746,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_30600', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_30600'
);
@@ -1764,10 +1764,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_30700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_DSA,
+ huks.HuksKeyAlg.HUKS_ALG_DSA,
1024,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_30700'
);
@@ -1782,15 +1782,15 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_31500', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_MD5
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5
);
var genKeyRet = await huks.generateKey (aliasA, generateKeyOption);
- expect (genKeyRet.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect (genKeyRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log ('HUKS_ALG_COMPLETION_31500 end');
done ();
setTimeout (function () {
@@ -1804,10 +1804,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_31600', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_31600'
);
@@ -1822,10 +1822,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_31700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_31700'
);
@@ -1840,10 +1840,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_31800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_31800'
);
@@ -1858,10 +1858,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_31900', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_31900'
);
@@ -1876,10 +1876,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_32000', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_32000'
);
@@ -1894,10 +1894,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_32100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_224,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_32100'
);
@@ -1912,15 +1912,15 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_32900', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_MD5
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5
);
var genKeyRet = await huks.generateKey (aliasA, generateKeyOption);
- expect (genKeyRet.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect (genKeyRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log ('HUKS_ALG_COMPLETION_32900 end');
done ();
setTimeout (function () {
@@ -1934,10 +1934,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_33000', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_33000'
);
@@ -1952,10 +1952,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_33100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_33100'
);
@@ -1970,10 +1970,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_33200', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_33200'
);
@@ -1988,10 +1988,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_33300', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_33300'
);
@@ -2006,10 +2006,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_33400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_33400'
);
@@ -2024,10 +2024,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_33500', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_33500'
);
@@ -2042,15 +2042,15 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_34300', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_MD5
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5
);
var genKeyRet = await huks.generateKey (aliasA, generateKeyOption);
- expect (genKeyRet.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect (genKeyRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log ('HUKS_ALG_COMPLETION_34300 end');
done ();
setTimeout (function () {
@@ -2064,10 +2064,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_34400', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_34400'
);
@@ -2082,10 +2082,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_34500', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_34500'
);
@@ -2100,10 +2100,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_34600', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_34600'
);
@@ -2118,10 +2118,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_34700', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_34700'
);
@@ -2136,10 +2136,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_34800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_34800'
);
@@ -2154,10 +2154,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_34900', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_384,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_384,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_34900'
);
@@ -2172,15 +2172,15 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_35700', 0, async function (done) {
var generateKeyOption = makeGenerateKeyOption (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
null,
- huks.HksKeyDigest.HKS_DIGEST_MD5
+ huks.HuksKeyDigest.HUKS_DIGEST_MD5
);
var genKeyRet = await huks.generateKey (aliasA, generateKeyOption);
- expect (genKeyRet.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_INVALID_DIGEST);
+ expect (genKeyRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_INVALID_DIGEST);
console.log ('HUKS_ALG_COMPLETION_35700 end');
done ();
setTimeout (function () {
@@ -2194,10 +2194,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_35800', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_35800'
);
@@ -2212,10 +2212,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_35900', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA1,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA1,
done,
'HUKS_ALG_COMPLETION_35900'
);
@@ -2230,10 +2230,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_36000', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA224,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA224,
done,
'HUKS_ALG_COMPLETION_36000'
);
@@ -2248,10 +2248,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_36100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA256,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
done,
'HUKS_ALG_COMPLETION_36100'
);
@@ -2266,10 +2266,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_36200', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA384,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA384,
done,
'HUKS_ALG_COMPLETION_36200'
);
@@ -2284,10 +2284,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_36300', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_521,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_SHA512,
+ huks.HuksKeyAlg.HUKS_ALG_ECC,
+ huks.HuksKeySize.HUKS_ECC_KEY_SIZE_521,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_SHA512,
done,
'HUKS_ALG_COMPLETION_36300'
);
@@ -2302,10 +2302,10 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
*/
it ('HUKS_ALG_COMPLETION_37100', 0, async function (done) {
signAndVerifyPromise (
- huks.HksKeyAlg.HKS_ALG_ED25519,
- huks.HksKeySize.HKS_CURVE25519_KEY_SIZE_256,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
+ huks.HuksKeyAlg.HUKS_ALG_ED25519,
+ huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256,
+ huks.HuksKeyPadding.HUKS_PADDING_NONE,
+ huks.HuksKeyDigest.HUKS_DIGEST_NONE,
done,
'HUKS_ALG_COMPLETION_37100'
);
@@ -2316,33 +2316,33 @@ describe ('Hks_XtsTest_AlgCompletion_Rsa_Sign_Verify_Promise', function () {
async function signAndVerifyPromise (alg, size, padding, digest, done, caseId) {
var generateKeyOption = makeSignGenerateKeyOption (alg, size, padding, digest);
var generateKeyResult = await huks.generateKey (aliasA, generateKeyOption);
- if (useLib == 'mbedtls' && alg == huks.HksKeyAlg.HKS_ALG_DSA) {
- expect (generateKeyResult.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_NOT_SUPPORTED);
+ if (useLib == 'mbedtls' && alg == huks.HuksKeyAlg.HUKS_ALG_DSA) {
+ expect (generateKeyResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_NOT_SUPPORTED);
} else {
- expect (generateKeyResult.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (generateKeyResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var signOption = makeSignOption (alg, size, padding, digest);
var signResult = await huks.sign (aliasA, signOption);
if (useLib == 'mbedtls' && (
caseId == 'HUKS_ALG_COMPLETION_24700' ||
caseId == 'HUKS_ALG_COMPLETION_25300' ||
caseId == 'HUKS_ALG_COMPLETION_25400')) {
- expect (signResult.errorCode).assertEqual (huks.HksErrorCode.HKS_ERROR_CRYPTO_ENGINE_ERROR);
+ expect (signResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_ERROR_CRYPTO_ENGINE_ERROR);
} else {
- expect (signResult.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (signResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
signedText = signResult.outData;
var exportKeyRet = await huks.exportKey (aliasA, emptyOption);
- expect (exportKeyRet.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (exportKeyRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
publicKey = exportKeyRet.outData;
var importOption = makeImportKeyOption (alg, size, padding, digest);
var importKeyResult = await huks.importKey (aliasB, importOption);
- expect (importKeyResult.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (importKeyResult.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var verifyOption = makeVerifyOption (alg, size, padding, digest);
var verifyRet = await huks.verify (aliasB, verifyOption, signedText);
- expect (verifyRet.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (verifyRet.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var deleteKeyAliasA = await huks.deleteKey (aliasA, emptyOption);
var deleteKeyAliasB = await huks.deleteKey (aliasB, emptyOption);
- expect (deleteKeyAliasA.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
- expect (deleteKeyAliasB.errorCode).assertEqual (huks.HksErrorCode.HKS_SUCCESS);
+ expect (deleteKeyAliasA.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
+ expect (deleteKeyAliasB.errorCode).assertEqual (huks.HuksErrorCode.HUKS_SUCCESS);
var isKeyAExist = await huks.isKeyExist (aliasA, emptyOption);
expect (isKeyAExist).assertEqual (false);
var isKeyBExist = await huks.isKeyExist (aliasB, emptyOption);
diff --git a/security/huks_standard/HuksConcurrencyApp1/BUILD.gn b/security/huks_standard/HuksConcurrencyApp1/BUILD.gn
deleted file mode 100644
index 45321161dbe31f4529adb936d85b06262cba5209..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/BUILD.gn
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//test/xts/tools/build/suite.gni")
-
-ohos_js_hap_suite("ActsHuksConcurrencyApp1Test") {
- hap_profile = "./entry/src/main/config.json"
- deps = [
- ":hjs_demo_js_assets",
- ":hjs_demo_resources",
- ]
- certificate_profile = "./signature/openharmony_sx.p7b"
- hap_name = "ActsHuksConcurrencyApp1Test"
-}
-ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
-}
-ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
-}
diff --git a/security/huks_standard/HuksConcurrencyApp1/Test.json b/security/huks_standard/HuksConcurrencyApp1/Test.json
deleted file mode 100644
index 29bd1ed6bb0e7b96c75e14435ae7071c6c1ab8d2..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/Test.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "description": "Configuration for concurrency test",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "300000",
- "package": "com.example.concurrencyapp1",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsHuksConcurrencyApp1Test.hap",
- "ActsHuksConcurrencyApp2Test.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
diff --git a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/config.json b/security/huks_standard/HuksConcurrencyApp1/entry/src/main/config.json
deleted file mode 100644
index 3c0eb2f38c90526bbec560d8483d4f72f9f05a58..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/config.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "app": {
- "bundleName": "com.example.concurrencyapp1",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Beta1"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.concurrencyapp1",
- "name": ".MyApplication",
- "mainAbility": "com.example.concurrencyapp1.MainAbility",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": true
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.concurrencyapp1.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:entry_MainAbility",
- "type": "page",
- "launchType": "singleton",
- "visible": true,
- "isVisible": "true"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": true
- }
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/app.js b/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/app.js
deleted file mode 100644
index 14ca792625c50b934e7bda87ac333d3414dc12bd..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/app.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export default {
- onCreate() {
- console.info('AceApplication onCreate');
- },
- onDestroy() {
- console.info('AceApplication onDestroy');
- }
-};
diff --git a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/i18n/en-US.json b/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/i18n/en-US.json
deleted file mode 100644
index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/i18n/en-US.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/i18n/zh-CN.json b/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/i18n/zh-CN.json
deleted file mode 100644
index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/i18n/zh-CN.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/pages/index/index.css b/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index 2b1965821483f4f8c8b97c86ef07fe87ea767d01..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,44 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 40px;
- color: #000000;
- opacity: 0.9;
-}
-
-@media screen and (device-type: tablet) and (orientation: landscape) {
- .title {
- font-size: 100px;
- }
-}
-
-@media screen and (device-type: wearable) {
- .title {
- font-size: 28px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: tv) {
- .container {
- background-image: url("../../common/images/Wallpaper.png");
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center;
- }
-
- .title {
- font-size: 100px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: phone) and (orientation: landscape) {
- .title {
- font-size: 60px;
- }
-}
diff --git a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/pages/index/index.hml b/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/pages/index/index.hml
deleted file mode 100644
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
diff --git a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/pages/index/index.js b/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index 50456dc1383e9fb7dd7fb0e01aae93bf73836e1e..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import file from '@system.file';
-import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index';
-import featureAbility from '@ohos.ability.featureability'
-
-export default {
- data: {
- title: ""
- },
- onInit() {
- this.title = 'Hks APP_A';
- },
- onShow(){
- this.title = 'Hks APP_A';
- featureAbility.startAbility({
- want:
- {
- deviceId: "",
- bundleName: "com.example.concurrencyapp2",
- abilityName: "com.example.concurrencyapp2.MainAbility",
- parameters:
- {},
- },
- });
- const core = Core.getInstance();
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- });
- const reportExtend = new ReportExtend(file);
- core.addService('expect', expectExtend);
- core.addService('report', reportExtend);
- core.init();
- const configService = core.getDefaultService('config');
- this.timeout = 3600000;
- configService.setConfig(this);
- require('../../../test/hks_concurrencyTestList.test.js');
- core.execute();
- }
-}
diff --git a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/resources/base/element/string.json b/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 2daf6aab9bb28e3bdb6e2333a4ebba5abfba8786..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "entry_MainAbility",
- "value": "HksA"
- },
- {
- "name": "mainability_description",
- "value": "JS_Empty Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/resources/base/media/icon.png b/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/resources/base/media/icon.png
deleted file mode 100644
index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000
Binary files a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/resources/base/media/icon.png and /dev/null differ
diff --git a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/test/hks_concurrencyTestList.test.js b/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/test/hks_concurrencyTestList.test.js
deleted file mode 100644
index e663ec6ac74b41584609dd2513fd7a9163bd97af..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/test/hks_concurrencyTestList.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-require('./hks_concurrency_App1.test.js');
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/test/hks_concurrency_App1.test.js b/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/test/hks_concurrency_App1.test.js
deleted file mode 100644
index 56ab6866927d67fa6e530bcbc606f275ca80a39b..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp1/entry/src/main/js/test/hks_concurrency_App1.test.js
+++ /dev/null
@@ -1,684 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import huks from '@ohos.security.huks'
-import { describe, it, expect } from 'deccjsunit/index'
-
-import {
- makeGenerateKeyOption,
- makeImportOption,
- makeEncryptAndDecryptOption,
- makeSignAndVerifyOption,
- makeAgreeOptions,
- makeMacOption,
- makeRandomArr,
- emptyOption,
- loop,
- timer
-} from '../../../../../../hks_xts_common.test'
-
-describe('HKS_CONCURRENCY_APP1_TEST', function () {
- var appName = 'app1';
- var defaultAlias = 'defaultAlias';
- var defaultAliasA = 'defaultAliasA';
- var defaultAliasB = 'defaultAliasB';
- var emptyOptionForApp1 = emptyOption;
- var plainText = makeRandomArr(64);
- var signPlainText = makeRandomArr(16);
- var ciphertext = [];
- var publicKey = [];
- var agreeKeyAOption = {};
- var agreeKeyBOption = {};
-
- var aes128KeyOptForApp1 = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC
- );
-
- var rsa512KeyOptForApp1 = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE
- );
-
- var ecc224OptForApp1 = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
- );
-
- var agreeKeyOptionForApp1 = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
- null,
- null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
- );
-
- var macKeyOptionForApp1 = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_HMAC,
- 160,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC,
- null,
- null,
- huks.HksKeyDigest.HKS_DIGEST_SHA1
- );
-
- var encryptAes128OptForApp1 = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- plainText
- );
-
- var signOptionForApp1 = makeSignAndVerifyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- signPlainText
- );
-
- var verifyOptionForApp1 = makeSignAndVerifyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- signPlainText
- );
-
- var macOptionForApp1 = makeMacOption(plainText);
-
- async function generateAesKeyForApp1() {
- var genKeyRet = await huks.generateKey(defaultAlias, aes128KeyOptForApp1);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp1);
- expect(isKeyExistRet).assertEqual(true);
- };
-
- async function generateRsaKeyForApp1() {
- var genKeyRet = await huks.generateKey(defaultAliasA, rsa512KeyOptForApp1);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExistRet = await huks.isKeyExist(defaultAliasA, emptyOptionForApp1);
- expect(isKeyExistRet).assertEqual(true);
- };
-
- async function deleteAesKeyForApp1() {
- var delKeyRet = await huks.deleteKey(defaultAlias, emptyOptionForApp1);
- expect(delKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp1);
- expect(isKeyExistRet).assertEqual(false);
- };
-
- async function deleteKeyABForApp1() {
- var delKeyARet = await huks.deleteKey(defaultAliasA, emptyOptionForApp1);
- expect(delKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyAExistRet = await huks.isKeyExist(defaultAliasA, emptyOptionForApp1);
- expect(isKeyAExistRet).assertEqual(false);
- var delKeyBRet = await huks.deleteKey(defaultAliasB, emptyOptionForApp1);
- expect(delKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyBExistRet = await huks.isKeyExist(defaultAliasB, emptyOptionForApp1);
- expect(isKeyBExistRet).assertEqual(false);
- };
-
- function isKeyExistAfterDelKeyForApp1(index, done) {
- huks.isKeyExist(defaultAlias, emptyOptionForApp1, function (err, data) {
- expect(data).assertEqual(false);
- if (index < loop) {
- index++;
- generateKeyCallbackForApp1(index, done);
- } else {
- done();
- }
- });
- };
-
- function deleteKeyCallbackForApp1(index, done) {
- huks.deleteKey(defaultAlias, emptyOptionForApp1, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isKeyExistAfterDelKeyForApp1(index, done);
- });
- };
-
- function isKeyExistAfterGenKeyForApp1(index, done) {
- huks.isKeyExist(defaultAlias, emptyOptionForApp1, function (err, data) {
- expect(data).assertEqual(true);
- deleteKeyCallbackForApp1(index, done);
- });
- };
-
- function generateKeyCallbackForApp1(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_00100 callback index ' + index);
- huks.generateKey(defaultAlias, aes128KeyOptForApp1, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isKeyExistAfterGenKeyForApp1(index, done);
- });
- };
-
- function genAndDelKeyCallbackForApp1(done) {
- var index = 0
- generateKeyCallbackForApp1(index, done);
- };
-
- function isKeyNotExistForApp1(alias, done) {
- huks.isKeyExist(alias, emptyOptionForApp1, function (err, data) {
- expect(data).assertEqual(false);
- done();
- })
- };
-
- function deleteKeyForApp1(alias, done) {
- huks.deleteKey(alias, emptyOptionForApp1, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isKeyNotExistForApp1(alias, done);
- })
- };
-
- function aesDecryptCallbackForApp1(index, done) {
- var decryptOpt = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- ciphertext
- );
- huks.decrypt(defaultAlias, decryptOpt, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(plainText)).assertEqual(JSON.stringify(data.outData));
- if (index < loop) {
- index++;
- aesEncryptCallbackForApp1(index, done);
- } else {
- deleteKeyForApp1(defaultAlias, done);
- }
- });
- };
-
- function aesEncryptCallbackForApp1(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_00400 callback index ' + index);
- huks.encrypt(defaultAlias, encryptAes128OptForApp1, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- ciphertext = data.outData
- aesDecryptCallbackForApp1(index, done);
- })
- };
-
- function aesEncryptAndDecryptCallbackForApp1(done) {
- var index = 0;
- aesEncryptCallbackForApp1(index, done);
- };
-
- function isAliasBExistForApp1(done) {
- huks.isKeyExist(defaultAliasB, emptyOptionForApp1, function (err, data) {
- expect(data).assertEqual(false);
- done();
- });
- };
-
- function isAliasAExistForApp1(done) {
- huks.isKeyExist(defaultAliasA, emptyOptionForApp1, function (err, data) {
- expect(data).assertEqual(false);
- isAliasBExistForApp1(done);
- });
- };
-
- function deleteAliasBForAPP1(done) {
- huks.deleteKey(defaultAliasB, emptyOptionForApp1, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isAliasAExistForApp1(done);
- });
- };
-
- function deleteAliasAForApp1(done) {
- huks.deleteKey(defaultAliasA, emptyOptionForApp1, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- deleteAliasBForAPP1(done);
- });
- };
-
- function rsaImportCallbackForApp1(index, done) {
- var importRsa512KeyOpt = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- publicKey
- );
- huks.importKey(defaultAliasB, importRsa512KeyOpt, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (index < loop) {
- index++;
- rsaExportCallbackForApp1(index, done);
- } else {
- deleteAliasAForApp1(done);
- }
- });
- };
-
- function rsaExportCallbackForApp1(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_00600 callback index ' + index);
- huks.exportKey(defaultAliasA, emptyOptionForApp1, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- publicKey = data.outData;
- rsaImportCallbackForApp1(index, done);
- });
- };
-
- function rsaExportAndImportCallbackForApp1(done) {
- var index = 0;
- rsaExportCallbackForApp1(index, done);
- };
-
- function getKeyPropertiesCallbackForApp1(index, done) {
- huks.getKeyProperties(defaultAlias, emptyOptionForApp1, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (index < loop) {
- index++;
- getKeyPropertiesCallbackForApp1(index, done);
- } else {
- deleteKeyForApp1(defaultAlias, done);
- }
- });
- };
-
- function isKeyNotExistCallbackForApp1(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_00800 callback not exist key index ' + index);
- huks.isKeyExist(defaultAlias, emptyOptionForApp1, function (err, data) {
- expect(data).assertEqual(false);
- if (index < loop) {
- index++;
- isKeyNotExistCallbackForApp1(index, done);
- } else {
- done();
- }
- });
- };
-
- function deleteExistKeyCallbackForApp1(done) {
- huks.deleteKey(defaultAlias, emptyOptionForApp1, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isKeyNotExistCallbackForApp1(0, done);
- });
- };
-
- function isKeyExistCallbackForApp1(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_00800 callback exist key index ' + index);
- huks.isKeyExist(defaultAlias, emptyOptionForApp1, function (err, data) {
- expect(data).assertEqual(true);
- if (index < loop) {
- index++;
- isKeyExistCallbackForApp1(index, done);
- } else {
- deleteExistKeyCallbackForApp1(done);
- }
- });
- };
-
- async function generateSignKeyForApp1() {
- var generateKeyRet = await huks.generateKey(defaultAliasA, ecc224OptForApp1);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyRet = await huks.exportKey(defaultAliasA, emptyOptionForApp1);
- var importOptions = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- null,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- exportKeyRet.outData
- );
- var importKeyRet = await huks.importKey(defaultAliasB, importOptions);
- expect(importKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- };
-
- function verifyWithCallbackForApp1(index, done) {
- huks.verify(defaultAliasB, verifyOptionForApp1, ciphertext, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (index < loop) {
- index++;
- signWithCallbackForApp1(index, done);
- } else {
- deleteAliasAForApp1(done);
- }
- });
- }
-
- function signWithCallbackForApp1(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_01100 callback index ' + index);
- huks.sign(defaultAliasA, signOptionForApp1, function (err, data) {
- ciphertext = data.outData;
- verifyWithCallbackForApp1(index, done);
- });
- }
-
- function signAndVerifyCallbackForApp1(done) {
- signWithCallbackForApp1(0, done);
- };
-
- function agreeKeyBWithCallbackForApp1(key, index, done) {
- huks.agreeKey(defaultAliasB, agreeKeyBOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(data.outData)).assertEqual(JSON.stringify(key));
- if (index < loop) {
- index++;
- agreeKeyAWithCallbackForApp1(index, done);
- } else {
- deleteAliasAForApp1(done);
- }
- });
- };
-
- function agreeKeyAWithCallbackForApp1(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_01200 promise callback index ' + index);
- huks.agreeKey(defaultAliasA, agreeKeyAOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var key = data.outData;
- console.log('agreeKeyARet.outData' + key);
-
- agreeKeyBWithCallbackForApp1(key, index, done);
- });
- };
-
- function agreeWithCallbackForApp1(done) {
- agreeKeyAWithCallbackForApp1(0, done);
- };
-
- function macWithCallbackForApp1(index, done) {
- huks.mac(defaultAlias, macOptionForApp1, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (index < loop) {
- index++;
- macWithCallbackForApp1(index, done);
- } else {
- deleteKeyForApp1(defaultAlias, done);
- }
- });
- };
-
- /**
- * @tc.number HUKS_Concurrency_Test_00100
- * @tc.name Concurrency_Test_GenKey_AES
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00100', 0, async function (done) {
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00100 promise index ' + index);
- var genKeyRet = await huks.generateKey(defaultAlias, aes128KeyOptForApp1);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp1);
- expect(isKeyExistRet).assertEqual(true);
- var delKeyRet = await huks.deleteKey(defaultAlias, emptyOptionForApp1);
- expect(delKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp1);
- expect(isKeyExistRet).assertEqual(false);
- }
- genAndDelKeyCallbackForApp1(done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00200
- * @tc.name Concurrency_Test_GetSdkVersion
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00200', 0, async function (done) {
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00200 promise index ' + index);
- var sdkVersion = await huks.getSdkVersion(emptyOptionForApp1);
- console.log('sdk version ' + JSON.stringify(sdkVersion));
- var result = false;
- if (sdkVersion.length > 0) {
- result = true;
- }
- expect(result).assertEqual(true);
- }
- done();
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00300
- * @tc.name Concurrency_Test_Encrypt_Decrypt_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00300', 0, async function (done) {
- await generateAesKeyForApp1();
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00300 promise index ' + index);
- var encryptRet = await huks.encrypt(defaultAlias, encryptAes128OptForApp1);
- expect(encryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var decryptOpt = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- encryptRet.outData
- );
- var decryptRet = await huks.decrypt(defaultAlias, decryptOpt);
- expect(decryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(plainText)).assertEqual(JSON.stringify(decryptRet.outData));
- }
- await deleteAesKeyForApp1();
- done();
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00400
- * @tc.name Concurrency_Test_Encrypt_Decrypt_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00400', 0, async function (done) {
- await generateAesKeyForApp1();
- aesEncryptAndDecryptCallbackForApp1(done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00500
- * @tc.name Concurrency_Test_Import_Export_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00500', 0, async function (done) {
- await generateRsaKeyForApp1();
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00500 promise index ' + index);
- var exportPublicKeyRet = await huks.exportKey(defaultAliasA, emptyOptionForApp1);
- expect(exportPublicKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var importRsa512KeyOpt = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- exportPublicKeyRet.outData
- );
- var importRsa512KeyRet = await huks.importKey(defaultAliasB, importRsa512KeyOpt);
- expect(importRsa512KeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- await deleteKeyABForApp1();
- done();
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00600
- * @tc.name Concurrency_Test_Import_Export_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00600', 0, async function (done) {
- await generateRsaKeyForApp1();
- rsaExportAndImportCallbackForApp1(done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00700
- * @tc.name Concurrency_Test_GetKeyProperties
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00700', 0, async function (done) {
- await generateAesKeyForApp1();
- for (let index = 0; index < loop; index++) {
- var getKeyPropertiesRet = await huks.getKeyProperties(defaultAlias, emptyOptionForApp1);
- expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- getKeyPropertiesCallbackForApp1(0, done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00800
- * @tc.name Concurrency_Test_IsKeyExist_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00800', 0, async function (done) {
- await generateAesKeyForApp1();
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00800 exist key index ' + index);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp1);
- expect(isKeyExistRet).assertEqual(true);
- }
- await deleteAesKeyForApp1();
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00800 not exist key index ' + index);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp1);
- expect(isKeyExistRet).assertEqual(false);
- }
- done();
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00900
- * @tc.name Concurrency_Test_IsKeyExist_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00900', 0, async function (done) {
- await generateAesKeyForApp1();
- isKeyExistCallbackForApp1(0, done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01000
- * @tc.name Concurrency_Test_Sign_Verify_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_01000', 0, async function (done) {
- await generateSignKeyForApp1();
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_01000 promise index ' + index);
- var signRet = await huks.sign(defaultAliasA, signOptionForApp1);
- var verifyRet = await huks.verify(defaultAliasB, verifyOptionForApp1, signRet.outData);
- expect(verifyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- await deleteKeyABForApp1();
- done();
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01100
- * @tc.name Concurrency_Test_Sign_Verify_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_01100', 0, async function (done) {
- await generateSignKeyForApp1();
- signAndVerifyCallbackForApp1(done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01200
- * @tc.name Concurrency_Test_agree
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_01200', 0, async function (done) {
- var generateKeyARet = await huks.generateKey(defaultAliasA, agreeKeyOptionForApp1);
- expect(generateKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var generateKeyBRet = await huks.generateKey(defaultAliasB, agreeKeyOptionForApp1);
- expect(generateKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyARet = await huks.exportKey(defaultAliasA, emptyOptionForApp1);
- expect(exportKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyBRet = await huks.exportKey(defaultAliasB, emptyOptionForApp1);
- expect(exportKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- agreeKeyBOption = makeAgreeOptions(exportKeyARet.outData);
- agreeKeyAOption = makeAgreeOptions(exportKeyBRet.outData);
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_01200 promise index ' + index);
- var agreeKeyARet = await huks.agreeKey(defaultAliasA, agreeKeyAOption);
- expect(agreeKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var agreeKeyBRet = await huks.agreeKey(defaultAliasB, agreeKeyBOption);
- expect(agreeKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(agreeKeyARet.outData)).assertEqual(JSON.stringify(agreeKeyBRet.outData));
- }
- agreeWithCallbackForApp1(done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01300
- * @tc.name Concurrency_Test_mac
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_01300', 0, async function (done) {
- var generateKeyRet = await huks.generateKey(defaultAlias, macKeyOptionForApp1);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var macOptionForApp1 = makeMacOption(plainText);
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_01300 promise index ' + index);
- var macRet = await huks.mac(defaultAlias, macOptionForApp1);
- expect(macRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- macWithCallbackForApp1(0, done);
- setTimeout(function () {
- }, timer);
- });
-});
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp1/signature/openharmony_sx.p7b b/security/huks_standard/HuksConcurrencyApp1/signature/openharmony_sx.p7b
deleted file mode 100644
index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000
Binary files a/security/huks_standard/HuksConcurrencyApp1/signature/openharmony_sx.p7b and /dev/null differ
diff --git a/security/huks_standard/HuksConcurrencyApp2/BUILD.gn b/security/huks_standard/HuksConcurrencyApp2/BUILD.gn
deleted file mode 100644
index 8fd3f2b1b56c2a05253db817adab384634f75ba8..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/BUILD.gn
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//test/xts/tools/build/suite.gni")
-
-ohos_js_hap_suite("ActsHuksConcurrencyApp2Test") {
- hap_profile = "./entry/src/main/config.json"
- deps = [
- ":hjs_demo_js_assets",
- ":hjs_demo_resources",
- ]
- certificate_profile = "./signature/openharmony_sx.p7b"
- hap_name = "ActsHuksConcurrencyApp2Test"
-}
-ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
-}
-ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
-}
diff --git a/security/huks_standard/HuksConcurrencyApp2/Test.json b/security/huks_standard/HuksConcurrencyApp2/Test.json
deleted file mode 100644
index 5ddf569f6b5d99d79e14b38bdd26c8ac5fc51496..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/Test.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "description": "Configuration for concurrecny test",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "300000",
- "package": "com.example.concurrencyapp2",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsHuksConcurrencyApp1Test.hap",
- "ActsHuksConcurrencyApp2Test.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
diff --git a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/config.json b/security/huks_standard/HuksConcurrencyApp2/entry/src/main/config.json
deleted file mode 100644
index 7956705de24346a2b3565d0260e1c133db30c405..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/config.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "app": {
- "bundleName": "com.example.concurrencyapp2",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Beta1"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.concurrencyapp2",
- "name": ".MyApplication",
- "mainAbility": "com.example.concurrencyapp2.MainAbility",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": true
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.concurrencyapp2.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:entry_MainAbility",
- "type": "page",
- "launchType": "singleton",
- "visible": true,
- "isVisible": "true"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": true
- }
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/app.js b/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/app.js
deleted file mode 100644
index 14ca792625c50b934e7bda87ac333d3414dc12bd..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/app.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export default {
- onCreate() {
- console.info('AceApplication onCreate');
- },
- onDestroy() {
- console.info('AceApplication onDestroy');
- }
-};
diff --git a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/i18n/en-US.json b/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/i18n/en-US.json
deleted file mode 100644
index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/i18n/en-US.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/i18n/zh-CN.json b/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/i18n/zh-CN.json
deleted file mode 100644
index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/i18n/zh-CN.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/pages/index/index.css b/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index 2b1965821483f4f8c8b97c86ef07fe87ea767d01..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,44 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 40px;
- color: #000000;
- opacity: 0.9;
-}
-
-@media screen and (device-type: tablet) and (orientation: landscape) {
- .title {
- font-size: 100px;
- }
-}
-
-@media screen and (device-type: wearable) {
- .title {
- font-size: 28px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: tv) {
- .container {
- background-image: url("../../common/images/Wallpaper.png");
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center;
- }
-
- .title {
- font-size: 100px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: phone) and (orientation: landscape) {
- .title {
- font-size: 60px;
- }
-}
diff --git a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/pages/index/index.hml b/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/pages/index/index.hml
deleted file mode 100644
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
diff --git a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/pages/index/index.js b/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index 37a2505b7f7b732224068d0223e598f90d810f3e..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import file from '@system.file';
-import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index';
-
-export default {
- data: {
- title: ""
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow(){
- const core = Core.getInstance();
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- });
- const reportExtend = new ReportExtend(file);
- core.addService('expect', expectExtend);
- core.addService('report', reportExtend);
- core.init();
- const configService = core.getDefaultService('config');
- this.timeout = 3600000;
- configService.setConfig(this);
- require('../../../test/hks_concurrencyTestList.test.js');
- this.title = 'Hks APP_B';
- core.execute();
- }
-}
diff --git a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/resources/base/element/string.json b/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 6ce5bfc6cf08a33bfbe1e33f8c53ed5a85dd2d18..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "entry_MainAbility",
- "value": "HksB"
- },
- {
- "name": "mainability_description",
- "value": "JS_Empty Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/resources/base/media/icon.png b/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/resources/base/media/icon.png
deleted file mode 100644
index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000
Binary files a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/resources/base/media/icon.png and /dev/null differ
diff --git a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/test/hks_concurrencyTestList.test.js b/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/test/hks_concurrencyTestList.test.js
deleted file mode 100644
index f5e87d0e6de6302d1bb11f77c995ea706296038f..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/test/hks_concurrencyTestList.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-require('./hks_concurrency_APP2.test')
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/test/hks_concurrency_APP2.test.js b/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/test/hks_concurrency_APP2.test.js
deleted file mode 100644
index 213b042da9baa1dd682ae2ae0543fd0d39a219d6..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyApp2/entry/src/main/js/test/hks_concurrency_APP2.test.js
+++ /dev/null
@@ -1,684 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import huks from '@ohos.security.huks'
-import { describe, it, expect } from 'deccjsunit/index'
-
-import {
- makeGenerateKeyOption,
- makeImportOption,
- makeEncryptAndDecryptOption,
- makeSignAndVerifyOption,
- makeAgreeOptions,
- makeMacOption,
- makeRandomArr,
- emptyOption,
- loop,
- timer
-} from '../../../../../../hks_xts_common.test'
-
-describe('HKS_CONCURRENCY_APP2_TEST', function () {
- var appName = 'app2';
- var defaultAlias = 'defaultAlias';
- var defaultAliasA = 'defaultAliasA';
- var defaultAliasB = 'defaultAliasB';
- var emptyOptionForApp2 = emptyOption;
- var plainText = makeRandomArr(64);
- var signPlainText = makeRandomArr(16);
- var ciphertext = [];
- var publicKey = [];
- var agreeKeyAOption = {};
- var agreeKeyBOption = {};
-
- var aes128KeyOptForApp2 = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC
- );
-
- var rsa512KeyOptForApp2 = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE
- );
-
- var ecc224OptForApp2 = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
- );
-
- var agreeKeyOptionForApp2 = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
- null,
- null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
- );
-
- var macKeyOptionForApp2 = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_HMAC,
- 160,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC,
- null,
- null,
- huks.HksKeyDigest.HKS_DIGEST_SHA1
- );
-
- var encryptAes128OptForApp2 = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- plainText
- );
-
- var signOptionForApp2 = makeSignAndVerifyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- signPlainText
- );
-
- var verifyOptionForApp2 = makeSignAndVerifyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- signPlainText
- );
-
- var macOptionForApp2 = makeMacOption(plainText);
-
- async function generateAesKeyForApp2() {
- var genKeyRet = await huks.generateKey(defaultAlias, aes128KeyOptForApp2);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp2);
- expect(isKeyExistRet).assertEqual(true);
- };
-
- async function generateRsaKeyForApp2() {
- var genKeyRet = await huks.generateKey(defaultAliasA, rsa512KeyOptForApp2);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExistRet = await huks.isKeyExist(defaultAliasA, emptyOptionForApp2);
- expect(isKeyExistRet).assertEqual(true);
- };
-
- async function deleteAesKeyForApp2() {
- var delKeyRet = await huks.deleteKey(defaultAlias, emptyOptionForApp2);
- expect(delKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp2);
- expect(isKeyExistRet).assertEqual(false);
- };
-
- async function deleteKeyABForApp2() {
- var delKeyARet = await huks.deleteKey(defaultAliasA, emptyOptionForApp2);
- expect(delKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyAExistRet = await huks.isKeyExist(defaultAliasA, emptyOptionForApp2);
- expect(isKeyAExistRet).assertEqual(false);
- var delKeyBRet = await huks.deleteKey(defaultAliasB, emptyOptionForApp2);
- expect(delKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyBExistRet = await huks.isKeyExist(defaultAliasB, emptyOptionForApp2);
- expect(isKeyBExistRet).assertEqual(false);
- };
-
- function isKeyExistAfterDelKeyForApp2(index, done) {
- huks.isKeyExist(defaultAlias, emptyOptionForApp2, function (err, data) {
- expect(data).assertEqual(false);
- if (index < loop) {
- index++;
- generateKeyCallbackForApp2(index, done);
- } else {
- done();
- }
- });
- };
-
- function deleteKeyCallbackForApp2(index, done) {
- huks.deleteKey(defaultAlias, emptyOptionForApp2, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isKeyExistAfterDelKeyForApp2(index, done);
- });
- };
-
- function isKeyExistAfterGenKeyForApp2(index, done) {
- huks.isKeyExist(defaultAlias, emptyOptionForApp2, function (err, data) {
- expect(data).assertEqual(true);
- deleteKeyCallbackForApp2(index, done);
- });
- };
-
- function generateKeyCallbackForApp2(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_00100 callback index ' + index);
- huks.generateKey(defaultAlias, aes128KeyOptForApp2, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isKeyExistAfterGenKeyForApp2(index, done);
- });
- };
-
- function genAndDelKeyCallbackForApp2(done) {
- var index = 0
- generateKeyCallbackForApp2(index, done);
- };
-
- function isKeyNotExistForApp2(alias, done) {
- huks.isKeyExist(alias, emptyOptionForApp2, function (err, data) {
- expect(data).assertEqual(false);
- done();
- })
- };
-
- function deleteKeyForApp2(alias, done) {
- huks.deleteKey(alias, emptyOptionForApp2, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isKeyNotExistForApp2(alias, done);
- })
- };
-
- function aesDecryptCallbackForApp2(index, done) {
- var decryptOpt = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- ciphertext
- );
- huks.decrypt(defaultAlias, decryptOpt, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(plainText)).assertEqual(JSON.stringify(data.outData));
- if (index < loop) {
- index++;
- aesEncryptCallbackForApp2(index, done);
- } else {
- deleteKeyForApp2(defaultAlias, done);
- }
- });
- };
-
- function aesEncryptCallbackForApp2(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_00400 callback index ' + index);
- huks.encrypt(defaultAlias, encryptAes128OptForApp2, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- ciphertext = data.outData
- aesDecryptCallbackForApp2(index, done);
- })
- };
-
- function aesEncryptAndDecryptCallbackForApp2(done) {
- var index = 0;
- aesEncryptCallbackForApp2(index, done);
- };
-
- function isAliasBExistForApp2(done) {
- huks.isKeyExist(defaultAliasB, emptyOptionForApp2, function (err, data) {
- expect(data).assertEqual(false);
- done();
- });
- };
-
- function isAliasAExistForApp2(done) {
- huks.isKeyExist(defaultAliasA, emptyOptionForApp2, function (err, data) {
- expect(data).assertEqual(false);
- isAliasBExistForApp2(done);
- });
- };
-
- function deleteAliasBForAPP1(done) {
- huks.deleteKey(defaultAliasB, emptyOptionForApp2, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isAliasAExistForApp2(done);
- });
- };
-
- function deleteAliasAForApp2(done) {
- huks.deleteKey(defaultAliasA, emptyOptionForApp2, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- deleteAliasBForAPP1(done);
- });
- };
-
- function rsaImportCallbackForApp2(index, done) {
- var importRsa512KeyOpt = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- publicKey
- );
- huks.importKey(defaultAliasB, importRsa512KeyOpt, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (index < loop) {
- index++;
- rsaExportCallbackForApp2(index, done);
- } else {
- deleteAliasAForApp2(done);
- }
- });
- };
-
- function rsaExportCallbackForApp2(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_00600 callback index ' + index);
- huks.exportKey(defaultAliasA, emptyOptionForApp2, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- publicKey = data.outData;
- rsaImportCallbackForApp2(index, done);
- });
- };
-
- function rsaExportAndImportCallbackForApp2(done) {
- var index = 0;
- rsaExportCallbackForApp2(index, done);
- };
-
- function getKeyPropertiesCallbackForApp2(index, done) {
- huks.getKeyProperties(defaultAlias, emptyOptionForApp2, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (index < loop) {
- index++;
- getKeyPropertiesCallbackForApp2(index, done);
- } else {
- deleteKeyForApp2(defaultAlias, done);
- }
- });
- };
-
- function isKeyNotExistCallbackForApp2(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_00800 callback not exist key index ' + index);
- huks.isKeyExist(defaultAlias, emptyOptionForApp2, function (err, data) {
- expect(data).assertEqual(false);
- if (index < loop) {
- index++;
- isKeyNotExistCallbackForApp2(index, done);
- } else {
- done();
- }
- });
- };
-
- function deleteExistKeyCallbackForApp2(done) {
- huks.deleteKey(defaultAlias, emptyOptionForApp2, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isKeyNotExistCallbackForApp2(0, done);
- });
- };
-
- function isKeyExistCallbackForApp2(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_00800 callback exist key index ' + index);
- huks.isKeyExist(defaultAlias, emptyOptionForApp2, function (err, data) {
- expect(data).assertEqual(true);
- if (index < loop) {
- index++;
- isKeyExistCallbackForApp2(index, done);
- } else {
- deleteExistKeyCallbackForApp2(done);
- }
- });
- };
-
- async function generateSignKeyForApp2() {
- var generateKeyRet = await huks.generateKey(defaultAliasA, ecc224OptForApp2);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyRet = await huks.exportKey(defaultAliasA, emptyOptionForApp2);
- var importOptions = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- null,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- exportKeyRet.outData
- );
- var importKeyRet = await huks.importKey(defaultAliasB, importOptions);
- expect(importKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- };
-
- function verifyWithCallbackForApp2(index, done) {
- huks.verify(defaultAliasB, verifyOptionForApp2, ciphertext, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (index < loop) {
- index++;
- signWithCallbackForApp2(index, done);
- } else {
- deleteAliasAForApp2(done);
- }
- });
- }
-
- function signWithCallbackForApp2(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_01100 callback index ' + index);
- huks.sign(defaultAliasA, signOptionForApp2, function (err, data) {
- ciphertext = data.outData;
- verifyWithCallbackForApp2(index, done);
- });
- }
-
- function signAndVerifyCallbackForApp2(done) {
- signWithCallbackForApp2(0, done);
- };
-
- function agreeKeyBWithCallbackForApp2(key, index, done) {
- huks.agreeKey(defaultAliasB, agreeKeyBOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(data.outData)).assertEqual(JSON.stringify(key));
- if (index < loop) {
- index++;
- agreeKeyAWithCallbackForApp2(index, done);
- } else {
- deleteAliasAForApp2(done);
- }
- });
- };
-
- function agreeKeyAWithCallbackForApp2(index, done) {
- console.log(appName + ' HUKS_Concurrency_Test_01200 promise callback index ' + index);
- huks.agreeKey(defaultAliasA, agreeKeyAOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var key = data.outData;
- console.log('agreeKeyARet.outData' + key);
-
- agreeKeyBWithCallbackForApp2(key, index, done);
- });
- };
-
- function agreeWithCallbackForApp2(done) {
- agreeKeyAWithCallbackForApp2(0, done);
- };
-
- function macWithCallbackForApp2(index, done) {
- huks.mac(defaultAlias, macOptionForApp2, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (index < loop) {
- index++;
- macWithCallbackForApp2(index, done);
- } else {
- deleteKeyForApp2(defaultAlias, done);
- }
- });
- };
-
- /**
- * @tc.number HUKS_Concurrency_Test_00100
- * @tc.name Concurrency_Test_GenKey_AES
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00100', 0, async function (done) {
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00100 promise index ' + index);
- var genKeyRet = await huks.generateKey(defaultAlias, aes128KeyOptForApp2);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp2);
- expect(isKeyExistRet).assertEqual(true);
- var delKeyRet = await huks.deleteKey(defaultAlias, emptyOptionForApp2);
- expect(delKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp2);
- expect(isKeyExistRet).assertEqual(false);
- }
- genAndDelKeyCallbackForApp2(done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00200
- * @tc.name Concurrency_Test_GetSdkVersion
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00200', 0, async function (done) {
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00200 promise index ' + index);
- var sdkVersion = await huks.getSdkVersion(emptyOptionForApp2);
- console.log('sdk version ' + JSON.stringify(sdkVersion));
- var result = false;
- if (sdkVersion.length > 0) {
- result = true;
- }
- expect(result).assertEqual(true);
- }
- done();
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00300
- * @tc.name Concurrency_Test_Encrypt_Decrypt_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00300', 0, async function (done) {
- await generateAesKeyForApp2();
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00300 promise index ' + index);
- var encryptRet = await huks.encrypt(defaultAlias, encryptAes128OptForApp2);
- expect(encryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var decryptOpt = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- encryptRet.outData
- );
- var decryptRet = await huks.decrypt(defaultAlias, decryptOpt);
- expect(decryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(plainText)).assertEqual(JSON.stringify(decryptRet.outData));
- }
- await deleteAesKeyForApp2();
- done();
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00400
- * @tc.name Concurrency_Test_Encrypt_Decrypt_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00400', 0, async function (done) {
- await generateAesKeyForApp2();
- aesEncryptAndDecryptCallbackForApp2(done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00500
- * @tc.name Concurrency_Test_Import_Export_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00500', 0, async function (done) {
- await generateRsaKeyForApp2();
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00500 promise index ' + index);
- var exportPublicKeyRet = await huks.exportKey(defaultAliasA, emptyOptionForApp2);
- expect(exportPublicKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var importRsa512KeyOpt = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- exportPublicKeyRet.outData
- );
- var importRsa512KeyRet = await huks.importKey(defaultAliasB, importRsa512KeyOpt);
- expect(importRsa512KeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- await deleteKeyABForApp2();
- done();
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00600
- * @tc.name Concurrency_Test_Import_Export_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00600', 0, async function (done) {
- await generateRsaKeyForApp2();
- rsaExportAndImportCallbackForApp2(done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00700
- * @tc.name Concurrency_Test_GetKeyProperties
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00700', 0, async function (done) {
- await generateAesKeyForApp2();
- for (let index = 0; index < loop; index++) {
- var getKeyPropertiesRet = await huks.getKeyProperties(defaultAlias, emptyOptionForApp2);
- expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- getKeyPropertiesCallbackForApp2(0, done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00800
- * @tc.name Concurrency_Test_IsKeyExist_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00800', 0, async function (done) {
- await generateAesKeyForApp2();
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00800 exist key index ' + index);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp2);
- expect(isKeyExistRet).assertEqual(true);
- }
- await deleteAesKeyForApp2();
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_00800 not exist key index ' + index);
- var isKeyExistRet = await huks.isKeyExist(defaultAlias, emptyOptionForApp2);
- expect(isKeyExistRet).assertEqual(false);
- }
- done();
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00900
- * @tc.name Concurrency_Test_IsKeyExist_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_00900', 0, async function (done) {
- await generateAesKeyForApp2();
- isKeyExistCallbackForApp2(0, done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01000
- * @tc.name Concurrency_Test_Sign_Verify_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_01000', 0, async function (done) {
- await generateSignKeyForApp2();
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_01000 promise index ' + index);
- var signRet = await huks.sign(defaultAliasA, signOptionForApp2);
- var verifyRet = await huks.verify(defaultAliasB, verifyOptionForApp2, signRet.outData);
- expect(verifyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- await deleteKeyABForApp2();
- done();
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01100
- * @tc.name Concurrency_Test_Sign_Verify_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_01100', 0, async function (done) {
- await generateSignKeyForApp2();
- signAndVerifyCallbackForApp2(done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01200
- * @tc.name Concurrency_Test_agree
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_01200', 0, async function (done) {
- var generateKeyARet = await huks.generateKey(defaultAliasA, agreeKeyOptionForApp2);
- expect(generateKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var generateKeyBRet = await huks.generateKey(defaultAliasB, agreeKeyOptionForApp2);
- expect(generateKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyARet = await huks.exportKey(defaultAliasA, emptyOptionForApp2);
- expect(exportKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyBRet = await huks.exportKey(defaultAliasB, emptyOptionForApp2);
- expect(exportKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- agreeKeyBOption = makeAgreeOptions(exportKeyARet.outData);
- agreeKeyAOption = makeAgreeOptions(exportKeyBRet.outData);
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_01200 promise index ' + index);
- var agreeKeyARet = await huks.agreeKey(defaultAliasA, agreeKeyAOption);
- expect(agreeKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var agreeKeyBRet = await huks.agreeKey(defaultAliasB, agreeKeyBOption);
- expect(agreeKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(agreeKeyARet.outData)).assertEqual(JSON.stringify(agreeKeyBRet.outData));
- }
- agreeWithCallbackForApp2(done);
- setTimeout(function () {
- }, timer);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01300
- * @tc.name Concurrency_Test_mac
- * @tc.desc Test for APP Concurrency.
- */
- it('HUKS_Concurrency_Test_01300', 0, async function (done) {
- var generateKeyRet = await huks.generateKey(defaultAlias, macKeyOptionForApp2);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var macOptionForApp2 = makeMacOption(plainText);
- for (let index = 0; index < loop; index++) {
- console.log(appName + ' HUKS_Concurrency_Test_01300 promise index ' + index);
- var macRet = await huks.mac(defaultAlias, macOptionForApp2);
- expect(macRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- macWithCallbackForApp2(0, done);
- setTimeout(function () {
- }, timer);
- });
-});
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyApp2/signature/openharmony_sx.p7b b/security/huks_standard/HuksConcurrencyApp2/signature/openharmony_sx.p7b
deleted file mode 100644
index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000
Binary files a/security/huks_standard/HuksConcurrencyApp2/signature/openharmony_sx.p7b and /dev/null differ
diff --git a/security/huks_standard/HuksConcurrencyTest/BUILD.gn b/security/huks_standard/HuksConcurrencyTest/BUILD.gn
deleted file mode 100644
index 16cf882d50c81dfe927132f36c5aa234dccdd7fc..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/BUILD.gn
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//test/xts/tools/build/suite.gni")
-
-ohos_js_hap_suite("ActsHuksConcurrencyTest") {
- hap_profile = "./entry/src/main/config.json"
- deps = [
- ":hjs_demo_js_assets",
- ":hjs_demo_resources",
- ]
- certificate_profile = "./signature/openharmony_sx.p7b"
- hap_name = "ActsHuksConcurrencyTest"
-}
-ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
-}
-ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
-}
diff --git a/security/huks_standard/HuksConcurrencyTest/Test.json b/security/huks_standard/HuksConcurrencyTest/Test.json
deleted file mode 100644
index 85ea723117f4d72ade6725cdb0ef59397d355daa..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/Test.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "description": "Configuration for algorithm completion test",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "300000",
- "package": "com.example.huksconcurrencytest",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsHuksConcurrencyTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/config.json b/security/huks_standard/HuksConcurrencyTest/entry/src/main/config.json
deleted file mode 100644
index 9fdbe0fb18fbaaf6c69a96616af8fff5f000311d..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/entry/src/main/config.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "app": {
- "bundleName": "com.example.huksconcurrencytest",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Beta1"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.huksconcurrencytest",
- "name": ".MyApplication",
- "mainAbility": "com.example.huksconcurrencytest.MainAbility",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": true
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.huksconcurrencytest.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:entry_MainAbility",
- "type": "page",
- "launchType": "singleton",
- "visible": true,
- "isVisible": "true"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": true
- }
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/app.js b/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/app.js
deleted file mode 100644
index 14ca792625c50b934e7bda87ac333d3414dc12bd..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/app.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export default {
- onCreate() {
- console.info('AceApplication onCreate');
- },
- onDestroy() {
- console.info('AceApplication onDestroy');
- }
-};
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/i18n/en-US.json b/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/i18n/en-US.json
deleted file mode 100644
index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/i18n/en-US.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/i18n/zh-CN.json b/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/i18n/zh-CN.json
deleted file mode 100644
index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/i18n/zh-CN.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/pages/index/index.css b/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index 2b1965821483f4f8c8b97c86ef07fe87ea767d01..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,44 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 40px;
- color: #000000;
- opacity: 0.9;
-}
-
-@media screen and (device-type: tablet) and (orientation: landscape) {
- .title {
- font-size: 100px;
- }
-}
-
-@media screen and (device-type: wearable) {
- .title {
- font-size: 28px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: tv) {
- .container {
- background-image: url("../../common/images/Wallpaper.png");
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center;
- }
-
- .title {
- font-size: 100px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: phone) and (orientation: landscape) {
- .title {
- font-size: 60px;
- }
-}
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/pages/index/index.hml b/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/pages/index/index.hml
deleted file mode 100644
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/pages/index/index.js b/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index 13112495ee60b1e2e92d5e3e58d102d796c9d669..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import file from '@system.file';
-import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index';
-
-export default {
- data: {
- title: ""
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- const core = Core.getInstance();
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- });
- const reportExtend = new ReportExtend(file);
- core.addService('expect', expectExtend);
- core.addService('report', reportExtend);
- core.init();
- const configService = core.getDefaultService('config');
- this.timeout = 3000000;
- configService.setConfig(this);
- require('../../../test/hks_xts_concurrency.test.js');
- core.execute();
- }
-}
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/workers/worker.js b/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/workers/worker.js
deleted file mode 100644
index 6d3ad6bcb82077cab61663ddd520682edd88241f..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/default/workers/worker.js
+++ /dev/null
@@ -1,512 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import worker from '@ohos.worker';
-import hks from '@ohos.security.huks';
-import {
- aliasA,
- aliasB,
- failStr,
- loop,
- successStr,
- emptyOption,
- makeEncryptAndDecryptOption,
- makeGenerateKeyOption,
- makeImportOption,
- makeMacOption,
- makeRandomArr,
- makeSignAndVerifyOption,
- makeAgreeOption
-} from '../../test/hks_common.test.js';
-
-var parentPort = worker.parentPort;
-var plainText = makeRandomArr(64);
-var signPlainText = makeRandomArr(16);
-
-var generateKeyOption = makeGenerateKeyOption(
- hks.HksKeyAlg.HKS_ALG_AES,
- hks.HksKeySize.HKS_AES_KEY_SIZE_128,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksCipherMode.HKS_MODE_CBC,
- null
-);
-
-var encryptAesOpt = makeEncryptAndDecryptOption(
- hks.HksKeyAlg.HKS_ALG_AES,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- plainText
-);
-
-var signOption = makeSignAndVerifyOption(
- hks.HksKeyAlg.HKS_ALG_ECC,
- hks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksKeyDigest.HKS_DIGEST_NONE,
- signPlainText
-);
-
-var verifyOption = makeSignAndVerifyOption(
- hks.HksKeyAlg.HKS_ALG_ECC,
- hks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksKeyDigest.HKS_DIGEST_NONE,
- signPlainText
-);
-
-var macOption = makeMacOption(plainText);
-
-var actionMap = new Map([
- ['Hks_Concurrency_Test_00100', function() {
- hksConcurrencyTest001();
- }],
- ['Hks_Concurrency_Test_00200', function() {
- hksConcurrencyTest002(0);
- }],
- ['Hks_Concurrency_Test_00300', function() {
- hksConcurrencyTest003();
- }],
- ['Hks_Concurrency_Test_00400', function() {
- hksConcurrencyTest004(0);
- }],
- ['Hks_Concurrency_Test_00500', function() {
- hksConcurrencyTest005();
- }],
- ['Hks_Concurrency_Test_00600', function() {
- hksConcurrencyTest006(0);
- }],
- ['Hks_Concurrency_Test_00700', function() {
- hksConcurrencyTest007();
- }],
- ['Hks_Concurrency_Test_00800', function() {
- hksConcurrencyTest008();
- }],
- ['Hks_Concurrency_Test_00900', function() {
- hksConcurrencyTest009();
- }],
- ['Hks_Concurrency_Test_01000', function() {
- hksConcurrencyTest010();
- }],
- ['Hks_Concurrency_Test_01100', function() {
- hksConcurrencyTest011(0);
- }],
- ['Hks_Concurrency_Test_01200', function() {
- hksConcurrencyTest012();
- }],
- ['Hks_Concurrency_Test_01300', function() {
- hksConcurrencyTest013(0);
- }],
- ['Hks_Concurrency_Test_01400', function() {
- hksConcurrencyTest014();
- }],
- ['Hks_Concurrency_Test_01500', function() {
- hksConcurrencyTest015(0);
- }],
- ['Hks_Concurrency_Test_01600', function() {
- hksConcurrencyTest016();
- }],
- ['Hks_Concurrency_Test_01700', function() {
- hksConcurrencyTest017(0);
- }],
- ['Hks_Concurrency_Test_01800', function() {
- hksConcurrencyTest018();
- }],
- ['Hks_Concurrency_Test_01900', function() {
- hksConcurrencyTest019(0);
- }],
- ['Hks_Concurrency_Test_02000', function() {
- hksConcurrencyTest020();
- }],
- ['Hks_Concurrency_Test_02100', function() {
- hksConcurrencyTest021(0);
- }]
-]);
-
-parentPort.onmessage = function(data) {
- var caseId = data.data.value;
- var testFunction = actionMap.get(caseId);
- if (testFunction != null) {
- testFunction();
- } else {
- console.log ('hksConcurrencyTest default check:' + caseId);
- parentPort.postMessage (failStr);
- }
-};
-
-async function hksConcurrencyTest001() {
- for (let index = 0;index < loop; index ++) {
- console.log('hksConcurrencyTest001 running index: ' + index);
- var result = await hks.generateKey('alias001', generateKeyOption);
- if (result.errorCode != hks.HksErrorCode.HKS_SUCCESS) {
- console.log('hksConcurrencyTest001 fail detail ' + JSON.stringify(result));
- parentPort.postMessage(failStr);
- }
- }
- parentPort.postMessage(successStr);
-};
-
-function hksConcurrencyTest002(index) {
- console.log('hksConcurrencyTest002 running index: ' + index);
- hks.generateKey('alias002', generateKeyOption, function(err, data) {
- if (data.errorCode == hks.HksErrorCode.HKS_SUCCESS) {
- if (index < loop) {
- index ++;
- hksConcurrencyTest002(index);
- } else {
- parentPort.postMessage(successStr);
- }
- } else {
- console.log('hksConcurrencyTest002 fail detail ' + JSON.stringify(data));
- }
- });
-};
-
-async function hksConcurrencyTest003() {
- for (let index = 0;index < loop; index ++) {
- console.log('hksConcurrencyTest003 running index: ' + index);
- var result = await hks.deleteKey('alias003', emptyOption);
- if (result.errorCode != hks.HksErrorCode.HKS_SUCCESS && result.errorCode != hks.HksErrorCode.HKS_ERROR_NOT_EXIST) {
- console.log('hksConcurrencyTest003 fail detail ' + JSON.stringify(result));
- parentPort.postMessage(failStr);
- }
- }
- parentPort.postMessage(successStr);
-};
-
-function hksConcurrencyTest004(index) {
- console.log('hksConcurrencyTest004 running index: ' + index);
- hks.deleteKey('alias004', emptyOption, function(err, data) {
- if (data.errorCode != hks.HksErrorCode.HKS_SUCCESS && data.errorCode != hks.HksErrorCode.HKS_ERROR_NOT_EXIST) {
- console.log('hksConcurrencyTest004 fail detail ' + JSON.stringify(data));
- } else {
- if (index < loop) {
- index ++;
- hksConcurrencyTest004(index);
- } else {
- parentPort.postMessage(successStr);
- }
- }
- });
-};
-
-async function hksConcurrencyTest005() {
- for (let index = 0;index < loop; index ++) {
- console.log('hksConcurrencyTest005 running index: ' + index);
- var encryptResult = await hks.encrypt('alias005', encryptAesOpt);
- var decryptOption = makeEncryptAndDecryptOption(
- hks.HksKeyAlg.HKS_ALG_AES,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- encryptResult.outData
- );
- var decryptResult = await hks.decrypt('alias005', decryptOption);
- if (encryptResult.errorCode != hks.HksErrorCode.HKS_SUCCESS ||
- decryptResult.errorCode != hks.HksErrorCode.HKS_SUCCESS ||
- JSON.stringify(plainText) != JSON.stringify(decryptResult.outData)) {
- console.log('hksConcurrencyTest005 fail encrypt detail ' + JSON.stringify(encryptResult));
- console.log('hksConcurrencyTest005 fail decrypt detail ' + JSON.stringify(encryptResult));
- parentPort.postMessage(failStr);
- }
- }
- parentPort.postMessage(successStr);
-};
-
-function hksConcurrencyTest006(index) {
- console.log('hksConcurrencyTest006 running index: ' + index);
- hks.encrypt('alias006', encryptAesOpt, function(err, data) {
- if (data.errorCode == hks.HksErrorCode.HKS_SUCCESS) {
- var decryptOption = makeEncryptAndDecryptOption(
- hks.HksKeyAlg.HKS_ALG_AES,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- data.outData
- );
- decryptCallback(index, decryptOption);
- } else {
- console.log('hksConcurrencyTest006 fail detail ' + JSON.stringify(data));
- }
- });
-};
-
-function decryptCallback(index, decryptOption) {
- hks.decrypt('alias006', decryptOption, function(err, data) {
- if (data.errorCode != hks.HksErrorCode.HKS_SUCCESS || JSON.stringify(data.outData) != JSON.stringify(plainText)) {
- parentPort.postMessage(failStr);
- } else {
- if (index < loop) {
- index ++;
- hksConcurrencyTest006();
- } else {
- parentPort.postMessage(successStr);
- }
- }
- });
-};
-
-async function hksConcurrencyTest007() {
- var sdkVersion = '';
- for (let index = 0;index < loop; index ++) {
- console.log('hksConcurrencyTest007 running index: ' + index);
- sdkVersion = await hks.getSdkVersion(emptyOption);
- if (sdkVersion.length == 0) {
- parentPort.postMessage(failStr);
- }
- }
- parentPort.postMessage(successStr);
-};
-
-async function hksConcurrencyTest008() {
- var exportKeyResult = await hks.exportKey(aliasA, emptyOption);
- var importKeyOption = makeImportOption(
- hks.HksKeyAlg.HKS_ALG_RSA,
- hks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksCipherMode.HKS_MODE_ECB,
- hks.HksKeyDigest.HKS_DIGEST_NONE,
- exportKeyResult.outData
- );
- for (let index = 0;index < loop; index ++) {
- var importKeyResult = await hks.importKey('alias008', importKeyOption);
- if (importKeyResult.errorCode != hks.HksErrorCode.HKS_SUCCESS) {
- parentPort.postMessage(failStr);
- }
- }
- parentPort.postMessage(successStr);
-};
-
-function importKeyCallback(index, importKeyOption) {
- hks.importKey('alias009', importKeyOption, function(err, data) {
- if (data.errorCode == hks.HksErrorCode.HKS_SUCCESS) {
- if (index < loop) {
- index ++;
- importKeyCallback(index, importKeyOption);
- } else {
- parentPort.postMessage(successStr);
- }
- } else {
- parentPort.postMessage(failStr);
- }
- });
-};
-
-async function hksConcurrencyTest009() {
- var exportKeyResult = await hks.exportKey(aliasA, emptyOption);
- var importKeyOption = makeImportOption(
- hks.HksKeyAlg.HKS_ALG_RSA,
- hks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksCipherMode.HKS_MODE_ECB,
- hks.HksKeyDigest.HKS_DIGEST_NONE,
- exportKeyResult.outData
- );
- importKeyCallback(0, importKeyOption);
-};
-
-async function hksConcurrencyTest010() {
- for (let index = 0;index < loop; index ++) {
- var exportKeyResult = await hks.exportKey('alias010', emptyOption);
- if (exportKeyResult.errorCode != hks.HksErrorCode.HKS_SUCCESS) {
- parentPort.postMessage(failStr);
- }
- }
- parentPort.postMessage(successStr);
-};
-
-function hksConcurrencyTest011(index) {
- hks.exportKey('alias011', emptyOption, function(err, data) {
- if (data.errorCode == hks.HksErrorCode.HKS_SUCCESS) {
- if (index < loop) {
- index ++;
- hksConcurrencyTest011(index);
- } else {
- parentPort.postMessage(successStr);
- }
- } else {
- parentPort.postMessage(failStr);
- }
- });
-};
-
-async function hksConcurrencyTest012() {
- for (let index = 0;index < loop; index ++) {
- var getKeyPropertiesResult = await hks.getKeyProperties('alias012', emptyOption);
- if (getKeyPropertiesResult.errorCode != hks.HksErrorCode.HKS_SUCCESS) {
- parentPort.postMessage(failStr);
- }
- }
- parentPort.postMessage(successStr);
-};
-
-function hksConcurrencyTest013(index) {
- hks.getKeyProperties('alias013', emptyOption, function(err, data) {
- if (data.errorCode == hks.HksErrorCode.HKS_SUCCESS) {
- if (index < loop) {
- index ++;
- hksConcurrencyTest013(index);
- } else {
- parentPort.postMessage(successStr);
- }
- } else {
- parentPort.postMessage(failStr);
- }
- });
-};
-
-async function hksConcurrencyTest014() {
- for (let index = 0;index < loop; index ++) {
- var isKeyExist = await hks.isKeyExist('alias014', emptyOption);
- if (!isKeyExist) {
- parentPort.postMessage(failStr);
- }
- }
- parentPort.postMessage(successStr);
-};
-
-function hksConcurrencyTest015(index) {
- hks.isKeyExist('alias015', emptyOption, function(err, data) {
- if (data) {
- if (index < loop) {
- index ++;
- hksConcurrencyTest015(index);
- } else {
- parentPort.postMessage(successStr);
- }
- } else {
- parentPort.postMessage(failStr);
- }
- });
-};
-
-async function hksConcurrencyTest016() {
- for (let index = 0;index < loop; index ++) {
- var signRet = await hks.sign('alias016', signOption);
- var verifyRet = await hks.verify('alias016', verifyOption, signRet.outData);
- if (signRet.errorCode != hks.HksErrorCode.HKS_SUCCESS || verifyRet.errorCode != hks.HksErrorCode.HKS_SUCCESS) {
- parentPort.postMessage(failStr);
- }
- }
- parentPort.postMessage(successStr);
-};
-
-function verifyCallback(index, signedData) {
- hks.verify('alias017', verifyOption, signedData, function(err, data) {
- if (data.errorCode == hks.HksErrorCode.HKS_SUCCESS) {
- if (index < loop) {
- index ++;
- hksConcurrencyTest017(index);
- } else {
- parentPort.postMessage(successStr);
- }
- } else {
- parentPort.postMessage(failStr);
- }
- });
-}
-
-function hksConcurrencyTest017(index) {
- hks.sign('alias017', signOption, function(err, data) {
- if (data.errorCode == hks.HksErrorCode.HKS_SUCCESS) {
- verifyCallback(index, data.outData);
- } else {
- parentPort.postMessage(failStr);
- }
- });
-};
-
-async function hksConcurrencyTest018() {
- var exportKeyAResult = await hks.exportKey(aliasA, emptyOption);
- var exportKeyBResult = await hks.exportKey(aliasB, emptyOption);
- var agreeKeyBOption = makeAgreeOption(exportKeyAResult.outData);
- var agreeKeyAOption = makeAgreeOption(exportKeyBResult.outData);
- for (let index = 0; index < loop; index ++) {
- var agreeKeyAResult = await hks.agreeKey(aliasA, agreeKeyAOption);
- var agreeKeyBResult = await hks.agreeKey(aliasB, agreeKeyBOption);
- if (agreeKeyAResult.errorCode != hks.HksErrorCode.HKS_SUCCESS ||
- agreeKeyBResult.errorCode != hks.HksErrorCode.HKS_SUCCESS ||
- JSON.stringify(agreeKeyAResult.outData) != JSON.stringify(agreeKeyBResult.outData)) {
- parentPort.postMessage(failStr);
- }
- }
- parentPort.postMessage(successStr);
-};
-
-function agreeKeyCallback(index, option, key) {
- hks.agreeKey(aliasB, option, function(err, data) {
- if (data.errorCode == hks.HksErrorCode.HKS_SUCCESS
- && JSON.stringify(key.outData) == JSON.stringify(data.outData)) {
- if (index < loop) {
- index ++;
- hksConcurrencyTest019(index);
- } else {
- parentPort.postMessage(successStr);
- }
- } else {
- parentPort.postMessage(failStr);
- }
- });
-};
-
-async function hksConcurrencyTest019(index) {
- var exportKeyAResult = await hks.exportKey(aliasA, emptyOption);
- var exportKeyBResult = await hks.exportKey(aliasB, emptyOption);
- var agreeKeyBOption = makeAgreeOption(exportKeyAResult.outData);
- var agreeKeyAOption = makeAgreeOption(exportKeyBResult.outData);
- hks.agreeKey(aliasA, agreeKeyAOption, function(err, data) {
- if (data.errorCode == hks.HksErrorCode.HKS_SUCCESS) {
- agreeKeyCallback(index, agreeKeyBOption, data);
- } else {
- parentPort.postMessage(failStr);
- }
- });
-};
-
-async function hksConcurrencyTest020() {
- for (let index = 0; index < loop; index ++) {
- var macResult = await hks.mac('alias020', macOption);
- if (macResult.errorCode != hks.HksErrorCode.HKS_SUCCESS) {
- parentPort.postMessage(failStr);
- }
- }
- parentPort.postMessage(successStr);
-};
-
-function hksConcurrencyTest021(index) {
- hks.mac('alias021', macOption, function(err, data) {
- if (data.errorCode == hks.HksErrorCode.HKS_SUCCESS) {
- if (index < loop) {
- index ++;
- hksConcurrencyTest021(index);
- } else {
- parentPort.postMessage(successStr);
- }
- } else {
- parentPort.postMessage(failStr);
- }
- });
-};
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/resources/base/element/string.json b/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index c0dd3a09e5dcefc69f22b5e00e92296f1c3f55a5..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "entry_MainAbility",
- "value": "entry_MainAbility"
- },
- {
- "name": "mainability_description",
- "value": "JS_Empty Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/resources/base/media/icon.png b/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/resources/base/media/icon.png
deleted file mode 100644
index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000
Binary files a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/resources/base/media/icon.png and /dev/null differ
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/test/hks_common.test.js b/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/test/hks_common.test.js
deleted file mode 100644
index fa0cd0710245a61a2e87bb15bcdf4e18772836d5..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/test/hks_common.test.js
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import hks from '@ohos.security.huks'
-
-export var useLib = 'openssl';
-
-export var loop = 50;
-
-export var successStr = 'SUCCESS';
-
-export var failStr = 'FAIL';
-
-export var emptyOption = makeEmptyOption ();
-
-export var aliasA = 'aliasA';
-
-export var aliasB = 'aliasB';
-
-export function makeGenerateKeyOption (alg, size, purpose, padding, mode, digest) {
- var properties = new Array();
- properties[0] = makeAlgTagProperty (alg);
- properties[1] = makeSizeProperty (size);
- properties[2] = makePurposeProperty (purpose);
- if (purpose == (hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT)) {
- properties[3] = makePaddingProperty (padding);
- properties[4] = makeModeProperty (mode);
- if (alg == hks.HksKeyAlg.HKS_ALG_RSA) {
- properties[5] = makeDigestProperty (digest);
- properties[6] = makeKeyGenerateType ();
- }
- } else if (purpose == (hks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | hks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY)) {
- properties[3] = makePaddingProperty (padding);
- properties[4] = makeDigestProperty (digest);
- } else if (purpose == hks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC) {
- properties[3] = makeDigestProperty (digest);
- properties[4] = makeKeyType ();
- } else {
- properties[3] = makeDigestProperty (digest);
- }
- var option = {
- properties: properties
- };
- return option;
-};
-
-export function makeEncryptAndDecryptOption (alg, purpose, padding, mode, size, digest, text) {
- var properties = new Array();
- properties[0] = makeAlgTagProperty (alg);
- properties[1] = makePurposeProperty (purpose);
- properties[2] = makePaddingProperty (padding);
- properties[3] = makeModeProperty (mode);
- if (alg == hks.HksKeyAlg.HKS_ALG_AES || alg == hks.HksKeyAlg.HKS_ALG_HMAC) {
- properties[4] = makeIV ();
- } else if (alg == hks.HksKeyAlg.HKS_ALG_RSA) {
- properties[4] = makeIsKeyAlias ();
- properties[5] = makeSizeProperty (size);
- properties[6] = makeDigestProperty (digest);
- }
- var option = {
- properties: properties,
- inData: text
- };
- return option;
-};
-
-export function makeImportOption (alg, size, purpose, padding, mode, digest, publicKey) {
- var properties = new Array();
- properties[0] = makeAlgTagProperty (alg);
- properties[1] = makeSizeProperty (size);
- properties[2] = makePurposeProperty (purpose);
- properties[3] = makePaddingProperty (padding);
- if (alg == hks.HksKeyAlg.HKS_ALG_RSA || alg == hks.HksKeyAlg.HKS_ALG_DSA || alg == hks.HksKeyAlg.HKS_ALG_ECC) {
- if (purpose == (hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT)) {
- properties[4] = makeModeProperty (mode);
- properties[5] = makeDigestProperty (digest);
- properties[6] = makeKeyGenerateType ();
- } else {
- properties[4] = makeDigestProperty (digest);
- }
- }
- var option = {
- properties: properties,
- inData: publicKey
- };
- return option;
-};
-
-export function makeRandomArr (size) {
- var arr = new Uint8Array( size);
- for (var i = 0; i < size; i ++) {
- arr[i] = Math.floor (Math.random () * 10);
- }
- return arr;
-};
-
-export function makeAgreeOption (publicKey) {
- var properties = new Array();
- properties[0] = {
- tag: hks.HksTag.HKS_TAG_ALGORITHM,
- value: hks.HksKeyAlg.HKS_ALG_ECDH
- };
- properties[1] = {
- tag: hks.HksTag.HKS_TAG_KEY_SIZE,
- value: hks.HksKeySize.HKS_ECC_KEY_SIZE_224
- };
- var options = {
- properties: properties,
- inData: publicKey
- };
- return options;
-};
-
-export function makeSignAndVerifyOption (alg, size, purpose, padding, digest, text) {
- var properties = new Array();
- properties[0] = makeAlgTagProperty (alg);
- properties[1] = makeSizeProperty (size);
- properties[2] = makePurposeProperty (purpose);
- properties[3] = makePaddingProperty (padding);
- properties[4] = makeDigestProperty (digest);
- var option = {
- properties: properties,
- inData: text
- };
- return option;
-};
-
-export function makeMacOption (plaintText) {
- var properties = new Array();
- properties[0] = {
- tag: hks.HksTag.HKS_TAG_ALGORITHM,
- value: hks.HksKeyAlg.HKS_ALG_HMAC
- };
- properties[1] = {
- tag: hks.HksTag.HKS_TAG_PURPOSE,
- value: hks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC
- };
- properties[2] = {
- tag: hks.HksTag.HKS_TAG_DIGEST,
- value: hks.HksKeyDigest.HKS_DIGEST_SHA1
- };
- properties[3] = {
- tag: hks.HksTag.HKS_TAG_KEY_TYPE,
- value: hks.HksKeyType.HKS_KEY_TYPE_HMAC
- };
- properties[4] = {
- tag: hks.HksTag.HKS_TAG_KEY_SIZE,
- value: 160
- };
- properties[5] = {
- tag: hks.HksTag.HKS_TAG_IV,
- value: new Uint8Array( 16)
- };
- var options = {
- properties: properties,
- inData: plaintText
- };
- return options;
-};
-
-function makeAlgTagProperty (alg) {
- var property = {
- tag: hks.HksTag.HKS_TAG_ALGORITHM,
- value: alg
- }
- return property;
-};
-
-function makeSizeProperty (size) {
- var property = {
- tag: hks.HksTag.HKS_TAG_KEY_SIZE,
- value: size
- };
- return property;
-};
-
-function makePurposeProperty (purpose) {
- var property = {
- tag: hks.HksTag.HKS_TAG_PURPOSE,
- value: purpose
- };
- return property;
-};
-
-function makePaddingProperty (padding) {
- var property = {
- tag: hks.HksTag.HKS_TAG_PADDING,
- value: padding
- };
- return property;
-};
-
-function makeModeProperty (mode) {
- var property = {
- tag: hks.HksTag.HKS_TAG_BLOCK_MODE,
- value: mode
- };
- return property;
-};
-
-function makeDigestProperty (digest) {
- var property = {
- tag: hks.HksTag.HKS_TAG_DIGEST,
- value: digest
- };
- return property;
-};
-
-function makeKeyGenerateType () {
- var property = {
- tag: hks.HksTag.HKS_TAG_KEY_GENERATE_TYPE,
- value: hks.HksKeyGenerateType.HKS_KEY_GENERATE_TYPE_DEFAULT
- };
- return property;
-};
-
-function makeKeyType () {
- var property = {
- tag: hks.HksTag.HKS_TAG_KEY_TYPE,
- value: hks.HksKeyType.HKS_KEY_TYPE_HMAC
- };
- return property;
-};
-
-function makeIV () {
- var property = {
- tag: hks.HksTag.HKS_TAG_IV,
- value: new Uint8Array( 16)
- };
- return property;
-};
-
-function makeIsKeyAlias () {
- var property = {
- tag: hks.HksTag.HKS_TAG_IS_KEY_ALIAS,
- value: true
- };
- return property;
-};
-
-function makeEmptyOption () {
- var emptyOption = {
- properties: []
- };
- return emptyOption;
-};
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/test/hks_xts_concurrency.test.js b/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/test/hks_xts_concurrency.test.js
deleted file mode 100644
index e42b98ada1500365c2f2bbbd3a4852488af7bc1e..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksConcurrencyTest/entry/src/main/js/test/hks_xts_concurrency.test.js
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import worker from '@ohos.worker';
-import hks from '@ohos.security.huks';
-import {describe, it, expect} from 'deccjsunit/index'
-import {
- aliasA,
- aliasB,
- emptyOption,
- successStr,
- failStr,
- makeGenerateKeyOption
-} from './hks_common.test.js';
-
-var generateAes128KeyOpt = makeGenerateKeyOption (
- hks.HksKeyAlg.HKS_ALG_AES,
- hks.HksKeySize.HKS_AES_KEY_SIZE_128,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksCipherMode.HKS_MODE_CBC
-);
-
-var generateRsa512KeyOpt = makeGenerateKeyOption (
- hks.HksKeyAlg.HKS_ALG_RSA,
- hks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- hks.HksCipherMode.HKS_MODE_ECB,
- hks.HksKeyDigest.HKS_DIGEST_NONE
-);
-
-var generateEcc224Opt = makeGenerateKeyOption (
- hks.HksKeyAlg.HKS_ALG_ECC,
- hks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | hks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- hks.HksKeyPadding.HKS_PADDING_NONE,
- null,
- hks.HksKeyDigest.HKS_DIGEST_NONE
-);
-
-var generateAgreeKeyOption = makeGenerateKeyOption (
- hks.HksKeyAlg.HKS_ALG_ECC,
- hks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
- null,
- null,
- hks.HksKeyDigest.HKS_DIGEST_NONE
-);
-
-var generateMacKeyOption = makeGenerateKeyOption (
- hks.HksKeyAlg.HKS_ALG_HMAC,
- 160,
- hks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC,
- null,
- null,
- hks.HksKeyDigest.HKS_DIGEST_SHA1
-);
-
-describe ('HKS_XTS_CONCURRENCY', function () {
- var worker1 = new worker.Worker( "workers/worker.js");
- var worker2 = new worker.Worker( "workers/worker.js");
- var workerStatus1 = false;
- var workerStatus2 = false;
-
- function doConcurrencyTest (caseId, done) {
- workerStatus1 = false;
- workerStatus2 = false;
- worker1.onmessage = function (data) {
- workerStatus1 = true;
- console.log (caseId + ' worker1.onMessage ' + JSON.stringify (data));
- expect (data.data).assertEqual (successStr);
- doClear (caseId, done);
- };
- worker2.onmessage = function (data) {
- workerStatus2 = true;
- console.log (caseId + ' worker2.onMessage ' + JSON.stringify (data));
- expect (data.data).assertEqual (successStr);
- doClear (caseId, done);
- };
- var obj = { type: 'normal', value: caseId };
- worker1.postMessage (obj);
- worker2.postMessage (obj);
- };
-
-var clearActionMap = new Map([
- ['Hks_Concurrency_Test_00100', async function() {
- await hks.deleteKey ('alias001', emptyOption);
- }],
- ['Hks_Concurrency_Test_00200', async function() {
- await hks.deleteKey ('alias002', emptyOption);
- }],
- ['Hks_Concurrency_Test_00300', async function() {
- await hks.deleteKey ('alias003', emptyOption);
- }],
- ['Hks_Concurrency_Test_00400', async function() {
- await hks.deleteKey ('alias004', emptyOption);
- }],
- ['Hks_Concurrency_Test_00500', async function() {
- await hks.deleteKey ('alias005', emptyOption);
- }],
- ['Hks_Concurrency_Test_00600', async function() {
- await hks.deleteKey ('alias006', emptyOption);
- }],
- ['Hks_Concurrency_Test_00800', async function() {
- await hks.deleteKey (aliasA, emptyOption);
- await hks.deleteKey ('alias008', emptyOption);
- }],
- ['Hks_Concurrency_Test_00900', async function() {
- await hks.deleteKey (aliasA, emptyOption);
- await hks.deleteKey ('alias009', emptyOption);
- }],
- ['Hks_Concurrency_Test_01000', async function() {
- await hks.deleteKey ('alias010', emptyOption);
- }],
- ['Hks_Concurrency_Test_01100', async function() {
- await hks.deleteKey ('alias011', emptyOption);
- }],
- ['Hks_Concurrency_Test_01200', async function() {
- await hks.deleteKey ('alias012', emptyOption);
- }],
- ['Hks_Concurrency_Test_01300', async function() {
- await hks.deleteKey ('alias013', emptyOption);
- }],
- ['Hks_Concurrency_Test_01400', async function() {
- await hks.deleteKey ('alias014', emptyOption);
- }],
- ['Hks_Concurrency_Test_01500', async function() {
- await hks.deleteKey ('alias015', emptyOption);
- }],
- ['Hks_Concurrency_Test_01600', async function() {
- await hks.deleteKey ('alias016', emptyOption);
- }],
- ['Hks_Concurrency_Test_01700', async function() {
- await hks.deleteKey ('alias017', emptyOption);
- }],
- ['Hks_Concurrency_Test_01800', async function() {
- await hks.deleteKey (aliasA, emptyOption);
- await hks.deleteKey (aliasB, emptyOption);
- }],
- ['Hks_Concurrency_Test_01900', async function() {
- await hks.deleteKey (aliasA, emptyOption);
- await hks.deleteKey (aliasB, emptyOption);
- }],
- ['Hks_Concurrency_Test_02000', async function() {
- await hks.deleteKey ('alias020', emptyOption);
- }],
- ['Hks_Concurrency_Test_02100', async function() {
- await hks.deleteKey ('alias021', emptyOption);
- }]
-]);
-
-
- async function doClear (caseId, done) {
- if (workerStatus1 && workerStatus2) {
- var testFunction = clearActionMap.get(caseId);
- if (testFunction != null) {
- testFunction();
- } else {
- console.log ('hksConcurrencyTest default check:' + caseId);
- }
- done();
- }
- }
-
- /**
- * @tc.number HUKS_Concurrency_Test_00100
- * @tc.name Concurrency_Test_GenerateKey_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_00100', 0, async function (done) {
- doConcurrencyTest ('Hks_Concurrency_Test_00100', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00200
- * @tc.name Concurrency_Test_GenerateKey_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_00200', 0, async function (done) {
- doConcurrencyTest ('Hks_Concurrency_Test_00200', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00300
- * @tc.name Concurrency_Test_DeleteKey_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_00300', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias003', generateAes128KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_00300', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00400
- * @tc.name Concurrency_Test_DeleteKey_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_00400', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias004', generateAes128KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_00400', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00500
- * @tc.name Concurrency_Test_Encrypt_Decrypt_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_00500', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias005', generateAes128KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_00500', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00600
- * @tc.name Concurrency_Test_Encrypt_Decrypt_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_00600', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias006', generateAes128KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_00600', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00700
- * @tc.name Concurrency_Test_GetSdkVersion
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_00700', 0, async function (done) {
- doConcurrencyTest ('Hks_Concurrency_Test_00700', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00800
- * @tc.name Concurrency_Test_ImportKey_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_00800', 0, async function (done) {
- var generateKeyResult = await hks.generateKey (aliasA, generateRsa512KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_00800', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_00900
- * @tc.name Concurrency_Test_ImportKey_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_00900', 0, async function (done) {
- var generateKeyResult = await hks.generateKey (aliasA, generateRsa512KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_00900', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01000
- * @tc.name Concurrency_Test_ExportKey_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_01000', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias010', generateRsa512KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_01000', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01100
- * @tc.name Concurrency_Test_ExportKey_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_01100', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias011', generateRsa512KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_01100', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01200
- * @tc.name Concurrency_Test_GetKeyProperties_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_01200', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias012', generateRsa512KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_01200', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01300
- * @tc.name Concurrency_Test_GetKeyProperties_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_01300', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias013', generateRsa512KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_01300', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01400
- * @tc.name Concurrency_Test_IsKeyExist_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_01400', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias014', generateRsa512KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_01400', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01500
- * @tc.name Concurrency_Test_IsKeyExist_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_01500', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias015', generateRsa512KeyOpt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_01500', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01600
- * @tc.name Concurrency_Test_Sign_Verify_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_01600', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias016', generateEcc224Opt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_01600', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01700
- * @tc.name Concurrency_Test_Sign_Verify_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_01700', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias017', generateEcc224Opt);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_01700', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01800
- * @tc.name Concurrency_Test_Agree_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_01800', 0, async function (done) {
- var generateKeyResult = await hks.generateKey (aliasA, generateAgreeKeyOption);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- generateKeyResult = await hks.generateKey (aliasB, generateAgreeKeyOption);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_01800', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_01900
- * @tc.name Concurrency_Test_Agree_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_01900', 0, async function (done) {
- var generateKeyResult = await hks.generateKey (aliasA, generateAgreeKeyOption);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- generateKeyResult = await hks.generateKey (aliasB, generateAgreeKeyOption);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_01900', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_02000
- * @tc.name Concurrency_Test_Mac_Promise
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_02000', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias020', generateMacKeyOption);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_02000', done);
- });
-
- /**
- * @tc.number HUKS_Concurrency_Test_02100
- * @tc.name Concurrency_Test_Mac_Callback
- * @tc.desc Test for APP Concurrency.
- */
- it ('Hks_Concurrency_Test_02100', 0, async function (done) {
- var generateKeyResult = await hks.generateKey ('alias021', generateMacKeyOption);
- expect (generateKeyResult.errorCode).assertEqual (hks.HksErrorCode.HKS_SUCCESS);
- doConcurrencyTest ('Hks_Concurrency_Test_02100', done);
- });
-});
\ No newline at end of file
diff --git a/security/huks_standard/HuksConcurrencyTest/signature/openharmony_sx.p7b b/security/huks_standard/HuksConcurrencyTest/signature/openharmony_sx.p7b
deleted file mode 100644
index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000
Binary files a/security/huks_standard/HuksConcurrencyTest/signature/openharmony_sx.p7b and /dev/null differ
diff --git a/security/huks_standard/HuksJSTimingTest/BUILD.gn b/security/huks_standard/HuksJSTimingTest/BUILD.gn
deleted file mode 100644
index c2d2c216a2828ae4e82699dcf2f8d9cc2abd2a53..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksJSTimingTest/BUILD.gn
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//test/xts/tools/build/suite.gni")
-
-ohos_js_hap_suite("ActsHuksJSTimingTest") {
- hap_profile = "./entry/src/main/config.json"
- deps = [
- ":hjs_demo_js_assets",
- ":hjs_demo_resources",
- ]
- certificate_profile = "./signature/openharmony_sx.p7b"
- hap_name = "ActsHuksJSTimingTest"
-}
-ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
-}
-ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
-}
diff --git a/security/huks_standard/HuksJSTimingTest/Test.json b/security/huks_standard/HuksJSTimingTest/Test.json
deleted file mode 100644
index 57d38cf77494b9a9245012f0e8577349116d6104..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksJSTimingTest/Test.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "description": "Configuration for js timing test",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "900000",
- "package": "com.example.huksjstiming",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsHuksJSTimingTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
diff --git a/security/huks_standard/HuksJSTimingTest/entry/src/main/config.json b/security/huks_standard/HuksJSTimingTest/entry/src/main/config.json
deleted file mode 100644
index 63918027e5d185a5c1bbf3dccab54cd00ce84b14..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksJSTimingTest/entry/src/main/config.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "app": {
- "bundleName": "com.example.huksjstiming",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Beta1"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.huksjstiming",
- "name": ".MyApplication",
- "mainAbility": "com.example.huksjstiming.MainAbility",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": true
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.huksjstiming.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:entry_MainAbility",
- "type": "page",
- "launchType": "singleton",
- "visible": true,
- "isVisible": "true"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": true
- }
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/app.js b/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/app.js
deleted file mode 100644
index 14ca792625c50b934e7bda87ac333d3414dc12bd..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/app.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export default {
- onCreate() {
- console.info('AceApplication onCreate');
- },
- onDestroy() {
- console.info('AceApplication onDestroy');
- }
-};
diff --git a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/i18n/en-US.json b/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/i18n/en-US.json
deleted file mode 100644
index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/i18n/en-US.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/i18n/zh-CN.json b/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/i18n/zh-CN.json
deleted file mode 100644
index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/i18n/zh-CN.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/pages/index/index.css b/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index 2b1965821483f4f8c8b97c86ef07fe87ea767d01..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,44 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 40px;
- color: #000000;
- opacity: 0.9;
-}
-
-@media screen and (device-type: tablet) and (orientation: landscape) {
- .title {
- font-size: 100px;
- }
-}
-
-@media screen and (device-type: wearable) {
- .title {
- font-size: 28px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: tv) {
- .container {
- background-image: url("../../common/images/Wallpaper.png");
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center;
- }
-
- .title {
- font-size: 100px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: phone) and (orientation: landscape) {
- .title {
- font-size: 60px;
- }
-}
diff --git a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/pages/index/index.hml b/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/pages/index/index.hml
deleted file mode 100644
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
diff --git a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/pages/index/index.js b/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index a0457e9be7a71d79855ee6fc1b1cd96b7d7f452b..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import file from '@system.file';
-import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index';
-
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
-
- onShow() {
- this.title = 'JSAPI_1000';
- const core = Core.getInstance();
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- });
- const reportExtend = new ReportExtend(file);
- core.addService('expect', expectExtend);
- core.addService('report', reportExtend);
- core.init();
- const configService = core.getDefaultService('config');
- this.timeout = 5000000;
- configService.setConfig(this);
- require('../../../test/hks_jsApi_timing.test.js');
- core.execute();
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/resources/base/element/string.json b/security/huks_standard/HuksJSTimingTest/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index c0dd3a09e5dcefc69f22b5e00e92296f1c3f55a5..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "entry_MainAbility",
- "value": "entry_MainAbility"
- },
- {
- "name": "mainability_description",
- "value": "JS_Empty Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/resources/base/media/icon.png b/security/huks_standard/HuksJSTimingTest/entry/src/main/js/resources/base/media/icon.png
deleted file mode 100644
index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000
Binary files a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/resources/base/media/icon.png and /dev/null differ
diff --git a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/test/hks_jsApi_timing.test.js b/security/huks_standard/HuksJSTimingTest/entry/src/main/js/test/hks_jsApi_timing.test.js
deleted file mode 100644
index 22d8ed60443613291ff5fab55df361b51e3c57bc..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksJSTimingTest/entry/src/main/js/test/hks_jsApi_timing.test.js
+++ /dev/null
@@ -1,1239 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import huks from '@ohos.security.huks'
-import {describe, it, expect} from 'deccjsunit/index'
-
-describe('HKS_JSAPI_TIMING', function () {
-
- var loop = 1000;
-
- var emptyOption = makeEmptyOptions();
-
- var sumGenerateKeyTiming = 0;
- var sumDeleteKeyTiming = 0;
- var sumGetKeyPropertiesTiming = 0;
- var sumExportTiming = 0;
- var sumImportTiming = 0;
- var sumEncryptTiming = 0;
- var sumDecryptTiming = 0;
- var cipherTextArr = new Array();
- var sumIsKeyExistTiming = 0;
- var sumSignTiming = 0;
- var sumVerifyTiming = 0;
- var defaultAliasA = 'defaultAliasA';
- var defaultAliasB = 'defaultAliasB';
- var signedText = [];
- var publicKey = [];
- var sumAgreeTiming = 0;
- var sumDeriveKeyTiming = 0;
- var sumMacTiming = 0;
- var geAesKeyProperties = makeAesKeyOption();
-
- function makeEmptyOptions() {
- var emptyOptions = {
- properties: []
- };
- return emptyOptions;
- };
-
- function makeGenerateRSAKeyOptions() {
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_RSA
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: huks.HksKeySize.HKS_RSA_KEY_SIZE_512
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_MD5
- };
- var options = {
- properties: properties
- };
- return options;
- };
-
- function makeAesKeyOption(){
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_AES
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: huks.HksKeySize.HKS_AES_KEY_SIZE_128
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_NONE
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
- value: huks.HksCipherMode.HKS_MODE_CBC
- };
- return properties;
- }
-
- function makeRsaKeyOption(){
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_RSA
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: huks.HksKeySize.HKS_RSA_KEY_SIZE_512
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_NONE
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
- value: huks.HksCipherMode.HKS_MODE_ECB
- };
- properties[5] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_NONE
- };
- properties[6] = {
- tag: huks.HksTag.HKS_TAG_KEY_GENERATE_TYPE,
- value: huks.HksKeyGenerateType.HKS_KEY_GENERATE_TYPE_DEFAULT
- };
- return properties;
- }
-
- function makeEccKeyOption(){
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_ECC
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: huks.HksKeySize.HKS_ECC_KEY_SIZE_224
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_NONE
- };
- return properties;
- };
-
- function makeDriveKeyOption(){
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_AES
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: huks.HksKeySize.HKS_AES_KEY_SIZE_128
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_DERIVE
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_NONE
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
- value: huks.HksCipherMode.HKS_MODE_CBC
- };
- properties[5] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_SHA256
- };
- return properties;
- };
-
- function makeMacKeyOption(){
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_HMAC
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_SHA1
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_KEY_TYPE,
- value: huks.HksKeyType.HKS_KEY_TYPE_HMAC
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: 160
- };
- return properties;
- };
-
- function makeGenerateKeyOption(alg) {
- if (alg == huks.HksKeyAlg.HKS_ALG_AES) {
- var option = {
- properties: geAesKeyProperties
- };
- return option;
- } else if (alg == huks.HksKeyAlg.HKS_ALG_RSA){
- var option = {
- properties: makeRsaKeyOption()
- };
- return option;
- } else if (alg == huks.HksKeyAlg.HKS_ALG_ECC){
- var option = {
- properties: makeEccKeyOption()
- };
- return option;
- } else if (alg == huks.HksKeyAlg.HKS_ALG_HMAC){
- var option = {
- properties: makeMacKeyOption()
- };
- return option;
- } else if (alg == 'DERIVE_AES_KEY'){
- var option = {
- properties: makeDriveKeyOption()
- };
- return option;
- } else {
- return -1;
- }
- };
-
- function makeRandomArr(size) {
- var arr = new Uint8Array(size);
- for (var i = 0; i < size; i++) {
- arr[i] = Math.floor(Math.random() * 10);
- }
- return arr;
- };
-
- function makeEncryptOption(plainText) {
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_AES
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
- value: huks.HksCipherMode.HKS_MODE_CBC
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_NONE
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_IV,
- value: new Uint8Array(16)
- };
- var options = {
- properties: properties,
- inData: plainText
- };
- return options;
- };
-
- function makeDecryptOption(cipherText) {
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_AES,
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
- value: huks.HksCipherMode.HKS_MODE_CBC
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_NONE
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_IV,
- value: new Uint8Array(16)
- };
- var options = {
- properties: properties,
- inData: cipherText
- };
- return options;
- };
-
- function deleteKeyByAlias(alias, done) {
- huks.deleteKey(alias, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- done();
- });
- };
-
- function makeImportOption(importText) {
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_RSA
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: huks.HksKeySize.HKS_RSA_KEY_SIZE_512
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_NONE
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_BLOCK_MODE,
- value: huks.HksCipherMode.HKS_MODE_ECB
- };
- properties[5] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_NONE
- };
- properties[6] = {
- tag: huks.HksTag.HKS_TAG_KEY_GENERATE_TYPE,
- value: huks.HksKeyGenerateType.HKS_KEY_GENERATE_TYPE_DEFAULT
- };
- var options = {
- properties: properties,
- inData: importText
- };
- return options;
- };
-
- function getKeyPropertiesCallback(index, done) {
- var timestampStart = (new Date()).valueOf();
- huks.getKeyProperties('alias', emptyOption, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumGetKeyPropertiesTiming += consuming;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- index++;
- console.info('getKeyProperties callback index ' + index);
- if (index == loop) {
- var averageTimeGetProperties = sumGetKeyPropertiesTiming / loop;
- console.info('jsApi timing get key properties callback, average time: ' + averageTimeGetProperties);
- deleteKeyByAlias('alias', done);
- } else {
- getKeyPropertiesCallback(index, done);
- }
- });
- };
-
- function deleteExportAndImportKey(done) {
- huks.deleteKey('alias_', emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- deleteKeyByAlias('alias', done);
- });
- };
-
- function encryptCallback(index, encryptOption, done) {
- console.info('encrypt callback index ' + index);
- var timestampStart = (new Date()).valueOf();
- huks.encrypt('alias', encryptOption, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- console.info('encrypt callback time consuming ' + consuming);
- sumEncryptTiming += consuming;
- cipherTextArr.push(data.outData);
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- index++;
- if (index == loop) {
- var averageTimeEncrypt = sumEncryptTiming / loop;
- console.info('jsApi timing encrypt callback, average time: ' + averageTimeEncrypt);
- decryptCallback(0, done);
- } else {
- encryptCallback(index, encryptOption, done);
- }
- });
- };
-
- function decryptCallback(index, done) {
- console.info('decrypt callback index ' + index);
- var decryptOption = makeDecryptOption(cipherTextArr[index]);
- var timestampStart = (new Date()).valueOf();
- huks.decrypt('alias', decryptOption, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- console.info('decrypt callback time consuming ' + consuming);
- sumDecryptTiming += consuming;
- index++;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (index == loop) {
- var averageTimeDecrypt = sumDecryptTiming / loop;
- console.info('jsApi timing decrypt callback, average time: ' + averageTimeDecrypt);
- deleteKeyByAlias('alias', done);
- } else {
- decryptCallback(index, done);
- }
- });
- };
-
- function exportCallback(index, done) {
- console.info('export key callback index ' + index);
- var timestampStart = (new Date()).valueOf();
- huks.exportKey('alias', emptyOption, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- console.info('exportKey callback time consuming ' + consuming);
- sumExportTiming += consuming;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- console.info('exportKey callback outData ' + JSON.stringify(data));
- publicKey = data.outData;
- index++;
- importCallback(index, done);
- });
- };
-
- function importCallback(index, done) {
- console.info('import key callback index ' + index);
- var timestampStart = (new Date()).valueOf();
- var importOption = makeImportOption(publicKey);
- console.info('import callback option ' + JSON.stringify(importOption));
- huks.importKey('alias_', importOption, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- console.info('importKey callback time consuming ' + consuming);
- sumImportTiming += consuming;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- index++;
- if (index == loop) {
- var averageTimeExportKey = sumExportTiming / loop;
- console.info('jsApi timing export key callback, average time: ' + averageTimeExportKey);
- var averageTimeImportKey = sumImportTiming / loop;
- console.info('jsApi timing import key callback, average time: ' + averageTimeImportKey);
- deleteExportAndImportKey(done);
- } else {
- exportCallback(index, done);
- }
- });
- };
-
- function isKeyExistCallback(index, done) {
- console.info('isKeyExist promise index ' + index);
- var timestampStart = (new Date()).valueOf();
- huks.isKeyExist('alias', emptyOption, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumIsKeyExistTiming += consuming;
- expect(data).assertEqual(true);
- index++;
- if (index == loop) {
- var averageTimeIsKeyExist = sumIsKeyExistTiming / loop;
- console.info('jsApi timing isKeyExist callback, average time: ' + averageTimeIsKeyExist);
- deleteKeyByAlias('alias', done);
- } else {
- isKeyExistCallback(index, done)
- }
- });
- };
-
- function makeSignOptions(plainText) {
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_RSA
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: huks.HksKeySize.HKS_RSA_KEY_SIZE_512
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_MD5
- };
- var options = {
- properties: properties,
- inData: plainText
- };
- return options;
- };
-
- function makeImportOptions(importText) {
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_RSA
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: huks.HksKeySize.HKS_RSA_KEY_SIZE_512
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_MD5
- };
- var options = {
- properties: properties,
- inData: importText
- };
- return options;
- };
-
- function makeVerifyOptions(cipherText) {
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_RSA
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: huks.HksKeySize.HKS_RSA_KEY_SIZE_512
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_PADDING,
- value: huks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_MD5
- };
- var options = {
- properties: properties,
- inData: cipherText
- };
- return options;
- };
-
- function deleteAliasA(done) {
- huks.deleteKey(defaultAliasA, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- deleteAliasB(done);
- });
- };
-
- function deleteAliasB(done) {
- huks.deleteKey(defaultAliasB, emptyOption, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- done();
- });
- };
-
- function verifyCallback(index, plainText, done) {
- var timestampStart = (new Date()).valueOf();
- var verifyOptions = makeVerifyOptions(plainText);
- huks.verify(defaultAliasB, verifyOptions, signedText, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumVerifyTiming += consuming;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- index++;
- if (index == loop) {
- var averageTimeSign = sumSignTiming / loop;
- console.info('jsApi timing sign callback, average time: ' + averageTimeSign);
- var averageTimeVerify = sumVerifyTiming / loop;
- console.info('jsApi timing verify callback, average time: ' + averageTimeVerify);
- deleteAliasA(done);
- } else {
- signCallback(index, done);
- }
- });
- };
-
- function signCallback(index, done) {
- console.info('sign and verify callback index ' + index);
- var plainText = makeRandomArr(16);
- var signOptions = makeSignOptions(plainText);
- var timestampStart = (new Date()).valueOf();
- huks.sign(defaultAliasA, signOptions, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumSignTiming += consuming;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- signedText = data.outData;
- verifyCallback(index, plainText, done);
- });
- };
-
- function makeAgreeOptions(publicKey) {
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_ECDH
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: huks.HksKeySize.HKS_ECC_KEY_SIZE_224
- };
- var options = {
- properties: properties,
- inData: publicKey
- };
- return options;
- };
-
- function agreeCallback(index, option, done) {
- console.info('agree callback index ' + index);
- var timestampStart = (new Date()).valueOf();
- huks.agreeKey(defaultAliasA, option, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumAgreeTiming += consuming;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- index++;
- if (index == loop) {
- var averageTimeAgree = sumAgreeTiming / loop;
- console.info('jsApi timing agree callback, average time: ' + averageTimeAgree);
- done();
- } else {
- agreeCallback(index, option, done);
- }
- });
- };
-
- function makeHKDFDeriveOption() {
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_HKDF
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_DERIVE
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_SHA256
- };
- var options = {
- properties: properties
- };
- return options;
- };
-
- function deriveKeyCallback(index, option, done) {
- console.info('agree callback index ' + index);
- var timestampStart = (new Date()).valueOf();
- huks.deriveKey('alias', option, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumDeriveKeyTiming += consuming;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- index++;
- if (index == loop) {
- var averageTimeDeriveKey = sumDeriveKeyTiming / loop;
- console.info('jsApi timing deriveKey callback, average time: ' + averageTimeDeriveKey);
- deleteKeyByAlias('alias', done);
- } else {
- deriveKeyCallback(index, option, done);
- }
- });
- };
-
-
- function makeMacOption(plainText) {
- var properties = new Array();
- properties[0] = {
- tag: huks.HksTag.HKS_TAG_ALGORITHM,
- value: huks.HksKeyAlg.HKS_ALG_HMAC
- };
- properties[1] = {
- tag: huks.HksTag.HKS_TAG_PURPOSE,
- value: huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC
- };
- properties[2] = {
- tag: huks.HksTag.HKS_TAG_DIGEST,
- value: huks.HksKeyDigest.HKS_DIGEST_SHA1
- };
- properties[3] = {
- tag: huks.HksTag.HKS_TAG_KEY_TYPE,
- value: huks.HksKeyType.HKS_KEY_TYPE_HMAC
- };
- properties[4] = {
- tag: huks.HksTag.HKS_TAG_KEY_SIZE,
- value: 160
- };
- properties[5] = {
- tag: huks.HksTag.HKS_TAG_IV,
- value: new Uint8Array(16)
- };
- var options = {
- properties: properties,
- inData: plainText
- };
- return options;
- };
-
- function deleteKeyCallback(index, option, done) {
- var timestampStart = (new Date()).valueOf();
- huks.deleteKey('alias', emptyOption, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumDeleteKeyTiming += consuming;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- index++;
- if (index == loop) {
- var averageTimeGenKey = sumGenerateKeyTiming / loop;
- console.info('jsApi timing generateKey callback, average time: ' + averageTimeGenKey);
- var averageTimeDelKey = sumDeleteKeyTiming / loop;
- console.info('jsApi timing deleteKey callback, average time: ' + averageTimeDelKey);
- done();
- } else {
- generateKeyCallback(index, option, done)
- }
- });
- };
-
- function generateKeyCallback(index, option, done) {
- var timestampStart = (new Date()).valueOf();
- huks.generateKey('alias', option, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumGenerateKeyTiming += consuming;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- deleteKeyCallback(index, option, done);
- });
- };
-
- /**
- * @tc.number HKS_JSAPI_TIMING_00100
- * @tc.name HKS_JSAPI_TIMING_GenerateAndDeleteKey_Promise
- * @tc.desc jsApi timing test for generate key and delete key by promise
- */
- it('HKS_JSAPI_TIMING_00100', 0, async function (done) {
- var sumGenerateKeyTiming = 0;
- var sumDeleteKeyTiming = 0;
- var option = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_AES);
- for (let index = 1; index <= loop; index++) {
- console.info('generate and delete key promise index ' + index);
- var timestampStart = (new Date()).valueOf();
- var result = await huks.generateKey('alias', option);
- var timestampEnd = (new Date()).valueOf();
- expect(result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var consuming = timestampEnd - timestampStart;
- sumGenerateKeyTiming += consuming;
- timestampStart = (new Date()).valueOf();
- result = await huks.deleteKey('alias', emptyOption);
- timestampEnd = (new Date()).valueOf();
- expect(result.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- consuming = timestampEnd - timestampStart;
- sumDeleteKeyTiming += consuming;
- }
- var averageTimeGenKey = sumGenerateKeyTiming / loop;
- console.info('jsApi timing generateKey promise, average time: ' + averageTimeGenKey);
- var averageTimeDelKey = sumDeleteKeyTiming / loop;
- console.info('jsApi timing deleteKey promise, average time: ' + averageTimeDelKey);
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_00200
- * @tc.name HKS_JSAPI_TIMING_GenerateAndDeleteKey_Callback
- * @tc.desc jsApi timing test for generate key and delete key by callback
- */
- it('HKS_JSAPI_TIMING_00200', 0, async function (done) {
- sumGenerateKeyTiming = 0;
- sumDeleteKeyTiming = 0;
- var option = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_AES);
- generateKeyCallback(0, option, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_00300
- * @tc.name HKS_JSAPI_TIMING_EncryptAndDecrypt_Promise
- * @tc.desc jsApi timing test for encrypt and decrypt by promise
- */
- it('HKS_JSAPI_TIMING_00300', 0, async function (done) {
- var sumEncryptTiming = 0;
- var sumDecryptTiming = 0;
- var genKeyOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_AES);
- var genKeyRet = await huks.generateKey('alias', genKeyOption);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var plainText = makeRandomArr(64);
- var encryptOption = makeEncryptOption(plainText);
- for (let index = 1; index <= loop; index++) {
- console.info('encrypt and decrypt promise index ' + index);
- var timestampStart = (new Date()).valueOf();
- var encryptRet = await huks.encrypt('alias', encryptOption);
- expect(encryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- console.info('encrypt and decrypt promise encryptRet ' + JSON.stringify(encryptRet));
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- console.info('encrypt promise time consuming ' + consuming);
- sumEncryptTiming += consuming;
-
- var decryptOption = makeDecryptOption(encryptRet.outData);
- timestampStart = (new Date()).valueOf();
- var decryptRet = await huks.decrypt('alias', decryptOption);
- timestampEnd = (new Date()).valueOf();
- consuming = timestampEnd - timestampStart;
- console.info('decrypt pormise time consuming ' + consuming);
- sumDecryptTiming += consuming;
- expect(decryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(plainText)).assertEqual(JSON.stringify(decryptRet.outData));
- }
- var delRet = await huks.deleteKey('alias', emptyOption);
- expect(delRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var averageTimeEncrypt = sumEncryptTiming / loop;
- var averageTimeDecrypt = sumDecryptTiming / loop;
- console.info('jsApi timing encrypt promise, average time: ' + averageTimeEncrypt);
- console.info('jsApi timing decrypt promise, average time: ' + averageTimeDecrypt);
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_00400
- * @tc.name HKS_JSAPI_TIMING_EncryptAndDecrypt_Callback
- * @tc.desc jsApi timing test for encrypt and decrypt by callback
- */
- it('HKS_JSAPI_TIMING_00400', 0, async function (done) {
- var genKeyOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_AES);
- var genKeyRet = await huks.generateKey('alias', genKeyOption);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var plainText = makeRandomArr(64);
- var encryptOption = makeEncryptOption(plainText);
- encryptCallback(0, encryptOption, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_00500
- * @tc.name HKS_JSAPI_TIMING_GetSdkVersion
- * @tc.desc jsApi timing test for getSdkVersion
- */
- it('HKS_JSAPI_TIMING_00500', 0, async function (done) {
- var sunGetSdkVersionTiming = 0;
- var genKeyOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_AES);
- var genKeyRet = await huks.generateKey('alias', genKeyOption);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
-
- var timestampStart = (new Date()).valueOf();
- var sdkVersion = await huks.getSdkVersion(emptyOption);
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- console.info('getSdkVersion time consuming ' + consuming);
- sunGetSdkVersionTiming += consuming;
- var result = false;
- if (sdkVersion.length > 0) {
- result = true;
- }
- expect(result).assertEqual(true);
- var averageTimeGetSdkVersion = sunGetSdkVersionTiming / loop;
- console.info('jsApi timing getSdkVersion, average time: ' + averageTimeGetSdkVersion);
- var delRet = await huks.deleteKey('alias', emptyOption);
- expect(delRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_00600
- * @tc.name HKS_JSAPI_TIMING_ImportAndExport_Promise
- * @tc.desc jsApi timing test for import and export by promise
- */
- it('HKS_JSAPI_TIMING_00600', 0, async function (done) {
- sumExportTiming = 0;
- sumImportTiming = 0;
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_RSA);
- for (let index = 1; index <= loop; index++) {
- console.info('generate key,export key,import key promise index ' + index);
- var genKeyRet = await huks.generateKey('alias', generateKeyOption);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
-
- var timestampStart = (new Date()).valueOf();
- var exportRet = await huks.exportKey('alias', emptyOption);
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- console.info('export promise time consuming ' + consuming);
- sumExportTiming += consuming;
- expect(exportRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
-
- var importOption = makeImportOption(exportRet.outData);
- timestampStart = (new Date()).valueOf();
- var importRet = await huks.importKey('alias_', importOption);
- timestampEnd = (new Date()).valueOf();
- consuming = timestampEnd - timestampStart;
- console.info('import promise time consuming ' + consuming);
- sumImportTiming += consuming;
- expect(importRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
-
- var delKeyRet = await huks.deleteKey('alias', emptyOption);
- expect(delKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- delKeyRet = await huks.deleteKey('alias_', emptyOption);
- expect(delKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- var averageTimeExportKey = sumExportTiming / loop;
- console.info('jsApi timing export key promise, average time: ' + averageTimeExportKey);
- var averageTimeImportKey = sumImportTiming / loop;
- console.info('jsApi timing import key promise, average time: ' + averageTimeImportKey);
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_00700
- * @tc.name HKS_JSAPI_TIMING_ImportAndExport_Callback
- * @tc.desc jsApi timing test for import and export by callback
- */
- it('HKS_JSAPI_TIMING_00700', 0, async function (done) {
- sumExportTiming = 0;
- sumImportTiming = 0;
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_RSA);
- var genKeyRet = await huks.generateKey('alias', generateKeyOption);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- exportCallback(0, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_00800
- * @tc.name HKS_JSAPI_TIMING_GetKeyProperties_Promise
- * @tc.desc jsApi timing test for getKeyProperties promise
- */
- it('HKS_JSAPI_TIMING_00800', 0, async function (done) {
- sumGetKeyPropertiesTiming = 0;
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_AES);
- var genKeyRet = await huks.generateKey('alias', generateKeyOption);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- for (let index = 1; index <= loop; index++) {
- console.info('get key properties promise index ' + index);
- var timestampStart = (new Date()).valueOf();
- var getKeyPropertiesRet = await huks.getKeyProperties('alias', emptyOption);
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- console.info('getKeyProperties promise time consuming ' + consuming);
- sumGetKeyPropertiesTiming += consuming;
- expect(getKeyPropertiesRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- var averageTimeGetProperties = sumGetKeyPropertiesTiming / loop;
- console.info('jsApi timing get key properties promise, average time: ' + averageTimeGetProperties);
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_00900
- * @tc.name HKS_JSAPI_TIMING_GetKeyProperties_Callback
- * @tc.desc jsApi timing test for getKeyProperties callback
- */
- it('HKS_JSAPI_TIMING_00900', 0, async function (done) {
- sumGetKeyPropertiesTiming = 0;
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_AES);
- var genKeyRet = await huks.generateKey('alias', generateKeyOption);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- getKeyPropertiesCallback(0, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_01000
- * @tc.name HKS_JSAPI_TIMING_IsKeyExist_Promise
- * @tc.desc jsApi timing test for isKeyExist promise
- */
- it('HKS_JSAPI_TIMING_01000', 0, async function (done) {
- sumIsKeyExistTiming = 0;
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_AES);
- var genKeyRet = await huks.generateKey('alias', generateKeyOption);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- for (let index = 1; index <= loop; index++) {
- console.info('isKeyExist promise index ' + index);
- var timestampStart = (new Date()).valueOf();
- var isKeyExistRet = await huks.isKeyExist('alias', emptyOption);
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- console.info('isKeyExist promise time consuming ' + consuming);
- sumIsKeyExistTiming += consuming;
- expect(isKeyExistRet).assertEqual(true);
- }
- var delKeyRet = await huks.deleteKey('alias', emptyOption);
- expect(delKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var averageTimeIsKeyExist = sumIsKeyExistTiming / loop;
- console.info('jsApi timing isKeyExist promise, average time: ' + averageTimeIsKeyExist);
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_01100
- * @tc.name HKS_JSAPI_TIMING_IsKeyExist_Callback
- * @tc.desc jsApi timing test for isKeyExist callback
- */
- it('HKS_JSAPI_TIMING_01100', 0, async function (done) {
- sumIsKeyExistTiming = 0;
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_AES);
- var genKeyRet = await huks.generateKey('alias', generateKeyOption);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isKeyExistCallback(0, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_01200
- * @tc.name HKS_JSAPI_TIMING_SignAndVerify_Promise
- * @tc.desc jsApi timing test for sign and verify promise
- */
- it('HKS_JSAPI_TIMING_01200', 0, async function (done) {
- sumSignTiming = 0;
- sumVerifyTiming = 0;
- var generateKeyOption = makeGenerateRSAKeyOptions();
- var generateKeyRet = await huks.generateKey(defaultAliasA, generateKeyOption);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyRet = await huks.exportKey(defaultAliasA, emptyOption);
- expect(exportKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- publicKey = exportKeyRet.outData;
- var importOptions = makeImportOptions(publicKey);
- var importKeyRet = await huks.importKey(defaultAliasB, importOptions);
- expect(importKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- for (let index = 1; index <= loop; index++) {
- console.info('sign and verify promise index ' + index);
- var plainText = makeRandomArr(16);
- var signOptions = makeSignOptions(plainText);
- var timestampStart = (new Date()).valueOf();
- var signRet = await huks.sign(defaultAliasA, signOptions);
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumSignTiming += consuming;
- expect(signRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- signedText = signRet.outData;
- var verifyOptions = makeVerifyOptions(plainText);
- timestampStart = (new Date()).valueOf();
- var verifyRet = await huks.verify(defaultAliasB, verifyOptions, signedText);
- timestampEnd = (new Date()).valueOf();
- consuming = timestampEnd - timestampStart;
- sumVerifyTiming += consuming;
- expect(verifyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- var deleteKeyAliasA = await huks.deleteKey(defaultAliasA, emptyOption);
- var deleteKeyAliasB = await huks.deleteKey(defaultAliasB, emptyOption);
- expect(deleteKeyAliasA.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(deleteKeyAliasB.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var averageTimeSign = sumSignTiming / loop;
- console.info('jsApi timing sign promise, average time: ' + averageTimeSign);
- var averageTimeVerify = sumVerifyTiming / loop;
- console.info('jsApi timing verify promise, average time: ' + averageTimeVerify);
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_01300
- * @tc.name HKS_JSAPI_TIMING_SignAndVerify_Callback
- * @tc.desc jsApi timing test for sign and verify callback
- */
- it('HKS_JSAPI_TIMING_01300', 0, async function (done) {
- sumSignTiming = 0;
- sumVerifyTiming = 0;
- var generateKeyOption = makeGenerateRSAKeyOptions();
- var generateKeyRet = await huks.generateKey(defaultAliasA, generateKeyOption);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyRet = await huks.exportKey(defaultAliasA, emptyOption);
- expect(exportKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- publicKey = exportKeyRet.outData;
- var importOptions = makeImportOptions(publicKey);
- var importKeyRet = await huks.importKey(defaultAliasB, importOptions);
- expect(importKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- signCallback(0, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_01400
- * @tc.name HKS_JSAPI_TIMING_AgreeKey_Promise
- * @tc.desc jsApi timing test for agree promise
- */
- it('HKS_JSAPI_TIMING_01400', 0, async function (done) {
- sumAgreeTiming = 0;
- var generateKeyAOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_ECC);
- var generateKeyARet = await huks.generateKey(defaultAliasA, generateKeyAOption);
- expect(generateKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var generateKeyBOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_ECC);
- var generateKeyBRet = await huks.generateKey(defaultAliasB, generateKeyBOption);
- expect(generateKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyBRet = await huks.exportKey(defaultAliasB, emptyOption);
- publicKey = exportKeyBRet.outData;
- var agreeKeyAOption = makeAgreeOptions(publicKey);
- for (let index = 1; index <= loop; index++) {
- console.info('agree promise index ' + index);
- var timestampStart = (new Date()).valueOf();
- var agreeKeyARet = await huks.agreeKey(defaultAliasA, agreeKeyAOption);
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumAgreeTiming += consuming;
- expect(agreeKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- var averageTimeAgree = sumAgreeTiming / loop;
- console.info('jsApi timing agree promise, average time: ' + averageTimeAgree);
- var deleteKeyARet = await huks.deleteKey(defaultAliasA, emptyOption);
- expect(deleteKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deleteKeyBRet = await huks.deleteKey(defaultAliasB, emptyOption);
- expect(deleteKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_01500
- * @tc.name HKS_JSAPI_TIMING_AgreeKey_Callback
- * @tc.desc jsApi timing test for agree callback
- */
- it('HKS_JSAPI_TIMING_01500', 0, async function (done) {
- sumAgreeTiming = 0;
- var generateKeyAOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_ECC);
- var generateKeyARet = await huks.generateKey(defaultAliasA, generateKeyAOption);
- expect(generateKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var generateKeyBOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_ECC);
- var generateKeyBRet = await huks.generateKey(defaultAliasB, generateKeyBOption);
- expect(generateKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyBRet = await huks.exportKey(defaultAliasB, emptyOption);
- publicKey = exportKeyBRet.outData;
- var agreeKeyAOption = makeAgreeOptions(publicKey);
- agreeCallback(0, agreeKeyAOption, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_01600
- * @tc.name HKS_JSAPI_TIMING_DeriveKey_Promise
- * @tc.desc jsApi timing test for deriveKey promise
- */
- it('HKS_JSAPI_TIMING_01600', 0, async function (done) {
- sumDeriveKeyTiming = 0;
- var generateKeyOption = makeGenerateKeyOption('DERIVE_AES_KEY');
- var generateKeyResult = await huks.generateKey('alias', generateKeyOption);
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption();
- for (let index = 1; index <= loop; index++) {
- console.info('agree promise index ' + index);
- var timestampStart = (new Date()).valueOf();
- var deriveKeyResult = await huks.deriveKey('alias', deriveKeyOption);
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumDeriveKeyTiming += consuming;
- expect(deriveKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- var averageTimeDeriveKey = sumDeriveKeyTiming / loop;
- console.info('jsApi timing deriveKey promise, average time: ' + averageTimeDeriveKey);
- deleteKeyByAlias('alias', done);
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_01700
- * @tc.name HKS_JSAPI_TIMING_DeriveKey_Callback
- * @tc.desc jsApi timing test for deriveKey promise
- */
- it('HKS_JSAPI_TIMING_01700', 0, async function (done) {
- sumDeriveKeyTiming = 0;
- var generateKeyOption = makeGenerateKeyOption('DERIVE_AES_KEY');
- var generateKeyResult = await huks.generateKey('alias', generateKeyOption);
- expect(generateKeyResult.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deriveKeyOption = makeHKDFDeriveOption();
- deriveKeyCallback(0, deriveKeyOption, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_TIMING_01800
- * @tc.name HKS_JSAPI_TIMING_Mac_Promise
- * @tc.desc jsApi timing test for mac promise
- */
- it('HKS_JSAPI_TIMING_01800', 0, async function (done) {
- sumMacTiming = 0;
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_HMAC);
- var generateKeyRet = await huks.generateKey('alias', generateKeyOption);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- for (let index = 1; index <= loop; index++) {
- console.info('mac promise index ' + index);
- var plainText = makeRandomArr(64);
- var macOption = makeMacOption(plainText);
- var timestampStart = (new Date()).valueOf();
- var macRet = await huks.mac('alias', macOption);
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumMacTiming += consuming;
- expect(macRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- }
- var averageTimeMac = sumMacTiming / loop;
- console.info('jsApi timing mac promise, average time: ' + averageTimeMac);
- deleteKeyByAlias('alias', done);
- });
-
- function macCallback(index, done) {
- var plainText = makeRandomArr(64);
- var macOption = makeMacOption(plainText);
- var timestampStart = (new Date()).valueOf();
- huks.mac('alias', macOption, function (err, data) {
- var timestampEnd = (new Date()).valueOf();
- var consuming = timestampEnd - timestampStart;
- sumMacTiming += consuming;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- index++;
- if (index == loop) {
- var averageTimeMac = sumMacTiming / loop;
- console.info('jsApi timing mac callback, average time: ' + averageTimeMac);
- deleteKeyByAlias('alias', done);
- } else {
- macCallback(index, done);
- }
- });
- };
-
- /**
- * @tc.number HKS_JSAPI_TIMING_01900
- * @tc.name HKS_JSAPI_TIMING_Mac_Callback
- * @tc.desc jsApi timing test for mac callback
- */
- it('HKS_JSAPI_TIMING_01900', 0, async function (done) {
- sumMacTiming = 0;
- var generateKeyOption = makeGenerateKeyOption(huks.HksKeyAlg.HKS_ALG_HMAC);
- var generateKeyRet = await huks.generateKey('alias', generateKeyOption);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- macCallback(0, done);
- });
-});
\ No newline at end of file
diff --git a/security/huks_standard/HuksJSTimingTest/signature/openharmony_sx.p7b b/security/huks_standard/HuksJSTimingTest/signature/openharmony_sx.p7b
deleted file mode 100644
index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000
Binary files a/security/huks_standard/HuksJSTimingTest/signature/openharmony_sx.p7b and /dev/null differ
diff --git a/security/huks_standard/HuksStressTest/BUILD.gn b/security/huks_standard/HuksStressTest/BUILD.gn
deleted file mode 100644
index d20b28b6d7deda25d477ccefbe33d447533d638d..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksStressTest/BUILD.gn
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//test/xts/tools/build/suite.gni")
-
-ohos_js_hap_suite("ActsHuksStressTest") {
- hap_profile = "./entry/src/main/config.json"
- deps = [
- ":hjs_demo_js_assets",
- ":hjs_demo_resources",
- ]
- certificate_profile = "./signature/openharmony_sx.p7b"
- hap_name = "ActsHuksStressTest"
-}
-ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
-}
-ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
-}
diff --git a/security/huks_standard/HuksStressTest/Test.json b/security/huks_standard/HuksStressTest/Test.json
deleted file mode 100644
index b489be11ab9037d488fc91ff029845b90ad25508..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksStressTest/Test.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "description": "Configuration for huks stress test",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "23000000",
- "package": "com.example.huksstresstest",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsHuksStressTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
diff --git a/security/huks_standard/HuksStressTest/entry/src/main/config.json b/security/huks_standard/HuksStressTest/entry/src/main/config.json
deleted file mode 100644
index 671e904e42d2f0799026e9eff7a4d8ffdea5078b..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksStressTest/entry/src/main/config.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "app": {
- "bundleName": "com.example.huksstresstest",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Beta1"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.huksstresstest",
- "name": ".MyApplication",
- "mainAbility": "com.example.huksstresstest.MainAbility",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": true
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.huksstresstest.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:entry_MainAbility",
- "type": "page",
- "launchType": "singleton",
- "visible": true,
- "isVisible": "true"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": true
- }
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksStressTest/entry/src/main/js/default/app.js b/security/huks_standard/HuksStressTest/entry/src/main/js/default/app.js
deleted file mode 100644
index 14ca792625c50b934e7bda87ac333d3414dc12bd..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksStressTest/entry/src/main/js/default/app.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export default {
- onCreate() {
- console.info('AceApplication onCreate');
- },
- onDestroy() {
- console.info('AceApplication onDestroy');
- }
-};
diff --git a/security/huks_standard/HuksStressTest/entry/src/main/js/default/i18n/en-US.json b/security/huks_standard/HuksStressTest/entry/src/main/js/default/i18n/en-US.json
deleted file mode 100644
index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksStressTest/entry/src/main/js/default/i18n/en-US.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksStressTest/entry/src/main/js/default/i18n/zh-CN.json b/security/huks_standard/HuksStressTest/entry/src/main/js/default/i18n/zh-CN.json
deleted file mode 100644
index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksStressTest/entry/src/main/js/default/i18n/zh-CN.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- }
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksStressTest/entry/src/main/js/default/pages/index/index.css b/security/huks_standard/HuksStressTest/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index 2b1965821483f4f8c8b97c86ef07fe87ea767d01..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksStressTest/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,44 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 40px;
- color: #000000;
- opacity: 0.9;
-}
-
-@media screen and (device-type: tablet) and (orientation: landscape) {
- .title {
- font-size: 100px;
- }
-}
-
-@media screen and (device-type: wearable) {
- .title {
- font-size: 28px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: tv) {
- .container {
- background-image: url("../../common/images/Wallpaper.png");
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center;
- }
-
- .title {
- font-size: 100px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: phone) and (orientation: landscape) {
- .title {
- font-size: 60px;
- }
-}
diff --git a/security/huks_standard/HuksStressTest/entry/src/main/js/default/pages/index/index.hml b/security/huks_standard/HuksStressTest/entry/src/main/js/default/pages/index/index.hml
deleted file mode 100644
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksStressTest/entry/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
diff --git a/security/huks_standard/HuksStressTest/entry/src/main/js/default/pages/index/index.js b/security/huks_standard/HuksStressTest/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index 32230af705b7f89c9e9b2e685274f47332d21a83..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksStressTest/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import file from '@system.file';
-import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index';
-
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- const core = Core.getInstance();
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- });
- const reportExtend = new ReportExtend(file);
- core.addService('expect', expectExtend);
- core.addService('report', reportExtend);
- core.init();
- const configService = core.getDefaultService('config');
- this.timeout = 23400000;
- configService.setConfig(this);
- require('../../../test/hks_jsApi_stressTest.test.js');
- core.execute();
- }
-}
diff --git a/security/huks_standard/HuksStressTest/entry/src/main/js/resources/base/element/string.json b/security/huks_standard/HuksStressTest/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index c0dd3a09e5dcefc69f22b5e00e92296f1c3f55a5..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksStressTest/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "entry_MainAbility",
- "value": "entry_MainAbility"
- },
- {
- "name": "mainability_description",
- "value": "JS_Empty Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/security/huks_standard/HuksStressTest/entry/src/main/js/resources/base/media/icon.png b/security/huks_standard/HuksStressTest/entry/src/main/js/resources/base/media/icon.png
deleted file mode 100644
index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000
Binary files a/security/huks_standard/HuksStressTest/entry/src/main/js/resources/base/media/icon.png and /dev/null differ
diff --git a/security/huks_standard/HuksStressTest/entry/src/main/js/test/hks_jsApi_stressTest.test.js b/security/huks_standard/HuksStressTest/entry/src/main/js/test/hks_jsApi_stressTest.test.js
deleted file mode 100644
index 3b4a1afd0fd11915456b32e38955de72735aadeb..0000000000000000000000000000000000000000
--- a/security/huks_standard/HuksStressTest/entry/src/main/js/test/hks_jsApi_stressTest.test.js
+++ /dev/null
@@ -1,637 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import huks from '@ohos.security.huks'
-import {describe, it, expect} from 'deccjsunit/index'
-
-import {
- emptyOption,
- makeMacOption,
- makeAgreeOptions,
- makeEncryptAndDecryptOption,
- makeGenerateKeyOption,
- makeImportOption,
- makeRandomArr,
- makeSignAndVerifyOption
-} from '../../../../../../hks_xts_common.test'
-
-describe('HKS_JSAPI_STRESS_TEST', function () {
-
- var executionHour = 0.61;
- var executionTime = 3600 * 1000 * executionHour;
- var plainText = makeRandomArr(64);
- var signText = makeRandomArr(16);
- var alias = 'alias';
- var aliasA = 'aliasA';
- var aliasB = 'aliasB';
- var publicKey = [];
- var signedText = [];
- var publicKeyA = [];
- var publicKeyB = [];
-
- var aesKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeySize.HKS_AES_KEY_SIZE_128,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
- null
- );
- var rsaKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE
- );
-
- var eccKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
- );
-
- var ecdhKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_AGREE,
- null,
- null,
- huks.HksKeyDigest.HKS_DIGEST_NONE
- );
-
- var macKeyOption = makeGenerateKeyOption(
- huks.HksKeyAlg.HKS_ALG_HMAC,
- 160,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC,
- null,
- null,
- huks.HksKeyDigest.HKS_DIGEST_SHA1
- );
-
- var aesEncryptOption = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- plainText
- );
-
- var rsaEncryptOption = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- plainText
- );
-
- var signOption = makeSignAndVerifyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- signText
- );
-
- var verifyOption = makeSignAndVerifyOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- signText
- );
-
- var currentCase = '';
-
- function importKey(endTime, index, done){
- var option = {};
- if (currentCase == '00400') {
- option = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- publicKey
- );
- } else {
- option = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- null,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- publicKey
- );
- }
- huks.importKey(aliasB, option,function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (currentCase == '00400') {
- encryptCallback(endTime, index, done);
- } else {
- signCallback(endTime, index, done);
- }
- });
- };
-
-
- function verifyCallback(endTime, index, done){
- huks.verify(aliasB, verifyOption, signedText, function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- deleteKeyCallback(endTime, index, done);
- });
- };
-
- function signCallback(endTime, index, done){
- huks.sign(aliasA, signOption, function (err,data){
- signedText = data.outData;
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- verifyCallback(endTime, index, done);
- });
- };
-
- function agreeKeyBCallback(endTime, index, done){
- var agreeKeyAOption = makeAgreeOptions(publicKeyA);
- huks.agreeKey(aliasB, agreeKeyAOption, function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- deleteKeyCallback(endTime, index, done);
- });
- };
-
- function agreeKeyACallback(endTime, index, done){
- var agreeKeyAOption = makeAgreeOptions(publicKeyB);
- huks.agreeKey(aliasA, agreeKeyAOption, function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- agreeKeyBCallback(endTime, index, done);
- });
- };
-
- function exportKeyBCallback(endTime, index, done){
- huks.exportKey(aliasB, emptyOption,function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- publicKeyB = data.outData;
- agreeKeyACallback(endTime, index, done);
- });
- };
-
- function exportKeyCallback(endTime, index, done){
- huks.exportKey(aliasA, emptyOption,function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (currentCase == '00800') {
- publicKeyA = data.outData;
- exportKeyBCallback(endTime, index, done);
- } else {
- publicKey = data.outData;
- importKey(endTime, index, done);
- }
- });
- };
-
- function macCallback(endTime, index, done){
- var macOption = makeMacOption(plainText);
- huks.mac(alias, macOption, function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- deleteKeyCallback(endTime, index, done);
- });
- };
-
- function generateKeyBCallback(endTime, index, done){
- var option = ecdhKeyOption;
- huks.generateKey(aliasB, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- exportKeyCallback(endTime, index, done);
- });
- };
-
- function generateKeyCallback(endTime, index, done) {
- var currentTime = (new Date()).valueOf();
- var tmpAlias = aliasA;
- if (currentTime <= endTime) {
- var option = {};
- if (currentCase == '00200') {
- option = aesKeyOption;
- tmpAlias = alias;
- } else if (currentCase == '00400') {
- option = rsaKeyOption;
- } else if (currentCase == '00600') {
- option = eccKeyOption;
- } else if (currentCase == '00800') {
- option = ecdhKeyOption;
- } else {
- tmpAlias = alias;
- option = macKeyOption;
- }
- huks.generateKey(tmpAlias, option, function (err, data) {
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- if (currentCase == '00200') {
- encryptCallback(endTime, index, done);
- } else if (currentCase == '00800') {
- generateKeyBCallback(endTime, index, done);
- } else if (currentCase == '01000') {
- macCallback(endTime, index, done);
- } else {
- exportKeyCallback(endTime, index, done);
- }
- });
- } else {
- done();
- }
- };
-
- function isKeyExistCallback(endTime, index, done){
- var tmpAlias = '';
- if (currentCase == '00200' || currentCase == '01000') {
- tmpAlias = alias;
- } else {
- tmpAlias = aliasA;
- }
- huks.isKeyExist(tmpAlias,emptyOption,function(err,data){
- expect(data).assertEqual(false);
- if (currentCase == '00200' || currentCase == '01000') {
- index++;
- var currentTime = (new Date()).valueOf();
- var sumTime = endTime - currentTime;
- console.info('HKS_STRESS_TEST_' + currentCase +' Time left ' + sumTime / 1000 + ' s,' + ' index: ' + index);
- generateKeyCallback(endTime, index, done);
- } else {
- deleteKeyBCallback(endTime, index, done);
- }
- });
- };
-
- function isKeyBExistCallback(endTime, index, done){
- huks.isKeyExist(aliasB,emptyOption,function(err,data){
- expect(data).assertEqual(false);
- index++;
- var currentTime = (new Date()).valueOf();
- var sumTime = endTime - currentTime;
- console.info('HKS_STRESS_TEST_' + currentCase +' Time left ' + sumTime / 1000 + ' s,' + ' index: ' + index);
- generateKeyCallback(endTime, index, done);
- });
- };
-
- function deleteKeyBCallback(endTime, index, done){
- huks.deleteKey(aliasB,emptyOption,function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isKeyBExistCallback(endTime, index, done);
- });
- };
-
- function deleteKeyCallback(endTime, index, done){
- var tmpAlias = '';
- if (currentCase == '00200' || currentCase == '01000') {
- tmpAlias = alias;
- } else {
- tmpAlias = aliasA;
- }
- huks.deleteKey(tmpAlias,emptyOption,function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- isKeyExistCallback(endTime, index, done);
- });
- };
-
- function decryptCallback(text, endTime, index, done){
- var tmpAlias = '';
- var option = {};
- if (currentCase == '00200') {
- tmpAlias = alias;
- option = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- text
- );
- } else {
- tmpAlias = aliasA;
- option = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- text
- );
- }
- huks.decrypt(tmpAlias, option, function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(plainText)).assertEqual(JSON.stringify(data.outData));
- deleteKeyCallback(endTime, index, done);
- });
- };
-
- function encryptCallback(endTime, index, done){
- var tmpAlias = '';
- var option = {};
- if (currentCase == '00200') {
- tmpAlias = alias;
- option = aesEncryptOption;
- } else {
- tmpAlias = aliasB;
- option = rsaEncryptOption;
- }
- huks.encrypt(tmpAlias, option, function(err,data){
- expect(data.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- decryptCallback(data.outData, endTime, index, done);
- });
- };
-
-
- /**
- * @tc.number HKS_JSAPI_STRESS_TEST_00100
- * @tc.name HKS_STRESS_TEST_AES_ENCRYPT_DECRYPT_PROMISE
- * @tc.desc stress test for aes encrypt and decrypt with promise
- */
- it('HKS_JSAPI_STRESS_TEST_00100', 0, async function (done) {
- var startTime = (new Date()).valueOf();
- var endTime = startTime + executionTime;
- var currentTime = startTime;
- var index = 0;
- while (currentTime <= endTime) {
- currentTime = (new Date()).valueOf();
- var genKeyRet = await huks.generateKey(alias, aesKeyOption);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var encryptRet = await huks.encrypt(alias, aesEncryptOption);
- expect(encryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var decryptOption = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_AES,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_CBC,
- null,
- null,
- encryptRet.outData
- );
- var decryptRet = await huks.decrypt(alias, decryptOption);
- expect(decryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(plainText)).assertEqual(JSON.stringify(decryptRet.outData));
- var delKeyRet = await huks.deleteKey(alias, emptyOption);
- expect(delKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExistRet = await huks.isKeyExist(alias, emptyOption);
- expect(isKeyExistRet).assertEqual(false);
- console.info('HKS_STRESS_TEST_00100 Time left ' + (endTime - currentTime) / 1000 + ' s,' + ' index: ' + index);
- index++;
- }
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_STRESS_TEST_00200
- * @tc.name HKS_STRESS_TEST_AES_ENCRYPT_DECRYPT_CALLBACK
- * @tc.desc stress test for aes encrypt and decrypt with callback
- */
- it('HKS_JSAPI_STRESS_TEST_00200', 0, async function (done) {
- currentCase = '00200';
- var startTime = (new Date()).valueOf();
- var endTime = startTime + executionTime;
- var index = 0;
- generateKeyCallback(endTime, index, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_STRESS_TEST_00300
- * @tc.name HKS_STRESS_TEST_RSA_ENCRYPT_DECRYPT_PROMISE
- * @tc.desc stress test for rsa encrypt and decrypt with promise
- */
- it('HKS_JSAPI_STRESS_TEST_00300', 0, async function (done) {
- var currentTime = (new Date()).valueOf();
- var endTime = currentTime + executionTime;
- var index = 0;
- while (currentTime <= endTime) {
- currentTime = (new Date()).valueOf();
- var genKeyRet = await huks.generateKey(aliasA, rsaKeyOption);
- expect(genKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyRet = await huks.exportKey(aliasA, emptyOption);
- expect(exportKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- publicKey = exportKeyRet.outData;
- var importRsaKeyOpt = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- publicKey
- );
- var importRet = await huks.importKey(aliasB, importRsaKeyOpt);
- expect(importRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var encryptRet = await huks.encrypt(aliasB, rsaEncryptOption);
- expect(encryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var decryptOption = makeEncryptAndDecryptOption(
- huks.HksKeyAlg.HKS_ALG_RSA,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- huks.HksCipherMode.HKS_MODE_ECB,
- huks.HksKeySize.HKS_RSA_KEY_SIZE_512,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- encryptRet.outData
- );
- var decryptRet = await huks.decrypt(aliasA, decryptOption);
- expect(decryptRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(plainText)).assertEqual(JSON.stringify(decryptRet.outData));
- var delKeyARet = await huks.deleteKey(aliasA, emptyOption);
- var delKeyBRet = await huks.deleteKey(aliasB, emptyOption);
- expect(delKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(delKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyAExistRet = await huks.isKeyExist(aliasA, emptyOption);
- expect(isKeyAExistRet).assertEqual(false);
- var isKeyBExistRet = await huks.isKeyExist(aliasB, emptyOption);
- expect(isKeyBExistRet).assertEqual(false);
- console.info('HKS_STRESS_TEST_00300 Time left ' + (endTime - currentTime) / 1000 + ' s,' + ' index: ' + index);
- index++;
- }
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_STRESS_TEST_00400
- * @tc.name HKS_STRESS_TEST_RSA_ENCRYPT_DECRYPT_PROMISE
- * @tc.desc stress test for rsa encrypt and decrypt with promise
- */
- it('HKS_JSAPI_STRESS_TEST_00400', 0, async function (done) {
- currentCase = '00400';
- var startTime = (new Date()).valueOf();
- var endTime = startTime + executionTime;
- var index = 0;
- generateKeyCallback(endTime, index, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_STRESS_TEST_00500
- * @tc.name HKS_STRESS_TEST_ECC_SIGN_VERIFY_PROMISE
- * @tc.desc stress test for ecc sign and verify with promise
- */
- it('HKS_JSAPI_STRESS_TEST_00500', 0, async function (done) {
- var currentTime = (new Date()).valueOf();
- var endTime = currentTime + executionTime;
- var index = 0;
- while (currentTime <= endTime) {
- currentTime = (new Date()).valueOf();
- var generateKeyRet = await huks.generateKey(aliasA, eccKeyOption);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var signRet = await huks.sign(aliasA, signOption);
- expect(signRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- signedText = signRet.outData;
- var exportKeyRet = await huks.exportKey(aliasA, emptyOption);
- expect(exportKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- publicKey = exportKeyRet.outData;
- var importOptions = makeImportOption(
- huks.HksKeyAlg.HKS_ALG_ECC,
- huks.HksKeySize.HKS_ECC_KEY_SIZE_224,
- huks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
- huks.HksKeyPadding.HKS_PADDING_NONE,
- null,
- huks.HksKeyDigest.HKS_DIGEST_NONE,
- publicKey
- );
- var importKeyRet = await huks.importKey(aliasB, importOptions);
- expect(importKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var verifyRet = await huks.verify(aliasB, verifyOption, signedText);
- expect(verifyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deleteKeyAliasA = await huks.deleteKey(aliasA, emptyOption);
- var deleteKeyAliasB = await huks.deleteKey(aliasB, emptyOption);
- expect(deleteKeyAliasA.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(deleteKeyAliasB.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyAExist = await huks.isKeyExist(aliasA, emptyOption);
- expect(isKeyAExist).assertEqual(false);
- var isKeyBExist = await huks.isKeyExist(aliasB, emptyOption);
- expect(isKeyBExist).assertEqual(false);
- console.info('HKS_STRESS_TEST_00500 Time left ' + (endTime - currentTime) / 1000 + ' s,' + ' index: ' + index);
- index++;
- }
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_STRESS_TEST_00600
- * @tc.name HKS_STRESS_TEST_ECC_SIGN_VERIFY_CALLBACK
- * @tc.desc stress test for ecc sign and verify with callback
- */
- it('HKS_JSAPI_STRESS_TEST_00600', 0, async function (done) {
- currentCase = '00600';
- var startTime = (new Date()).valueOf();
- var endTime = startTime + executionTime;
- var index = 0;
- generateKeyCallback(endTime, index, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_STRESS_TEST_00700
- * @tc.name HKS_STRESS_TEST_AGREE_VERIFY_PROMISE
- * @tc.desc stress test for agree with promise
- */
- it('HKS_JSAPI_STRESS_TEST_00700', 0, async function (done) {
- var currentTime = (new Date()).valueOf();
- var endTime = currentTime + executionTime;
- var index = 0;
- while (currentTime <= endTime) {
- currentTime = (new Date()).valueOf();
- var generateKeyARet = await huks.generateKey(aliasA, ecdhKeyOption);
- expect(generateKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var generateKeyBRet = await huks.generateKey(aliasB, ecdhKeyOption);
- expect(generateKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var exportKeyARet = await huks.exportKey(aliasA, emptyOption);
- var exportKeyBRet = await huks.exportKey(aliasB, emptyOption);
- publicKeyA = exportKeyARet.outData;
- publicKeyB = exportKeyBRet.outData;
- var agreeKeyAOption = makeAgreeOptions(publicKeyB);
- var agreeKeyARet = await huks.agreeKey(aliasA, agreeKeyAOption);
- expect(agreeKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var agreeKeyBOption = makeAgreeOptions(publicKeyA);
- var agreeKeyBRet = await huks.agreeKey(aliasB, agreeKeyBOption);
- expect(agreeKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- expect(JSON.stringify(agreeKeyARet.outData)).assertEqual(JSON.stringify(agreeKeyBRet.outData));
- var deleteKeyARet = await huks.deleteKey(aliasA, emptyOption);
- expect(deleteKeyARet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deleteKeyBRet = await huks.deleteKey(aliasB, emptyOption);
- expect(deleteKeyBRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyAExist = await huks.isKeyExist(aliasA, emptyOption);
- expect(isKeyAExist).assertEqual(false);
- var isKeyBExist = await huks.isKeyExist(aliasB, emptyOption);
- expect(isKeyBExist).assertEqual(false);
- console.info('HKS_STRESS_TEST_00700 Time left ' + (endTime - currentTime) / 1000 + ' s,' + ' index: ' + index);
- index++;
- }
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_STRESS_TEST_00800
- * @tc.name HKS_STRESS_TEST_AGREE_VERIFY_CALLBACK
- * @tc.desc stress test for agree with callback
- */
- it('HKS_JSAPI_STRESS_TEST_00800', 0, async function (done) {
- currentCase = '00800';
- var startTime = (new Date()).valueOf();
- var endTime = startTime + executionTime;
- var index = 0;
- generateKeyCallback(endTime, index, done);
- });
-
- /**
- * @tc.number HKS_JSAPI_STRESS_TEST_00900
- * @tc.name HKS_STRESS_TEST_MAC_PROMISE
- * @tc.desc stress test for mac with promise
- */
- it('HKS_JSAPI_STRESS_TEST_00900', 0, async function (done) {
- var currentTime = (new Date()).valueOf();
- var endTime = currentTime + executionTime;
- var index = 0;
- while (currentTime <= endTime) {
- currentTime = (new Date()).valueOf();
- var generateKeyRet = await huks.generateKey(alias, macKeyOption);
- expect(generateKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var macOption = makeMacOption(plainText);
- var macRet = await huks.mac(alias, macOption);
- expect(macRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var deleteKeyRet = await huks.deleteKey(alias, emptyOption);
- expect(deleteKeyRet.errorCode).assertEqual(huks.HksErrorCode.HKS_SUCCESS);
- var isKeyExist = await huks.isKeyExist(alias, emptyOption);
- expect(isKeyExist).assertEqual(false);
- var sumTime = endTime - currentTime;
- console.info('HKS_JSAPI_STRESS_TEST_00900 Time left ' + sumTime / 1000 + ' s,' + ' index: ' + index);
- index++;
- }
- done();
- });
-
- /**
- * @tc.number HKS_JSAPI_STRESS_TEST_01000
- * @tc.name HKS_STRESS_TEST_MAC_CALLBACK
- * @tc.desc stress test for mac with callback
- */
- it('HKS_JSAPI_STRESS_TEST_01000', 0, async function (done) {
- currentCase = '01000';
- var startTime = (new Date()).valueOf();
- var endTime = startTime + executionTime;
- var index = 0;
- generateKeyCallback(endTime, index, done);
- });
-});
\ No newline at end of file
diff --git a/security/huks_standard/HuksStressTest/signature/openharmony_sx.p7b b/security/huks_standard/HuksStressTest/signature/openharmony_sx.p7b
deleted file mode 100644
index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000
Binary files a/security/huks_standard/HuksStressTest/signature/openharmony_sx.p7b and /dev/null differ
diff --git a/security/huks_standard/hks_xts_common.test.js b/security/huks_standard/hks_xts_common.test.js
index f539163f8ef646f98383259e315006b8427e5fc1..d7f7c4790a24f82f67f7fa40075fcb0c1423d863 100644
--- a/security/huks_standard/hks_xts_common.test.js
+++ b/security/huks_standard/hks_xts_common.test.js
@@ -36,19 +36,18 @@ export function makeGenerateKeyOption(alg, size, purpose, padding, mode, digest)
properties[0] = makeAlgTagProperty(alg);
properties[1] = makeSizeProperty(size);
properties[2] = makePurposeProperty(purpose);
- if (purpose == (hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT)) {
+ if (purpose == (hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT)) {
properties[3] = makePaddingProperty(padding);
properties[4] = makeModeProperty(mode);
- if (alg == hks.HksKeyAlg.HKS_ALG_RSA) {
+ if (alg == hks.HuksKeyAlg.HUKS_ALG_RSA) {
properties[5] = makeDigestProperty(digest);
properties[6] = makeKeyGenerateType();
}
- } else if (purpose == (hks.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN | hks.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY)) {
+ } else if (purpose == (hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY)) {
properties[3] = makePaddingProperty(padding);
properties[4] = makeDigestProperty(digest);
- } else if (purpose == hks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC) {
+ } else if (purpose == hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC) {
properties[3] = makeDigestProperty(digest);
- properties[4] = makeKeyType();
} else {
properties[3] = makeDigestProperty(digest);
}
@@ -64,9 +63,9 @@ export function makeEncryptAndDecryptOption(alg, purpose, padding, mode, size, d
properties[1] = makePurposeProperty(purpose);
properties[2] = makePaddingProperty(padding);
properties[3] = makeModeProperty(mode);
- if (alg == hks.HksKeyAlg.HKS_ALG_AES) {
+ if (alg == hks.HuksKeyAlg.HUKS_ALG_AES) {
properties[4] = makeIV();
- if (mode == hks.HksCipherMode.HKS_MODE_GCM) {
+ if (mode == hks.HuksCipherMode.HUKS_MODE_GCM) {
properties[5] = makeAAD();
properties[6] = makeNonce();
}
@@ -106,32 +105,32 @@ export function makeRandomArr(size) {
export function makePlainTextSize(size,padding,digest){
var plainTextSize = 0;
- if (padding == hks.HksKeyPadding.HKS_PADDING_OAEP) {
- if (digest == hks.HksKeyDigest.HKS_DIGEST_SHA224 && size == hks.HksKeySize.HKS_RSA_KEY_SIZE_512) {
+ if (padding == hks.HuksKeyPadding.HUKS_PADDING_OAEP) {
+ if (digest == hks.HuksKeyDigest.HUKS_DIGEST_SHA224 && size == hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512) {
plainTextSize = 4;
} else {
plainTextSize = 16;
}
- } else if (padding == hks.HksKeyPadding.HKS_PADDING_PKCS1_V1_5) {
+ } else if (padding == hks.HuksKeyPadding.HUKS_PADDING_PKCS1_V1_5) {
plainTextSize = 8;
} else {
switch (size) {
- case hks.HksKeySize.HKS_RSA_KEY_SIZE_512:
+ case hks.HuksKeySize.HUKS_RSA_KEY_SIZE_512:
plainTextSize = 64;
break;
- case hks.HksKeySize.HKS_RSA_KEY_SIZE_768:
+ case hks.HuksKeySize.HUKS_RSA_KEY_SIZE_768:
plainTextSize = 96;
break;
- case hks.HksKeySize.HKS_RSA_KEY_SIZE_1024:
+ case hks.HuksKeySize.HUKS_RSA_KEY_SIZE_1024:
plainTextSize = 128;
break;
- case hks.HksKeySize.HKS_RSA_KEY_SIZE_2048:
+ case hks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048:
plainTextSize = 256;
break;
- case hks.HksKeySize.HKS_RSA_KEY_SIZE_3072:
+ case hks.HuksKeySize.HUKS_RSA_KEY_SIZE_3072:
plainTextSize = 384;
break;
- case hks.HksKeySize.HKS_RSA_KEY_SIZE_4096:
+ case hks.HuksKeySize.HUKS_RSA_KEY_SIZE_4096:
plainTextSize = 512;
break;
default:
@@ -147,8 +146,8 @@ export function makeImportOption(alg, size, purpose, padding, mode, digest, publ
properties[1] = makeSizeProperty(size);
properties[2] = makePurposeProperty(purpose);
properties[3] = makePaddingProperty(padding);
- if (alg == hks.HksKeyAlg.HKS_ALG_RSA || alg == hks.HksKeyAlg.HKS_ALG_DSA || alg == hks.HksKeyAlg.HKS_ALG_ECC) {
- if (purpose == (hks.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT | hks.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT)) {
+ if (alg == hks.HuksKeyAlg.HUKS_ALG_RSA || alg == hks.HuksKeyAlg.HUKS_ALG_DSA || alg == hks.HuksKeyAlg.HUKS_ALG_ECC) {
+ if (purpose == (hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT)) {
properties[4] = makeModeProperty(mode);
properties[5] = makeDigestProperty(digest);
properties[6] = makeKeyGenerateType();
@@ -166,7 +165,7 @@ export function makeImportOption(alg, size, purpose, padding, mode, digest, publ
function makeAlgTagProperty(alg) {
var property = {
- tag: hks.HksTag.HKS_TAG_ALGORITHM,
+ tag: hks.HuksTag.HUKS_TAG_ALGORITHM,
value: alg
}
return property;
@@ -174,7 +173,7 @@ function makeAlgTagProperty(alg) {
function makeSizeProperty(size) {
var property = {
- tag: hks.HksTag.HKS_TAG_KEY_SIZE,
+ tag: hks.HuksTag.HUKS_TAG_KEY_SIZE,
value: size
};
return property;
@@ -182,7 +181,7 @@ function makeSizeProperty(size) {
function makePurposeProperty(purpose) {
var property = {
- tag: hks.HksTag.HKS_TAG_PURPOSE,
+ tag: hks.HuksTag.HUKS_TAG_PURPOSE,
value: purpose
};
return property;
@@ -190,7 +189,7 @@ function makePurposeProperty(purpose) {
function makePaddingProperty(padding) {
var property = {
- tag: hks.HksTag.HKS_TAG_PADDING,
+ tag: hks.HuksTag.HUKS_TAG_PADDING,
value: padding
};
return property;
@@ -198,7 +197,7 @@ function makePaddingProperty(padding) {
function makeModeProperty(mode) {
var property = {
- tag: hks.HksTag.HKS_TAG_BLOCK_MODE,
+ tag: hks.HuksTag.HUKS_TAG_BLOCK_MODE,
value: mode
};
return property;
@@ -206,7 +205,7 @@ function makeModeProperty(mode) {
function makeDigestProperty(digest) {
var property = {
- tag: hks.HksTag.HKS_TAG_DIGEST,
+ tag: hks.HuksTag.HUKS_TAG_DIGEST,
value: digest
};
return property;
@@ -214,23 +213,15 @@ function makeDigestProperty(digest) {
function makeKeyGenerateType() {
var property = {
- tag: hks.HksTag.HKS_TAG_KEY_GENERATE_TYPE,
- value: hks.HksKeyGenerateType.HKS_KEY_GENERATE_TYPE_DEFAULT
- };
- return property;
-};
-
-function makeKeyType() {
- var property = {
- tag: hks.HksTag.HKS_TAG_KEY_TYPE,
- value: hks.HksKeyType.HKS_KEY_TYPE_HMAC
+ tag: hks.HuksTag.HUKS_TAG_KEY_GENERATE_TYPE,
+ value: hks.HuksKeyGenerateType.HUKS_KEY_GENERATE_TYPE_DEFAULT
};
return property;
};
function makeIV() {
var property = {
- tag: hks.HksTag.HKS_TAG_IV,
+ tag: hks.HuksTag.HUKS_TAG_IV,
value: new Uint8Array(16)
};
return property;
@@ -238,7 +229,7 @@ function makeIV() {
function makeAAD() {
var property = {
- tag: hks.HksTag.HKS_TAG_ASSOCIATED_DATA,
+ tag: hks.HuksTag.HUKS_TAG_ASSOCIATED_DATA,
value: new Uint8Array(16)
};
return property;
@@ -246,7 +237,7 @@ function makeAAD() {
function makeNonce() {
var property = {
- tag: hks.HksTag.HKS_TAG_NONCE,
+ tag: hks.HuksTag.HUKS_TAG_NONCE,
value: new Uint8Array(16)
};
return property;
@@ -254,7 +245,7 @@ function makeNonce() {
function makeIsKeyAlias() {
var property = {
- tag: hks.HksTag.HKS_TAG_IS_KEY_ALIAS,
+ tag: hks.HuksTag.HUKS_TAG_IS_KEY_ALIAS,
value: true
};
return property;
@@ -278,16 +269,16 @@ function makeInDataOption() {
export function makeMacOption(plaintText) {
var properties = new Array();
properties[0] = {
- tag: hks.HksTag.HKS_TAG_ALGORITHM,
- value: hks.HksKeyAlg.HKS_ALG_HMAC
+ tag: hks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: hks.HuksKeyAlg.HUKS_ALG_HMAC
};
properties[1] = {
- tag: hks.HksTag.HKS_TAG_PURPOSE,
- value: hks.HksKeyPurpose.HKS_KEY_PURPOSE_MAC
+ tag: hks.HuksTag.HUKS_TAG_PURPOSE,
+ value: hks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC
};
properties[2] = {
- tag: hks.HksTag.HKS_TAG_DIGEST,
- value: hks.HksKeyDigest.HKS_DIGEST_SHA1
+ tag: hks.HuksTag.HUKS_TAG_DIGEST,
+ value: hks.HuksKeyDigest.HUKS_DIGEST_SHA1
};
var options = {
properties: properties,
@@ -299,12 +290,12 @@ export function makeMacOption(plaintText) {
export function makeAgreeOptions(publicKey) {
var properties = new Array();
properties[0] = {
- tag: hks.HksTag.HKS_TAG_ALGORITHM,
- value: hks.HksKeyAlg.HKS_ALG_ECDH
+ tag: hks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: hks.HuksKeyAlg.HUKS_ALG_ECDH
};
properties[1] = {
- tag: hks.HksTag.HKS_TAG_KEY_SIZE,
- value: hks.HksKeySize.HKS_ECC_KEY_SIZE_224
+ tag: hks.HuksTag.HUKS_TAG_KEY_SIZE,
+ value: hks.HuksKeySize.HUKS_ECC_KEY_SIZE_224
};
var options = {
properties: properties,
diff --git a/security_lite/huks/common/BUILD.gn b/security_lite/huks/common/BUILD.gn
index 20ac185d03d9113fb1e18b972945c7952e9a8f12..dba9d422f851cc6e4ef3d925b208be801148243a 100644
--- a/security_lite/huks/common/BUILD.gn
+++ b/security_lite/huks/common/BUILD.gn
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2020 Huawei Device Co., Ltd.
+# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at