未验证 提交 26cd889d 编写于 作者: O openharmony_ci 提交者: Gitee

!6800 【openharmony-3.2master】【安全子系统】huks派生接口新增参数

Merge pull request !6800 from yuanyuhang/master1206_1
...@@ -53,7 +53,8 @@ describe('SecurityHuksHKDFBasicAbort63KBCallbackJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksHKDFBasicAbort63KBCallbackJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); let deriveArray = new Array(HuksDeriveHKDF.HuksKeyAlgHKDF,HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'abort');
done(); done();
}); });
}); });
......
...@@ -53,7 +53,8 @@ describe('SecurityHuksHKDFBasicFinish63KBCallbackJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksHKDFBasicFinish63KBCallbackJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); let deriveArray = new Array(HuksDeriveHKDF.HuksKeyAlgHKDF,HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'finish');
done(); done();
}); });
}); });
......
...@@ -53,7 +53,8 @@ describe('SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); let deriveArray = new Array(HuksDerivePBKDF2.HuksKeyAlgPBKDF2,HuksDerivePBKDF2.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'abort');
done(); done();
}); });
}); });
......
...@@ -53,7 +53,8 @@ describe('SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); let deriveArray = new Array(HuksDerivePBKDF2.HuksKeyAlgPBKDF2,HuksDerivePBKDF2.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'finish');
done(); done();
}); });
}); });
......
...@@ -54,7 +54,8 @@ describe('SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit', function () { ...@@ -54,7 +54,8 @@ describe('SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); let deriveArray = new Array(HuksDeriveHKDF.HuksKeyAlgHKDF,HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'abort');
done(); done();
}); });
}); });
......
...@@ -53,7 +53,8 @@ describe('SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); let deriveArray = new Array(HuksDeriveHKDF.HuksKeyAlgHKDF,HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'finish');
done(); done();
}); });
}); });
......
...@@ -53,7 +53,8 @@ describe('SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); let deriveArray = new Array(HuksDerivePBKDF2.HuksKeyAlgPBKDF2,HuksDerivePBKDF2.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'abort');
done(); done();
}); });
}); });
......
...@@ -54,7 +54,8 @@ describe('SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit', function () { ...@@ -54,7 +54,8 @@ describe('SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); let deriveArray = new Array(HuksDerivePBKDF2.HuksKeyAlgPBKDF2,HuksDerivePBKDF2.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'finish');
done(); done();
}); });
}); });
......
...@@ -175,18 +175,20 @@ function deleteKey(srcKeyAlies, HuksOptions) { ...@@ -175,18 +175,20 @@ function deleteKey(srcKeyAlies, HuksOptions) {
}); });
} }
async function publicDeriveFunc(srcKeyAlies, HuksOptions, huksOptionsFinish, thirdInderfaceName) { async function publicDeriveFunc(srcKeyAlies, HuksOptions, huksOptionsFinish, deriveArray, thirdInderfaceName) {
try { try {
await publicDeriveGenFunc(srcKeyAlies, HuksOptions); await publicDeriveGenFunc(srcKeyAlies, HuksOptions);
HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgHKDF); let deriveArrAlg = HuksOptions.properties[0];
HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE); let deriveArrLen = HuksOptions.properties[3];
HuksOptions.properties.splice(0, 1, deriveArray[0]);
HuksOptions.properties.splice(3, 1, deriveArray[1]);
await publicDeriveInitFunc(srcKeyAlies, HuksOptions); await publicDeriveInitFunc(srcKeyAlies, HuksOptions);
await publicDeriveUpdateFunc(HuksOptions); await publicDeriveUpdateFunc(HuksOptions);
await publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName); await publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName);
HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgAES); HuksOptions.properties.splice(0, 1, deriveArrAlg);
HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyHKDFSize128); HuksOptions.properties.splice(3, 1, deriveArrLen);
await publicDeriveDeleteFunc(srcKeyAlies, HuksOptions); await publicDeriveDeleteFunc(srcKeyAlies, HuksOptions);
} catch (e) { } catch (e) {
expect(null).assertFail(); expect(null).assertFail();
......
...@@ -100,18 +100,20 @@ async function publicDeriveDeleteFunc(srcKeyAlies, HuksOptions) { ...@@ -100,18 +100,20 @@ async function publicDeriveDeleteFunc(srcKeyAlies, HuksOptions) {
}); });
} }
async function publicDeriveFunc(srcKeyAlies, HuksOptions, huksOptionsFinish, thirdInderfaceName) { async function publicDeriveFunc(srcKeyAlies, HuksOptions, huksOptionsFinish, deriveArray, thirdInderfaceName) {
try { try {
await publicDeriveGenFunc(srcKeyAlies, HuksOptions); await publicDeriveGenFunc(srcKeyAlies, HuksOptions);
HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgHKDF); let deriveArrAlg = HuksOptions.properties[0];
HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE); let deriveArrLen = HuksOptions.properties[3];
HuksOptions.properties.splice(0, 1, deriveArray[0]);
HuksOptions.properties.splice(3, 1, deriveArray[1]);
await publicDeriveInitFunc(srcKeyAlies, HuksOptions); await publicDeriveInitFunc(srcKeyAlies, HuksOptions);
await publicDeriveUpdateFunc(HuksOptions); await publicDeriveUpdateFunc(HuksOptions);
await publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName); await publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName);
HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgAES); HuksOptions.properties.splice(0, 1, deriveArrAlg);
HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyHKDFSize128); HuksOptions.properties.splice(3, 1, deriveArrLen);
await publicDeriveDeleteFunc(srcKeyAlies, HuksOptions); await publicDeriveDeleteFunc(srcKeyAlies, HuksOptions);
} catch (e) { } catch (e) {
expect(null).assertFail(); expect(null).assertFail();
......
...@@ -53,7 +53,8 @@ describe('SecurityHuksHKDFBasicAbort63KBCallbackJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksHKDFBasicAbort63KBCallbackJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); let deriveArray = new Array(HuksDeriveHKDF.HuksKeyAlgHKDF,HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'abort');
done(); done();
}); });
}); });
......
...@@ -53,7 +53,8 @@ describe('SecurityHuksHKDFBasicFinish63KBCallbackJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksHKDFBasicFinish63KBCallbackJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); let deriveArray = new Array(HuksDeriveHKDF.HuksKeyAlgHKDF,HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'finish');
done(); done();
}); });
}); });
......
...@@ -53,7 +53,8 @@ describe('SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksPBKDF2BasicAbort63KBCallbackJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); let deriveArray = new Array(HuksDerivePBKDF2.HuksKeyAlgPBKDF2,HuksDerivePBKDF2.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'abort');
done(); done();
}); });
}); });
......
...@@ -53,7 +53,8 @@ describe('SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksPBKDF2BasicFinish63KBCallbackJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); let deriveArray = new Array(HuksDerivePBKDF2.HuksKeyAlgPBKDF2,HuksDerivePBKDF2.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'finish');
done(); done();
}); });
}); });
......
...@@ -54,7 +54,8 @@ describe('SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit', function () { ...@@ -54,7 +54,8 @@ describe('SecurityHuksDeriveHKDFBasicAbort63KBPromiseJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); let deriveArray = new Array(HuksDeriveHKDF.HuksKeyAlgHKDF,HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'abort');
done(); done();
}); });
}); });
......
...@@ -53,7 +53,8 @@ describe('SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksDeriveHKDFBasicFinish63KBPromiseJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); let deriveArray = new Array(HuksDeriveHKDF.HuksKeyAlgHKDF,HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'finish');
done(); done();
}); });
}); });
......
...@@ -53,7 +53,8 @@ describe('SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit', function () { ...@@ -53,7 +53,8 @@ describe('SecurityHuksDerivePBKDF2BasicAbort63KBPromiseJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'abort'); let deriveArray = new Array(HuksDerivePBKDF2.HuksKeyAlgPBKDF2,HuksDerivePBKDF2.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'abort');
done(); done();
}); });
}); });
......
...@@ -54,7 +54,8 @@ describe('SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit', function () { ...@@ -54,7 +54,8 @@ describe('SecurityHuksDerivePBKDF2BasicFinish63KBPromiseJsunit', function () {
), ),
inData: srcData63Kb, inData: srcData63Kb,
}; };
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, 'finish'); let deriveArray = new Array(HuksDerivePBKDF2.HuksKeyAlgPBKDF2,HuksDerivePBKDF2.HuksKeyDERIVEKEYSIZE);
await publicDeriveFunc(srcKeyAliesFirst, HuksOptions63kb, huksOptionsFinish, deriveArray, 'finish');
done(); done();
}); });
}); });
......
...@@ -221,18 +221,20 @@ function deleteKeyItem(srcKeyAlies, HuksOptions) { ...@@ -221,18 +221,20 @@ function deleteKeyItem(srcKeyAlies, HuksOptions) {
}); });
} }
async function publicDeriveFunc(srcKeyAlies, HuksOptions, huksOptionsFinish, thirdInderfaceName) { async function publicDeriveFunc(srcKeyAlies, HuksOptions, huksOptionsFinish, deriveArray, thirdInderfaceName) {
try { try {
await publicDeriveGenFunc(srcKeyAlies, HuksOptions); await publicDeriveGenFunc(srcKeyAlies, HuksOptions);
HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgHKDF); let deriveArrAlg = HuksOptions.properties[0];
HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE); let deriveArrLen = HuksOptions.properties[3];
HuksOptions.properties.splice(0, 1, deriveArray[0]);
HuksOptions.properties.splice(3, 1, deriveArray[1]);
await publicDeriveInitFunc(srcKeyAlies, HuksOptions); await publicDeriveInitFunc(srcKeyAlies, HuksOptions);
await publicDeriveUpdateFunc(HuksOptions); await publicDeriveUpdateFunc(HuksOptions);
await publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName); await publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName);
HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgAES); HuksOptions.properties.splice(0, 1, deriveArrAlg);
HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyHKDFSize128); HuksOptions.properties.splice(3, 1, deriveArrLen);
await publicDeriveDeleteFunc(srcKeyAlies, HuksOptions); await publicDeriveDeleteFunc(srcKeyAlies, HuksOptions);
} catch (e) { } catch (e) {
expect(null).assertFail(); expect(null).assertFail();
......
...@@ -124,18 +124,20 @@ async function publicDeriveDeleteFunc(srcKeyAlies, HuksOptions) { ...@@ -124,18 +124,20 @@ async function publicDeriveDeleteFunc(srcKeyAlies, HuksOptions) {
} }
} }
async function publicDeriveFunc(srcKeyAlies, HuksOptions, huksOptionsFinish, thirdInderfaceName) { async function publicDeriveFunc(srcKeyAlies, HuksOptions, huksOptionsFinish, deriveArray, thirdInderfaceName) {
try { try {
await publicDeriveGenFunc(srcKeyAlies, HuksOptions); await publicDeriveGenFunc(srcKeyAlies, HuksOptions);
HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgHKDF); let deriveArrAlg = HuksOptions.properties[0];
HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyDERIVEKEYSIZE); let deriveArrLen = HuksOptions.properties[3];
HuksOptions.properties.splice(0, 1, deriveArray[0]);
HuksOptions.properties.splice(3, 1, deriveArray[1]);
await publicDeriveInitFunc(srcKeyAlies, HuksOptions); await publicDeriveInitFunc(srcKeyAlies, HuksOptions);
await publicDeriveUpdateFunc(HuksOptions); await publicDeriveUpdateFunc(HuksOptions);
await publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName); await publicDeriveFinishAbortFunc(huksOptionsFinish, thirdInderfaceName);
HuksOptions.properties.splice(0, 1, paramPublic.HuksDeriveHKDF.HuksKeyAlgAES); HuksOptions.properties.splice(0, 1, deriveArrAlg);
HuksOptions.properties.splice(3, 1, paramPublic.HuksDeriveHKDF.HuksKeyHKDFSize128); HuksOptions.properties.splice(3, 1, deriveArrLen);
await publicDeriveDeleteFunc(srcKeyAlies, HuksOptions); await publicDeriveDeleteFunc(srcKeyAlies, HuksOptions);
} catch (e) { } catch (e) {
expect(null).assertFail(); expect(null).assertFail();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册