Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
99f003d6
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
99f003d6
编写于
8月 31, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 31, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5336 修改daily构建huks的异常用例
Merge pull request !5336 from Qwink2016/qwink20220831_0816
上级
43da29a8
483ffc59
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
1556 addition
and
2087 deletion
+1556
-2087
security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksAccessControlJsunit.test.js
...main/js/test/HMAC/SecurityHuksAccessControlJsunit.test.js
+2
-0
security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js
.../js/test/HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js
+142
-174
security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/List.test.js
...uks_hmac_callback_BasicTest/src/main/js/test/List.test.js
+6
-7
security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/HMAC/SecurityHuksFaceFingerNormalJsunit.test.js
...n/js/test/HMAC/SecurityHuksFaceFingerNormalJsunit.test.js
+1275
-1801
security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js
...n/js/test/HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js
+131
-105
未找到文件。
security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksAccessControlJsunit.test.js
浏览文件 @
99f003d6
...
...
@@ -854,6 +854,8 @@ export function SecurityHuksAccessControlJsunit() {
expect
(
1342197283
).
assertEqual
(
huks
.
HuksTag
.
HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA
);
expect
(
0
).
assertEqual
(
huks
.
HuksKeyStorageType
.
HUKS_STORAGE_TEMP
);
expect
(
1
).
assertEqual
(
huks
.
HuksKeyStorageType
.
HUKS_STORAGE_PERSISTENT
);
done
();
});
});
...
...
security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js
浏览文件 @
99f003d6
...
...
@@ -13,11 +13,11 @@
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
@ohos/hypium
'
;
import
huks
from
'
@ohos.security.huks
'
;
import
Data
from
'
../../../../../../utils/data.json
'
;
import
{
HuksHmac
}
from
'
../../../../../../utils/param/hmac/publicHmacParam.js
'
;
import
{
stringToArray
}
from
'
../../../../../../utils/param/publicFunc.js
'
;
import
{
describe
,
it
,
expect
}
from
"
@ohos/hypium
"
;
import
huks
from
"
@ohos.security.huks
"
;
import
Data
from
"
../../../../../../utils/data.json
"
;
import
{
HuksHmac
}
from
"
../../../../../../utils/param/hmac/publicHmacParam.js
"
;
import
{
stringToArray
}
from
"
../../../../../../utils/param/publicFunc.js
"
;
var
handle
;
let
srcData63Kb
=
Data
.
Date63KB
;
...
...
@@ -28,13 +28,15 @@ function generateKey(srcKeyAlies, HuksOptions) {
huks
.
generateKey
(
srcKeyAlies
,
HuksOptions
,
function
(
err
,
data
)
{
try
{
if
(
err
.
code
!==
0
)
{
console
.
log
(
'
test generateKey err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test generateKey err information:
"
+
JSON
.
stringify
(
err
)
);
reject
(
err
);
}
else
{
resolve
(
data
);
}
}
catch
(
e
)
{
console
.
log
(
'
test generateKey err information:
'
+
JSON
.
stringify
(
e
));
console
.
log
(
"
test generateKey err information:
"
+
JSON
.
stringify
(
e
));
reject
(
e
);
}
});
...
...
@@ -46,14 +48,14 @@ function init(srcKeyAlies, HuksOptions) {
huks
.
init
(
srcKeyAlies
,
HuksOptions
,
function
(
err
,
data
)
{
try
{
if
(
err
.
code
!==
0
)
{
console
.
log
(
'
test init err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test init err information:
"
+
JSON
.
stringify
(
err
));
reject
(
err
);
}
else
{
handle
=
data
.
handle
;
resolve
(
data
);
}
}
catch
(
e
)
{
console
.
log
(
'
test init err information:
'
+
JSON
.
stringify
(
e
));
console
.
log
(
"
test init err information:
"
+
JSON
.
stringify
(
e
));
reject
(
e
);
}
});
...
...
@@ -65,13 +67,13 @@ function update(handle, HuksOptions) {
huks
.
update
(
handle
,
HuksOptions
,
function
(
err
,
data
)
{
try
{
if
(
err
.
code
!==
0
)
{
console
.
log
(
'
test update err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test update err information:
"
+
JSON
.
stringify
(
err
));
reject
(
err
);
}
else
{
resolve
(
data
);
}
}
catch
(
e
)
{
console
.
log
(
'
test update err information:
'
+
JSON
.
stringify
(
e
));
console
.
log
(
"
test update err information:
"
+
JSON
.
stringify
(
e
));
reject
(
e
);
}
});
...
...
@@ -83,13 +85,13 @@ function finish(handle, HuksOptions) {
huks
.
finish
(
handle
,
HuksOptions
,
function
(
err
,
data
)
{
try
{
if
(
err
.
code
!==
0
)
{
console
.
log
(
'
test finish err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test finish err information:
"
+
JSON
.
stringify
(
err
));
reject
(
err
);
}
else
{
resolve
(
data
);
}
}
catch
(
e
)
{
console
.
log
(
'
test finish err information:
'
+
JSON
.
stringify
(
e
));
console
.
log
(
"
test finish err information:
"
+
JSON
.
stringify
(
e
));
reject
(
e
);
}
});
...
...
@@ -101,13 +103,13 @@ function abort(handle, HuksOptions) {
huks
.
abort
(
handle
,
HuksOptions
,
function
(
err
,
data
)
{
try
{
if
(
err
.
code
!==
0
)
{
console
.
log
(
'
test abort err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test abort err information:
"
+
JSON
.
stringify
(
err
));
reject
(
err
);
}
else
{
resolve
(
data
);
}
}
catch
(
e
)
{
console
.
log
(
'
test abort err information:
'
+
JSON
.
stringify
(
e
));
console
.
log
(
"
test abort err information:
"
+
JSON
.
stringify
(
e
));
reject
(
e
);
}
});
...
...
@@ -119,13 +121,13 @@ function deleteKey(srcKeyAlies, HuksOptions) {
huks
.
deleteKey
(
srcKeyAlies
,
HuksOptions
,
function
(
err
,
data
)
{
try
{
if
(
err
.
code
!==
0
)
{
console
.
log
(
'
test deleteKey err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test deleteKey err information:
"
+
JSON
.
stringify
(
err
));
reject
(
err
);
}
else
{
resolve
(
data
);
}
}
catch
(
e
)
{
console
.
log
(
'
test deleteKey err information:
'
+
JSON
.
stringify
(
e
));
console
.
log
(
"
test deleteKey err information:
"
+
JSON
.
stringify
(
e
));
reject
(
e
);
}
});
...
...
@@ -144,7 +146,7 @@ async function publicHmacUpdate(HuksOptions) {
console
.
log
(
`test update data:
${
data
}
`
);
})
.
catch
((
err
)
=>
{
console
.
log
(
'
test update err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test update err information:
"
+
JSON
.
stringify
(
err
));
expect
(
null
).
assertFail
();
});
HuksOptions
.
inData
=
huksOptionsInData
;
...
...
@@ -152,25 +154,32 @@ async function publicHmacUpdate(HuksOptions) {
let
count
=
Math
.
floor
(
inDataArray
.
length
/
dateSize
);
let
remainder
=
inDataArray
.
length
%
dateSize
;
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
huksOptionsInData
).
slice
(
dateSize
*
i
,
dateSize
*
(
i
+
1
)));
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
huksOptionsInData
).
slice
(
dateSize
*
i
,
dateSize
*
(
i
+
1
))
);
await
update
(
handle
,
HuksOptions
)
.
then
((
data
)
=>
{
console
.
log
(
`test update data:
${
data
}
`
);
})
.
catch
((
err
)
=>
{
console
.
log
(
'
test update err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test update err information:
"
+
JSON
.
stringify
(
err
));
expect
(
null
).
assertFail
();
});
}
if
(
remainder
!==
0
)
{
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
huksOptionsInData
).
slice
(
dateSize
*
count
,
inDataArray
.
length
));
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
huksOptionsInData
).
slice
(
dateSize
*
count
,
inDataArray
.
length
)
);
console
.
log
(
`test update HuksOptions.inData
${
HuksOptions
.
inData
}
`
);
await
update
(
handle
,
HuksOptions
)
.
then
((
data
)
=>
{
console
.
log
(
`test update data:
${
data
}
`
);
})
.
catch
((
err
)
=>
{
console
.
log
(
'
test update err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test update err information:
"
+
JSON
.
stringify
(
err
));
expect
(
null
).
assertFail
();
});
}
...
...
@@ -181,7 +190,7 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions, thirdInderfaceName) {
HuksOptions
.
properties
.
splice
(
1
,
0
,
HuksHmac
.
HuksKeySIZE
);
await
generateKey
(
srcKeyAlies
,
HuksOptions
)
.
then
((
data
)
=>
{
console
.
log
(
'
test generateKey data =
'
+
JSON
.
stringify
(
data
));
console
.
log
(
"
test generateKey data =
"
+
JSON
.
stringify
(
data
));
})
.
catch
((
err
)
=>
{
console
.
log
(
`test init err: " +
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -199,14 +208,14 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions, thirdInderfaceName) {
});
await
publicHmacUpdate
(
HuksOptions
);
if
(
thirdInderfaceName
==
'
finish
'
)
{
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
'
0
'
));
if
(
thirdInderfaceName
==
"
finish
"
)
{
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
"
0
"
));
await
finish
(
handle
,
HuksOptions
)
.
then
((
data
)
=>
{
console
.
log
(
`test update data:
${
data
}
`
);
})
.
catch
((
err
)
=>
{
console
.
log
(
'
test update err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test update err information:
"
+
JSON
.
stringify
(
err
));
expect
(
null
).
assertFail
();
});
}
else
{
...
...
@@ -215,7 +224,7 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions, thirdInderfaceName) {
console
.
log
(
`test abort data:
${
data
}
`
);
})
.
catch
((
err
)
=>
{
console
.
log
(
'
test abort err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test abort err information:
"
+
JSON
.
stringify
(
err
));
expect
(
null
).
assertFail
();
});
}
...
...
@@ -226,161 +235,120 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions, thirdInderfaceName) {
expect
(
data
.
errorCode
==
0
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
log
(
'
test deleteKey err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test deleteKey err information:
"
+
JSON
.
stringify
(
err
));
expect
(
null
).
assertFail
();
});
}
export
function
SecurityHuksHmacBasicCallbackJsunit_test
()
{
describe
(
'
SecurityHuksHmacBasicCallbackJsunit_test
'
,
function
()
{
it
(
'
testHmacSHA1001
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias001
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData63Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
finish
'
);
done
();
});
it
(
'
testHmacSHA1002
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias002
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData63Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
abort
'
);
done
();
});
it
(
'
testHmacSHA1003
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias003
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData65Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
finish
'
);
done
();
});
it
(
'
testHmacSHA1004
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias004
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData65Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
abort
'
);
done
();
});
});
}
export
function
SecurityHuksHmacCallbackJsunit
()
{
describe
(
'
SecurityHuksHmacCallbackJsunit
'
,
function
()
{
it
(
'
testHmacSHA1001
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias001
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData63Kb
,
};
describe
(
"
SecurityHuksHmacCallbackJsunit
"
,
function
()
{
it
(
"
testHmacSHA1001
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSHA1KeyAlias001
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData63Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
finish
'
);
done
();
});
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
"
finish
"
);
done
();
});
it
(
'
testHmacSHA1002
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias002
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData63Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
abort
'
);
done
();
});
it
(
'
testHmacSHA1003
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias003
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData65Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
finish
'
);
done
();
});
it
(
'
testHmacSHA1004
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias004
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData65Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
abort
'
);
done
();
});
it
(
'
testHmacSM3001
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSM3KeyAlias001
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData63Kb
,
};
it
(
"
testHmacSHA1002
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSHA1KeyAlias002
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData63Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
"
abort
"
);
done
();
});
it
(
"
testHmacSHA1003
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSHA1KeyAlias003
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData65Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
"
finish
"
);
done
();
});
it
(
"
testHmacSHA1004
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSHA1KeyAlias004
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData65Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
"
abort
"
);
done
();
});
it
(
"
testHmacSM3001
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSM3KeyAlias001
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData63Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
finish
'
);
done
();
});
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
"
finish
"
);
done
();
});
it
(
'
testHmacSM3002
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSM3KeyAlias002
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData63Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
abort
'
);
done
();
});
it
(
'
testHmacSM3003
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSM3KeyAlias003
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData65Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
finish
'
);
done
();
});
it
(
'
testHmacSM3004
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSM3KeyAlias004
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData65Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
'
abort
'
);
done
();
it
(
"
testHmacSM3002
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSM3KeyAlias002
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData63Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
"
abort
"
);
done
();
});
it
(
"
testHmacSM3003
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSM3KeyAlias003
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData65Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
"
finish
"
);
done
();
});
it
(
"
testHmacSM3004
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSM3KeyAlias004
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData65Kb
,
};
await
publicHmacGenFunc
(
srcKeyAlies
,
HuksOptions
,
"
abort
"
);
done
();
});
});
});
}
security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/List.test.js
浏览文件 @
99f003d6
...
...
@@ -13,12 +13,11 @@
* limitations under the License.
*/
import
{
SecurityHuksAccessControlJsunit
}
from
'
./HMAC/SecurityHuksAccessControlJsunit.test.js
'
import
{
SecurityHuksHmacBasicCallbackJsunit_test
,
SecurityHuksHmacCallbackJsunit
}
from
'
./HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js
'
import
{
SecurityHuksImportJsunit
}
from
'
./HMAC/SecurityHuksImportJsunit.test.js
'
import
{
SecurityHuksAccessControlJsunit
}
from
"
./HMAC/SecurityHuksAccessControlJsunit.test.js
"
;
import
{
SecurityHuksHmacCallbackJsunit
}
from
"
./HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js
"
;
import
{
SecurityHuksImportJsunit
}
from
"
./HMAC/SecurityHuksImportJsunit.test.js
"
;
export
default
function
testsuite
()
{
SecurityHuksAccessControlJsunit
()
SecurityHuksHmacBasicCallbackJsunit_test
()
SecurityHuksHmacCallbackJsunit
()
SecurityHuksImportJsunit
()
SecurityHuksAccessControlJsunit
();
SecurityHuksHmacCallbackJsunit
();
SecurityHuksImportJsunit
();
}
security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/HMAC/SecurityHuksFaceFingerNormalJsunit.test.js
浏览文件 @
99f003d6
此差异已折叠。
点击以展开。
security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js
浏览文件 @
99f003d6
...
...
@@ -13,11 +13,11 @@
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
@ohos/hypium
'
;
import
huks
from
'
@ohos.security.huks
'
;
import
Data
from
'
../../../../../../utils/data.json
'
;
import
{
HuksHmac
}
from
'
../../../../../../utils/param/hmac/publicHmacParam.js
'
;
import
{
stringToArray
}
from
'
../../../../../../utils/param/publicFunc.js
'
;
import
{
describe
,
it
,
expect
}
from
"
@ohos/hypium
"
;
import
huks
from
"
@ohos.security.huks
"
;
import
Data
from
"
../../../../../../utils/data.json
"
;
import
{
HuksHmac
}
from
"
../../../../../../utils/param/hmac/publicHmacParam.js
"
;
import
{
stringToArray
}
from
"
../../../../../../utils/param/publicFunc.js
"
;
var
handle
;
let
srcData63Kb
=
Data
.
Date63KB
;
...
...
@@ -32,7 +32,7 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions) {
expect
(
data
.
errorCode
==
0
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
log
(
'
test generateKey err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test generateKey err information:
"
+
JSON
.
stringify
(
err
));
expect
(
null
).
assertFail
();
});
HuksOptions
.
properties
.
splice
(
1
,
1
);
...
...
@@ -63,19 +63,26 @@ async function publicHmacUpdateFunc(HuksOptions) {
let
count
=
Math
.
floor
(
inDataArray
.
length
/
dateSize
);
let
remainder
=
inDataArray
.
length
%
dateSize
;
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
huksOptionsInData
).
slice
(
dateSize
*
i
,
dateSize
*
(
i
+
1
)));
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
huksOptionsInData
).
slice
(
dateSize
*
i
,
dateSize
*
(
i
+
1
))
);
await
update
(
handle
,
HuksOptions
);
}
if
(
remainder
!==
0
)
{
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
huksOptionsInData
).
slice
(
dateSize
*
count
,
inDataArray
.
length
));
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
huksOptionsInData
).
slice
(
dateSize
*
count
,
inDataArray
.
length
)
);
await
update
(
handle
,
HuksOptions
);
}
}
}
async
function
publicHmacFinish
(
HuksOptions
,
thirdInderfaceName
)
{
if
(
thirdInderfaceName
==
'
finish
'
)
{
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
'
0
'
));
if
(
thirdInderfaceName
==
"
finish
"
)
{
HuksOptions
.
inData
=
new
Uint8Array
(
stringToArray
(
"
0
"
));
await
huks
.
finish
(
handle
,
HuksOptions
)
.
then
((
data
)
=>
{
...
...
@@ -83,10 +90,10 @@ async function publicHmacFinish(HuksOptions, thirdInderfaceName) {
expect
(
data
.
errorCode
==
0
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
log
(
'
test finish err information:
'
+
err
);
console
.
log
(
"
test finish err information:
"
+
err
);
expect
(
null
).
assertFail
();
});
}
else
if
(
thirdInderfaceName
==
'
abort
'
)
{
}
else
if
(
thirdInderfaceName
==
"
abort
"
)
{
await
huks
.
abort
(
handle
,
HuksOptions
)
.
then
((
data
)
=>
{
...
...
@@ -94,7 +101,7 @@ async function publicHmacFinish(HuksOptions, thirdInderfaceName) {
expect
(
data
.
errorCode
==
0
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
log
(
'
test abort err information:
'
+
err
);
console
.
log
(
"
test abort err information:
"
+
err
);
expect
(
null
).
assertFail
();
});
}
...
...
@@ -109,7 +116,7 @@ async function publicHmacDelete(srcKeyAlies, HuksOptions) {
expect
(
data
.
errorCode
==
0
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
log
(
'
test deleteKey err information:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
"
test deleteKey err information:
"
+
JSON
.
stringify
(
err
));
expect
(
null
).
assertFail
();
});
}
...
...
@@ -134,105 +141,124 @@ async function update(handle, HuksOptions) {
expect
(
data
.
errorCode
==
0
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
log
(
'
test update err information:
'
+
err
);
console
.
log
(
"
test update err information:
"
+
err
);
expect
(
null
).
assertFail
();
});
}
export
default
function
SecurityHuksHmacBasicPromiseJsunit
()
{
describe
(
'
SecurityHuksHmacBasicPromiseJsunit
'
,
function
()
{
it
(
'
testHmac101
'
,
0
,
async
function
(
done
)
{
const
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias101
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData63Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
'
finish
'
);
done
();
});
describe
(
"
SecurityHuksHmacBasicPromiseJsunit
"
,
function
()
{
it
(
"
testHmac101
"
,
0
,
async
function
(
done
)
{
const
srcKeyAlies
=
"
testHmacDigestSHA1KeyAlias101
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData63Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
"
finish
"
);
done
();
});
it
(
'
testHmac102
'
,
0
,
async
function
(
done
)
{
const
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias102
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData63Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
'
abort
'
);
done
();
});
it
(
"
testHmac102
"
,
0
,
async
function
(
done
)
{
const
srcKeyAlies
=
"
testHmacDigestSHA1KeyAlias102
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData63Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
"
abort
"
);
done
();
});
it
(
'
testHmac103
'
,
0
,
async
function
(
done
)
{
const
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias103
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData65Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
'
finish
'
);
done
();
});
it
(
"
testHmac103
"
,
0
,
async
function
(
done
)
{
const
srcKeyAlies
=
"
testHmacDigestSHA1KeyAlias103
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData65Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
"
finish
"
);
done
();
});
it
(
'
testHmac104
'
,
0
,
async
function
(
done
)
{
const
srcKeyAlies
=
'
testHmacDigestSHA1KeyAlias104
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData65Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
'
abort
'
);
done
();
});
it
(
'
testHmacSM3001
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSM3KeyAlias001
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData63Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
'
finish
'
);
done
();
});
it
(
"
testHmac104
"
,
0
,
async
function
(
done
)
{
const
srcKeyAlies
=
"
testHmacDigestSHA1KeyAlias104
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSHA1
),
inData
:
srcData65Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
"
abort
"
);
done
();
});
it
(
'
testHmacSM3002
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSM3KeyAlias002
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData63Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
'
abort
'
);
done
();
});
it
(
'
testHmacSM3003
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSM3KeyAlias003
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData65Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
'
finish
'
);
done
();
});
it
(
'
testHmacSM3004
'
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
'
testHmacDigestSM3KeyAlias004
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData65Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
'
abort
'
);
done
();
it
(
"
testHmacSM3101
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSM3KeyAlias001
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData63Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
"
finish
"
);
done
();
});
it
(
"
testHmacSM3102
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSM3KeyAlias002
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData63Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
"
abort
"
);
done
();
});
it
(
"
testHmacSM3103
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSM3KeyAlias003
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData65Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
"
finish
"
);
done
();
});
it
(
"
testHmacSM3104
"
,
0
,
async
function
(
done
)
{
let
srcKeyAlies
=
"
testHmacDigestSM3KeyAlias004
"
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksHmac
.
HuksKeyAlg
,
HuksHmac
.
HuksKeyPurpose
,
HuksHmac
.
HuksTagDigestSM3
),
inData
:
srcData65Kb
,
};
await
publicHmacFunc
(
srcKeyAlies
,
HuksOptions
,
"
abort
"
);
done
();
});
});
});
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录