Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e29fa0a0
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看板
未验证
提交
e29fa0a0
编写于
3月 16, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 16, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8007 适配必选算法2monthlyy
Merge pull request !8007 from 伞木希美/cherry-pick-1678892665
上级
b0dab9bc
3fbfac3c
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
1945 addition
and
1851 deletion
+1945
-1851
security/huks_napi_BasicTest/include/huks_three_stage_test_common.h
...uks_napi_BasicTest/include/huks_three_stage_test_common.h
+1
-0
security/huks_napi_BasicTest/src/huks_attest_test.cpp
security/huks_napi_BasicTest/src/huks_attest_test.cpp
+24
-18
security/huks_napi_BasicTest/src/huks_derive_pbkdf_test.cpp
security/huks_napi_BasicTest/src/huks_derive_pbkdf_test.cpp
+2
-7
security/huks_napi_BasicTest/src/huks_signverify_dsa_test.cpp
...rity/huks_napi_BasicTest/src/huks_signverify_dsa_test.cpp
+28
-22
security/huks_napi_BasicTest/src/huks_three_stage_test_common.cpp
.../huks_napi_BasicTest/src/huks_three_stage_test_common.cpp
+26
-0
security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksImportJsunit.test.js
...st/src/main/js/test/HMAC/SecurityHuksImportJsunit.test.js
+16
-14
security/security_huks_reformed_test/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksImportJsunit.test.js
...st/src/main/js/test/HMAC/SecurityHuksImportJsunit.test.js
+65
-57
security/security_huks_reformed_test/huks_signverify_callback_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBCallbackJsunit.test.js
...erify/SecurityHuksDSABasicAbort63KBCallbackJsunit.test.js
+1
-1
security/security_huks_reformed_test/huks_signverify_callback_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBCallbackJsunit.test.js
...erify/SecurityHuksDSABasicAbort65KBCallbackJsunit.test.js
+1
-1
security/security_huks_reformed_test/huks_signverify_callback_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBCallbackJsunit.test.js
...rify/SecurityHuksDSABasicFinish63KBCallbackJsunit.test.js
+1
-1
security/security_huks_reformed_test/huks_signverify_callback_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBCallbackJsunit.test.js
...rify/SecurityHuksDSABasicFinish65KBCallbackJsunit.test.js
+1
-1
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBPromiseJsunit.test.js
...Verify/SecurityHuksDSABasicAbort63KBPromiseJsunit.test.js
+1
-1
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBPromiseJsunit.test.js
...Verify/SecurityHuksDSABasicAbort65KBPromiseJsunit.test.js
+2
-2
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBPromiseJsunit.test.js
...erify/SecurityHuksDSABasicFinish63KBPromiseJsunit.test.js
+1
-1
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBPromiseJsunit.test.js
...erify/SecurityHuksDSABasicFinish65KBPromiseJsunit.test.js
+1
-1
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish65KBPromiseJsunit.test.js
...erify/SecurityHuksECCBasicFinish65KBPromiseJsunit.test.js
+452
-435
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish65KBPromiseJsunit.test.js
...erify/SecurityHuksRSABasicFinish65KBPromiseJsunit.test.js
+1192
-1169
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksRSASignExtendJsunit.test.js
...s/test/SignVerify/SecurityHuksRSASignExtendJsunit.test.js
+130
-120
未找到文件。
security/huks_napi_BasicTest/include/huks_three_stage_test_common.h
浏览文件 @
e29fa0a0
...
...
@@ -92,6 +92,7 @@ extern "C"
const
struct
OH_Huks_Blob
*
keyAlias
,
const
struct
OH_Huks_Blob
*
peerPublicKey
,
struct
OH_Huks_Blob
*
agreedKey
);
bool
checkUseSoftware
();
#ifdef __cplusplus
}
#endif
...
...
security/huks_napi_BasicTest/src/huks_attest_test.cpp
浏览文件 @
e29fa0a0
...
...
@@ -23,6 +23,7 @@ namespace Unittest::AttestKey {
static
struct
OH_Huks_Blob
g_secInfo
=
{
sizeof
(
SEC_INFO_DATA
),
(
uint8_t
*
)
SEC_INFO_DATA
};
static
struct
OH_Huks_Blob
g_challenge
=
{
sizeof
(
CHALLENGE_DATA
),
(
uint8_t
*
)
CHALLENGE_DATA
};
static
struct
OH_Huks_Blob
g_version
=
{
sizeof
(
VERSION_DATA
),
(
uint8_t
*
)
VERSION_DATA
};
bool
useSoftware
=
true
;
class
HuksAttestKeyNoIdsTest
:
public
testing
::
Test
{
public:
...
...
@@ -37,6 +38,7 @@ public:
void
HuksAttestKeyNoIdsTest
::
SetUpTestCase
(
void
)
{
useSoftware
=
checkUseSoftware
();
}
void
HuksAttestKeyNoIdsTest
::
TearDownTestCase
(
void
)
...
...
@@ -68,23 +70,27 @@ static const struct OH_Huks_Param g_commonParams[] = {
*/
HWTEST_F
(
HuksAttestKeyNoIdsTest
,
Security_HUKS_NAPI_Attest_0100
,
TestSize
.
Level0
)
{
OH_Huks_Result
ret
=
TestGenerateKey
(
&
g_keyAlias
);
ASSERT_TRUE
(
ret
.
errorCode
==
(
int32_t
)
OH_HUKS_SUCCESS
);
struct
OH_Huks_ParamSet
*
paramSet
=
NULL
;
GenerateParamSet
(
&
paramSet
,
g_commonParams
,
sizeof
(
g_commonParams
)
/
sizeof
(
g_commonParams
[
0
]));
OH_Huks_CertChain
*
certChain
=
NULL
;
const
struct
HksTestCertChain
certParam
=
{
true
,
true
,
true
,
g_size
};
(
void
)
ConstructDataToCertChain
(
&
certChain
,
&
certParam
);
ret
=
OH_Huks_AttestKeyItem
(
&
g_keyAlias
,
paramSet
,
certChain
);
ASSERT_TRUE
(
ret
.
errorCode
==
(
int32_t
)
OH_HUKS_SUCCESS
);
ret
=
ValidateCertChainTest
(
certChain
,
g_commonParams
,
NON_IDS_PARAM
);
ASSERT_TRUE
(
ret
.
errorCode
==
(
int32_t
)
OH_HUKS_SUCCESS
);
FreeCertChain
(
&
certChain
,
certChain
->
certsCount
);
certChain
=
NULL
;
OH_Huks_FreeParamSet
(
&
paramSet
);
OH_Huks_Result
ret1
=
OH_Huks_DeleteKeyItem
(
&
g_keyAlias
,
NULL
);
ASSERT_TRUE
(
ret1
.
errorCode
==
(
int32_t
)
OH_HUKS_SUCCESS
);
if
(
useSoftware
)
{
OH_Huks_Result
ret
=
TestGenerateKey
(
&
g_keyAlias
);
ASSERT_TRUE
(
ret
.
errorCode
==
(
int32_t
)
OH_HUKS_SUCCESS
);
struct
OH_Huks_ParamSet
*
paramSet
=
NULL
;
GenerateParamSet
(
&
paramSet
,
g_commonParams
,
sizeof
(
g_commonParams
)
/
sizeof
(
g_commonParams
[
0
]));
OH_Huks_CertChain
*
certChain
=
NULL
;
const
struct
HksTestCertChain
certParam
=
{
true
,
true
,
true
,
g_size
};
(
void
)
ConstructDataToCertChain
(
&
certChain
,
&
certParam
);
ret
=
OH_Huks_AttestKeyItem
(
&
g_keyAlias
,
paramSet
,
certChain
);
ASSERT_TRUE
(
ret
.
errorCode
==
(
int32_t
)
OH_HUKS_SUCCESS
);
ret
=
ValidateCertChainTest
(
certChain
,
g_commonParams
,
NON_IDS_PARAM
);
ASSERT_TRUE
(
ret
.
errorCode
==
(
int32_t
)
OH_HUKS_SUCCESS
);
FreeCertChain
(
&
certChain
,
certChain
->
certsCount
);
certChain
=
NULL
;
OH_Huks_FreeParamSet
(
&
paramSet
);
OH_Huks_Result
ret1
=
OH_Huks_DeleteKeyItem
(
&
g_keyAlias
,
NULL
);
ASSERT_TRUE
(
ret1
.
errorCode
==
(
int32_t
)
OH_HUKS_SUCCESS
);
}
ASSERT_TRUE
(
0
==
0
);
}
}
security/huks_napi_BasicTest/src/huks_derive_pbkdf_test.cpp
浏览文件 @
e29fa0a0
...
...
@@ -48,7 +48,6 @@ void HuksDerivePBKDFTest::TearDown()
{
}
uint8_t
g_saltdata1
[
16
]
=
{
0
};
uint8_t
g_saltgen
[
16
]
=
{
0x14
,
0x10
,
0x11
,
0x3a
,
0x27
,
0x9e
,
0xc8
,
0x5f
,
0xe0
,
0xf3
,
0x36
,
0x17
,
0x57
,
0x42
,
0x8e
,
0xff
};
...
...
@@ -96,8 +95,8 @@ static struct OH_Huks_Param g_pbkdf2Params001[] = {
},
{
.
tag
=
OH_HUKS_TAG_SALT
,
.
blob
=
{
sizeof
(
g_salt
data1
),
(
uint8_t
*
)
g_salt
data1
sizeof
(
g_salt
gen
),
(
uint8_t
*
)
g_salt
gen
}
},
{
.
tag
=
OH_HUKS_TAG_DERIVE_KEY_SIZE
,
...
...
@@ -148,10 +147,6 @@ HWTEST_F(HuksDerivePBKDFTest, Security_HUKS_NAPI_Derive_pbkdf_0100, TestSize.Lev
struct
OH_Huks_ParamSet
*
pbkdf2FinishParamSet
=
nullptr
;
ret
=
InitParamSet
(
&
pbkdf2ParamSet
,
g_pbkdf2Params001
,
sizeof
(
g_pbkdf2Params001
)
/
sizeof
(
OH_Huks_Param
));
EXPECT_EQ
(
ret
.
errorCode
,
(
int32_t
)
OH_HUKS_SUCCESS
)
<<
"InitParamSet failed."
;
struct
OH_Huks_Param
*
saltParam
=
nullptr
;
OH_Huks_GetParam
(
pbkdf2ParamSet
,
OH_HUKS_TAG_SALT
,
&
saltParam
);
int32_t
ret1
=
HksGenerateRandom
(
NULL
,
(
struct
HksBlob
*
)
&
(
saltParam
->
blob
));
EXPECT_EQ
(
ret1
,
(
int32_t
)
OH_HUKS_SUCCESS
)
<<
"GenerateRandom failed."
;
// Finish paramset
ret
=
InitParamSet
(
&
pbkdf2FinishParamSet
,
g_pbkdf2FinishParams001
,
sizeof
(
g_pbkdf2FinishParams001
)
/
sizeof
(
OH_Huks_Param
));
...
...
security/huks_napi_BasicTest/src/huks_signverify_dsa_test.cpp
浏览文件 @
e29fa0a0
...
...
@@ -19,6 +19,7 @@
using
namespace
testing
::
ext
;
namespace
Unittest
::
DsaSignVerify
{
bool
useSoftware
=
true
;
class
HuksSignVerifyDSATest
:
public
testing
::
Test
{
public:
static
void
SetUpTestCase
(
void
);
...
...
@@ -32,6 +33,7 @@ public:
void
HuksSignVerifyDSATest
::
SetUpTestCase
(
void
)
{
useSoftware
=
checkUseSoftware
();
}
void
HuksSignVerifyDSATest
::
TearDownTestCase
(
void
)
...
...
@@ -163,28 +165,32 @@ OH_Huks_Result HksDsaSignVerifyTestNormalCase(struct OH_Huks_Blob keyAlias, stru
*/
HWTEST_F
(
HuksSignVerifyDSATest
,
Security_HUKS_NAPI_SignVerify_DSA_0100
,
TestSize
.
Level0
)
{
const
char
*
keyAliasString
=
"HksDSASignVerifyKeyAliasTest001"
;
struct
OH_Huks_ParamSet
*
genParamSet
=
nullptr
;
struct
OH_Huks_ParamSet
*
signParamSet
=
nullptr
;
struct
OH_Huks_ParamSet
*
verifyParamSet
=
nullptr
;
struct
OH_Huks_Blob
keyAlias
=
{
strlen
(
keyAliasString
),
(
uint8_t
*
)
keyAliasString
};
OH_Huks_Result
ret
=
InitParamSet
(
&
genParamSet
,
g_genParamsTest001
,
sizeof
(
g_genParamsTest001
)
/
sizeof
(
OH_Huks_Param
));
EXPECT_EQ
(
ret
.
errorCode
,
(
int32_t
)
OH_HUKS_SUCCESS
)
<<
"InitParamSet failed."
;
ret
=
InitParamSet
(
&
signParamSet
,
g_signParamsTest001
,
sizeof
(
g_signParamsTest001
)
/
sizeof
(
OH_Huks_Param
));
EXPECT_EQ
(
ret
.
errorCode
,
(
int32_t
)
OH_HUKS_SUCCESS
)
<<
"InitParamSet failed."
;
ret
=
InitParamSet
(
&
verifyParamSet
,
g_verifyParamsTest001
,
sizeof
(
g_verifyParamsTest001
)
/
sizeof
(
OH_Huks_Param
));
EXPECT_EQ
(
ret
.
errorCode
,
(
int32_t
)
OH_HUKS_SUCCESS
)
<<
"InitParamSet failed."
;
if
((
genParamSet
!=
nullptr
)
||
(
signParamSet
!=
nullptr
)
||
(
verifyParamSet
!=
nullptr
))
{
ret
=
HksDsaSignVerifyTestNormalCase
(
keyAlias
,
genParamSet
,
signParamSet
,
verifyParamSet
);
if
(
useSoftware
)
{
const
char
*
keyAliasString
=
"HksDSASignVerifyKeyAliasTest001"
;
struct
OH_Huks_ParamSet
*
genParamSet
=
nullptr
;
struct
OH_Huks_ParamSet
*
signParamSet
=
nullptr
;
struct
OH_Huks_ParamSet
*
verifyParamSet
=
nullptr
;
struct
OH_Huks_Blob
keyAlias
=
{
strlen
(
keyAliasString
),
(
uint8_t
*
)
keyAliasString
};
OH_Huks_Result
ret
=
InitParamSet
(
&
genParamSet
,
g_genParamsTest001
,
sizeof
(
g_genParamsTest001
)
/
sizeof
(
OH_Huks_Param
));
EXPECT_EQ
(
ret
.
errorCode
,
(
int32_t
)
OH_HUKS_SUCCESS
)
<<
"InitParamSet failed."
;
ret
=
InitParamSet
(
&
signParamSet
,
g_signParamsTest001
,
sizeof
(
g_signParamsTest001
)
/
sizeof
(
OH_Huks_Param
));
EXPECT_EQ
(
ret
.
errorCode
,
(
int32_t
)
OH_HUKS_SUCCESS
)
<<
"InitParamSet failed."
;
ret
=
InitParamSet
(
&
verifyParamSet
,
g_verifyParamsTest001
,
sizeof
(
g_verifyParamsTest001
)
/
sizeof
(
OH_Huks_Param
));
EXPECT_EQ
(
ret
.
errorCode
,
(
int32_t
)
OH_HUKS_SUCCESS
)
<<
"InitParamSet failed."
;
if
((
genParamSet
!=
nullptr
)
||
(
signParamSet
!=
nullptr
)
||
(
verifyParamSet
!=
nullptr
))
{
ret
=
HksDsaSignVerifyTestNormalCase
(
keyAlias
,
genParamSet
,
signParamSet
,
verifyParamSet
);
}
/* 5. Delete Key */
ret
=
OH_Huks_DeleteKeyItem
(
&
keyAlias
,
genParamSet
);
EXPECT_EQ
(
ret
.
errorCode
,
(
int32_t
)
OH_HUKS_SUCCESS
)
<<
"DeleteKey failed."
;
OH_Huks_FreeParamSet
(
&
genParamSet
);
OH_Huks_FreeParamSet
(
&
signParamSet
);
OH_Huks_FreeParamSet
(
&
verifyParamSet
);
}
/* 5. Delete Key */
ret
=
OH_Huks_DeleteKeyItem
(
&
keyAlias
,
genParamSet
);
EXPECT_EQ
(
ret
.
errorCode
,
(
int32_t
)
OH_HUKS_SUCCESS
)
<<
"DeleteKey failed."
;
OH_Huks_FreeParamSet
(
&
genParamSet
);
OH_Huks_FreeParamSet
(
&
signParamSet
);
OH_Huks_FreeParamSet
(
&
verifyParamSet
);
ASSERT_TRUE
(
0
==
0
);
}
}
// namespace Unittest::DsaSignVerify
\ No newline at end of file
security/huks_napi_BasicTest/src/huks_three_stage_test_common.cpp
浏览文件 @
e29fa0a0
...
...
@@ -15,6 +15,17 @@
#include "huks_three_stage_test_common.h"
static
struct
OH_Huks_Param
g_genParamsTest001
[]
=
{
{.
tag
=
OH_HUKS_TAG_ALGORITHM
,
.
uint32Param
=
OH_HUKS_ALG_DSA
},
{.
tag
=
OH_HUKS_TAG_PURPOSE
,
.
uint32Param
=
OH_HUKS_KEY_PURPOSE_SIGN
|
OH_HUKS_KEY_PURPOSE_VERIFY
},
{.
tag
=
OH_HUKS_TAG_KEY_SIZE
,
.
uint32Param
=
1024
},
{.
tag
=
OH_HUKS_TAG_DIGEST
,
.
uint32Param
=
OH_HUKS_DIGEST_SHA1
}
};
OH_Huks_Result
InitParamSet
(
struct
OH_Huks_ParamSet
**
paramSet
,
const
struct
OH_Huks_Param
*
params
,
...
...
@@ -680,4 +691,19 @@ OH_Huks_Result HuksAgreeKey(const struct OH_Huks_ParamSet *paramSet, const struc
return
ret
;
}
return
ret
;
}
bool
checkUseSoftware
()
{
const
char
*
keyAliasString
=
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
;
struct
OH_Huks_ParamSet
*
genParamSet
=
nullptr
;
struct
OH_Huks_Blob
keyAlias
=
{
strlen
(
keyAliasString
),
(
uint8_t
*
)
keyAliasString
};
InitParamSet
(
&
genParamSet
,
g_genParamsTest001
,
sizeof
(
g_genParamsTest001
)
/
sizeof
(
OH_Huks_Param
));
OH_Huks_Result
ret
=
OH_Huks_GenerateKeyItem
(
&
keyAlias
,
genParamSet
,
nullptr
);
if
(
ret
.
errorCode
==
0
){
OH_Huks_DeleteKeyItem
(
&
keyAlias
,
genParamSet
);
OH_Huks_FreeParamSet
(
&
genParamSet
);
return
true
;
}
return
false
;
}
\ No newline at end of file
security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksImportJsunit.test.js
浏览文件 @
e29fa0a0
...
...
@@ -788,20 +788,22 @@ export function SecurityHuksImportJsunit() {
it
(
'
HUKS_Basic_Capability_Import_2000
'
,
0
,
async
function
(
done
)
{
const
srcKeyAlies
=
'
HUKS_Basic_Capability_Import_2000
'
;
let
HuksOptions
=
{
properties
:
new
Array
(
HuksAgreeECDH
.
HuksKeyAlgECC
,
HuksAgreeECDH
.
HuksKeyPurposeECDH
,
HuksAgreeECDH
.
HuksKeyECCSize224
,
HuksAgreeECDH
.
HuksKeyECCDIGEST
,
HuksAgreeECDH
.
HuksKeyECCPADDING
,
HuksAgreeECDH
.
HuksKeyECCBLOCKMODE
,
{
tag
:
huks
.
HuksTag
.
HUKS_TAG_IMPORT_KEY_TYPE
,
value
:
huks
.
HuksImportKeyType
.
HUKS_KEY_TYPE_KEY_PAIR
}
),
inData
:
ecc224Key
,
};
await
publicImportKey
(
srcKeyAlies
,
HuksOptions
);
await
publicDeleteKeyFunc
(
srcKeyAlies
,
HuksOptions
);
if
(
useSoftware
)
{
let
HuksOptions
=
{
properties
:
new
Array
(
HuksAgreeECDH
.
HuksKeyAlgECC
,
HuksAgreeECDH
.
HuksKeyPurposeECDH
,
HuksAgreeECDH
.
HuksKeyECCSize224
,
HuksAgreeECDH
.
HuksKeyECCDIGEST
,
HuksAgreeECDH
.
HuksKeyECCPADDING
,
HuksAgreeECDH
.
HuksKeyECCBLOCKMODE
,
{
tag
:
huks
.
HuksTag
.
HUKS_TAG_IMPORT_KEY_TYPE
,
value
:
huks
.
HuksImportKeyType
.
HUKS_KEY_TYPE_KEY_PAIR
}
),
inData
:
ecc224Key
,
};
await
publicImportKey
(
srcKeyAlies
,
HuksOptions
);
await
publicDeleteKeyFunc
(
srcKeyAlies
,
HuksOptions
);
}
done
();
});
...
...
security/security_huks_reformed_test/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksImportJsunit.test.js
浏览文件 @
e29fa0a0
...
...
@@ -1098,35 +1098,39 @@ export function SecurityHuksImportJsunit() {
it
(
'
HUKS_Basic_Capability_Import_Reformed_0300
'
,
0
,
async
function
(
done
)
{
const
srcKeyAliesWrap
=
'
HUKS_Basic_Capability_Import_0200
'
;
await
generateAndExportPublicKey
(
srcKeyAliesWrap
,
genWrappingKeyParams
,
false
);
await
generateAndExportPublicKey
(
callerKeyAlias
,
genCallerEcdhParams
,
true
);
await
ImportKekAndAgreeSharedSecret
(
callerKekAliasAes256
,
importParamsCallerKek
,
callerKeyAlias
,
huksPubKey
,
callerAgreeParams
);
await
EncryptImportedPlainKeyAndKek
(
importedAes192PlainKey
);
let
wrappedData
=
await
BuildWrappedDataAndImportWrappedKey
(
importedAes192PlainKey
);
importWrappedAes192Params
.
inData
=
wrappedData
;
await
publicImportWrappedKeyFunc
(
importedKeyAliasAes192
,
srcKeyAliesWrap
,
importWrappedAes192Params
);
await
publicDeleteKeyItemFunc
(
srcKeyAliesWrap
,
genWrappingKeyParams
);
await
publicDeleteKeyItemFunc
(
callerKeyAlias
,
genCallerEcdhParams
);
await
publicDeleteKeyItemFunc
(
importedKeyAliasAes192
,
importWrappedAes192Params
);
await
publicDeleteKeyItemFunc
(
callerKekAliasAes256
,
callerAgreeParams
);
if
(
useSoftware
)
{
await
generateAndExportPublicKey
(
srcKeyAliesWrap
,
genWrappingKeyParams
,
false
);
await
generateAndExportPublicKey
(
callerKeyAlias
,
genCallerEcdhParams
,
true
);
await
ImportKekAndAgreeSharedSecret
(
callerKekAliasAes256
,
importParamsCallerKek
,
callerKeyAlias
,
huksPubKey
,
callerAgreeParams
);
await
EncryptImportedPlainKeyAndKek
(
importedAes192PlainKey
);
let
wrappedData
=
await
BuildWrappedDataAndImportWrappedKey
(
importedAes192PlainKey
);
importWrappedAes192Params
.
inData
=
wrappedData
;
await
publicImportWrappedKeyFunc
(
importedKeyAliasAes192
,
srcKeyAliesWrap
,
importWrappedAes192Params
);
await
publicDeleteKeyItemFunc
(
srcKeyAliesWrap
,
genWrappingKeyParams
);
await
publicDeleteKeyItemFunc
(
callerKeyAlias
,
genCallerEcdhParams
);
await
publicDeleteKeyItemFunc
(
importedKeyAliasAes192
,
importWrappedAes192Params
);
await
publicDeleteKeyItemFunc
(
callerKekAliasAes256
,
callerAgreeParams
);
}
done
();
});
it
(
'
HUKS_Basic_Capability_Import_Reformed_0400
'
,
0
,
async
function
(
done
)
{
const
srcKeyAliesWrap
=
'
HUKS_Basic_Capability_Import_0400
'
;
await
generateAndExportPublicKey
(
srcKeyAliesWrap
,
genWrappingKeyParamsX25519
,
false
);
await
generateAndExportPublicKey
(
callerKeyAlias
,
genCallerX25519Params
,
true
);
await
ImportKekAndAgreeSharedSecret
(
callerKekAliasAes256
,
importParamsCallerKek
,
callerKeyAlias
,
huksPubKey
,
callerAgreeParamsX25519
);
await
EncryptImportedPlainKeyAndKek
(
importedAes192PlainKey
);
let
wrappedData
=
await
BuildWrappedDataAndImportWrappedKey
(
importedAes192PlainKey
);
importWrappedAes192ParamsX25519
.
inData
=
wrappedData
;
await
publicImportWrappedKeyFunc
(
importedKeyAliasAes192
,
srcKeyAliesWrap
,
importWrappedAes192ParamsX25519
);
await
publicDeleteKeyItemFunc
(
srcKeyAliesWrap
,
genWrappingKeyParamsX25519
);
await
publicDeleteKeyItemFunc
(
callerKeyAlias
,
genCallerX25519Params
);
await
publicDeleteKeyItemFunc
(
importedKeyAliasAes192
,
importWrappedAes192ParamsX25519
);
await
publicDeleteKeyItemFunc
(
callerKekAliasAes256
,
callerAgreeParams
);
if
(
useSoftware
)
{
await
generateAndExportPublicKey
(
srcKeyAliesWrap
,
genWrappingKeyParamsX25519
,
false
);
await
generateAndExportPublicKey
(
callerKeyAlias
,
genCallerX25519Params
,
true
);
await
ImportKekAndAgreeSharedSecret
(
callerKekAliasAes256
,
importParamsCallerKek
,
callerKeyAlias
,
huksPubKey
,
callerAgreeParamsX25519
);
await
EncryptImportedPlainKeyAndKek
(
importedAes192PlainKey
);
let
wrappedData
=
await
BuildWrappedDataAndImportWrappedKey
(
importedAes192PlainKey
);
importWrappedAes192ParamsX25519
.
inData
=
wrappedData
;
await
publicImportWrappedKeyFunc
(
importedKeyAliasAes192
,
srcKeyAliesWrap
,
importWrappedAes192ParamsX25519
);
await
publicDeleteKeyItemFunc
(
srcKeyAliesWrap
,
genWrappingKeyParamsX25519
);
await
publicDeleteKeyItemFunc
(
callerKeyAlias
,
genCallerX25519Params
);
await
publicDeleteKeyItemFunc
(
importedKeyAliasAes192
,
importWrappedAes192ParamsX25519
);
await
publicDeleteKeyItemFunc
(
callerKekAliasAes256
,
callerAgreeParams
);
}
done
();
});
...
...
@@ -1556,45 +1560,49 @@ export function SecurityHuksImportJsunit() {
it
(
'
HUKS_Basic_Capability_Import_Reformed_2600
'
,
0
,
async
function
(
done
)
{
const
srcKeyAliesWrap
=
'
HUKS_Basic_Capability_Import_0200
'
;
await
generateAndExportPublicKey
(
srcKeyAliesWrap
,
genWrappingKeyParams
,
false
);
await
generateAndExportPublicKey
(
callerKeyAlias
,
genCallerEcdhParams
,
true
);
await
ImportKekAndAgreeSharedSecret
(
callerKekAliasAes256
,
importParamsCallerKek
,
callerKeyAlias
,
huksPubKey
,
callerAgreeParams
);
await
EncryptImportedPlainKeyAndKek
(
importedAes192PlainKey
);
let
wrappedData
=
await
BuildWrappedDataAndImportWrappedKey
(
importedAes192PlainKey
);
importWrappedAes192Params
.
inData
=
wrappedData
;
await
publicImportWrappedKeyPromise
(
importedKeyAliasAes192
,
srcKeyAliesWrap
,
importWrappedAes192Params
);
await
publicImportWrappedKeyPromise
(
importedKeyAliasAes192
,
srcKeyAliesWrap
,
importWrappedAes192Params
);
await
publicDeleteKeyItemFunc
(
srcKeyAliesWrap
,
genWrappingKeyParams
);
await
publicDeleteKeyItemFunc
(
callerKeyAlias
,
genCallerEcdhParams
);
await
publicDeleteKeyItemFunc
(
importedKeyAliasAes192
,
importWrappedAes192Params
);
await
publicDeleteKeyItemFunc
(
callerKekAliasAes256
,
callerAgreeParams
);
if
(
useSoftware
)
{
await
generateAndExportPublicKey
(
srcKeyAliesWrap
,
genWrappingKeyParams
,
false
);
await
generateAndExportPublicKey
(
callerKeyAlias
,
genCallerEcdhParams
,
true
);
await
ImportKekAndAgreeSharedSecret
(
callerKekAliasAes256
,
importParamsCallerKek
,
callerKeyAlias
,
huksPubKey
,
callerAgreeParams
);
await
EncryptImportedPlainKeyAndKek
(
importedAes192PlainKey
);
let
wrappedData
=
await
BuildWrappedDataAndImportWrappedKey
(
importedAes192PlainKey
);
importWrappedAes192Params
.
inData
=
wrappedData
;
await
publicImportWrappedKeyPromise
(
importedKeyAliasAes192
,
srcKeyAliesWrap
,
importWrappedAes192Params
);
await
publicImportWrappedKeyPromise
(
importedKeyAliasAes192
,
srcKeyAliesWrap
,
importWrappedAes192Params
);
await
publicDeleteKeyItemFunc
(
srcKeyAliesWrap
,
genWrappingKeyParams
);
await
publicDeleteKeyItemFunc
(
callerKeyAlias
,
genCallerEcdhParams
);
await
publicDeleteKeyItemFunc
(
importedKeyAliasAes192
,
importWrappedAes192Params
);
await
publicDeleteKeyItemFunc
(
callerKekAliasAes256
,
callerAgreeParams
);
}
done
();
});
it
(
'
HUKS_Basic_Capability_Import_Reformed_2700
'
,
0
,
async
function
(
done
)
{
const
srcKeyAliesWrap
=
'
HUKS_Basic_Capability_Import_2700
'
;
await
generateAndExportPublicKey
(
srcKeyAliesWrap
,
genWrappingKeyParams
,
false
);
await
generateAndExportPublicKey
(
callerKeyAlias
,
genCallerEcdhParams
,
true
);
await
ImportKekAndAgreeSharedSecret
(
callerKekAliasAes256
,
importParamsCallerKek
,
callerKeyAlias
,
huksPubKey
,
callerAgreeParams
);
await
EncryptImportedPlainKeyAndKek
(
importedAes192PlainKey
);
let
wrappedData
=
await
BuildWrappedDataAndImportWrappedKey
(
importedAes192PlainKey
);
importWrappedAes192ParamsX25519
.
inData
=
wrappedData
;
try
{
await
importWrappedKeyItem
(
importedKeyAliasAes192
,
srcKeyAliesWrap
,
importWrappedAes192ParamsX25519
)
.
then
((
data
)
=>
{
console
.
info
(
`callback: importWrappedKeyItem success, data =
${
JSON
.
stringify
(
data
)}
`
);
})
.
catch
(
error
=>
{
console
.
error
(
`callback: importWrappedKeyItem failed, code:
${
error
.
code
}
, msg:
${
error
.
message
}
`
);
expect
(
error
.
code
==
12000006
).
assertTrue
();
});
}
catch
(
error
)
{
console
.
error
(
`callback: importWrappedKeyItem input arg invalid, code:
${
error
.
code
}
, msg:
${
error
.
message
}
`
);
expect
(
null
).
assertFail
();
if
(
useSoftware
)
{
await
generateAndExportPublicKey
(
srcKeyAliesWrap
,
genWrappingKeyParams
,
false
);
await
generateAndExportPublicKey
(
callerKeyAlias
,
genCallerEcdhParams
,
true
);
await
ImportKekAndAgreeSharedSecret
(
callerKekAliasAes256
,
importParamsCallerKek
,
callerKeyAlias
,
huksPubKey
,
callerAgreeParams
);
await
EncryptImportedPlainKeyAndKek
(
importedAes192PlainKey
);
let
wrappedData
=
await
BuildWrappedDataAndImportWrappedKey
(
importedAes192PlainKey
);
importWrappedAes192ParamsX25519
.
inData
=
wrappedData
;
try
{
await
importWrappedKeyItem
(
importedKeyAliasAes192
,
srcKeyAliesWrap
,
importWrappedAes192ParamsX25519
)
.
then
((
data
)
=>
{
console
.
info
(
`callback: importWrappedKeyItem success, data =
${
JSON
.
stringify
(
data
)}
`
);
})
.
catch
(
error
=>
{
console
.
error
(
`callback: importWrappedKeyItem failed, code:
${
error
.
code
}
, msg:
${
error
.
message
}
`
);
expect
(
error
.
code
==
12000006
).
assertTrue
();
});
}
catch
(
error
)
{
console
.
error
(
`callback: importWrappedKeyItem input arg invalid, code:
${
error
.
code
}
, msg:
${
error
.
message
}
`
);
expect
(
null
).
assertFail
();
}
await
publicDeleteKeyItemFunc
(
srcKeyAliesWrap
,
genWrappingKeyParams
);
await
publicDeleteKeyItemFunc
(
callerKeyAlias
,
genCallerEcdhParams
);
}
await
publicDeleteKeyItemFunc
(
srcKeyAliesWrap
,
genWrappingKeyParams
);
await
publicDeleteKeyItemFunc
(
callerKeyAlias
,
genCallerEcdhParams
);
done
();
});
...
...
security/security_huks_reformed_test/huks_signverify_callback_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBCallbackJsunit.test.js
浏览文件 @
e29fa0a0
...
...
@@ -23,7 +23,7 @@ let useSoftware = true;
export
default
function
SecurityHuksDSABasicAbort63KBCallbackJsunit
()
{
describe
(
'
SecurityHuksDSABasicAbort63KBCallbackJsunit
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
useSoftware
=
checkSoftware
();
useSoftware
=
await
checkSoftware
();
done
();
})
it
(
'
testReformedSignVerifyDSA002
'
,
0
,
async
function
(
done
)
{
...
...
security/security_huks_reformed_test/huks_signverify_callback_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBCallbackJsunit.test.js
浏览文件 @
e29fa0a0
...
...
@@ -24,7 +24,7 @@ let useSoftware = true;
export
default
function
SecurityHuksDSABasicAbort65KBCallbackJsunit
()
{
describe
(
'
SecurityHuksDSABasicAbort65KBCallbackJsunit
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
useSoftware
=
checkSoftware
();
useSoftware
=
await
checkSoftware
();
done
();
})
it
(
'
testReformedSignVerifyDSA004
'
,
0
,
async
function
(
done
)
{
...
...
security/security_huks_reformed_test/huks_signverify_callback_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBCallbackJsunit.test.js
浏览文件 @
e29fa0a0
...
...
@@ -24,7 +24,7 @@ let useSoftware = true;
export
default
function
SecurityHuksDSABasicFinish63KBCallbackJsunit
()
{
describe
(
'
SecurityHuksDSABasicFinish63KBCallbackJsunit
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
useSoftware
=
checkSoftware
();
useSoftware
=
await
checkSoftware
();
done
();
})
it
(
'
testReformedSignVerifyDSA001
'
,
0
,
async
function
(
done
)
{
...
...
security/security_huks_reformed_test/huks_signverify_callback_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBCallbackJsunit.test.js
浏览文件 @
e29fa0a0
...
...
@@ -24,7 +24,7 @@ let useSoftware = true;
export
default
function
SecurityHuksDSABasicFinish65KBCallbackJsunit
()
{
describe
(
'
SecurityHuksDSABasicFinish65KBCallbackJsunit
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
useSoftware
=
checkSoftware
();
useSoftware
=
await
checkSoftware
();
done
();
})
it
(
'
testReformedSignVerifyDSA003
'
,
0
,
async
function
(
done
)
{
...
...
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort63KBPromiseJsunit.test.js
浏览文件 @
e29fa0a0
...
...
@@ -23,7 +23,7 @@ let useSoftware = true;
export
default
function
SecurityHuksDSABasicAbort63KBPromiseJsunit
()
{
describe
(
'
SecurityHuksDSABasicAbort63KBPromiseJsunit
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
useSoftware
=
checkSoftware
();
useSoftware
=
await
checkSoftware
();
done
();
})
it
(
'
testReformedSignVerifyDSA102
'
,
0
,
async
function
(
done
)
{
...
...
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicAbort65KBPromiseJsunit.test.js
浏览文件 @
e29fa0a0
...
...
@@ -15,7 +15,7 @@
import
{
describe
,
it
,
beforeAll
}
from
'
@ohos/hypium
'
;
import
Data
from
'
../../../../../../utils/data.json
'
;
import
{
HuksSignVerifyDSA
}
from
'
../../../../../../utils/param/signverify/publicSignverifyParam
'
;
import
{
stringToUint8Array
,
checkSoftware
}
from
'
../../../../../../utils/param/publicFunc
'
;
import
{
stringToUint8Array
,
checkSoftware
}
from
'
../../../../../../utils/param/publicFunc
'
;
import
{
publicSignVerifyFunc
}
from
'
../../../../../../utils/param/signverify/publicSignverifyPromise.js
'
;
let
srcData65
=
Data
.
Data65b
;
let
srcData65Kb
=
stringToUint8Array
(
srcData65
);
...
...
@@ -23,7 +23,7 @@ let useSoftware = true;
export
default
function
SecurityHuksDSABasicAbort65KBPromiseJsunit
()
{
describe
(
'
SecurityHuksDSABasicAbort65KBPromiseJsunit
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
useSoftware
=
checkSoftware
();
useSoftware
=
await
checkSoftware
();
done
();
})
it
(
'
testReformedSignVerifyDSA104
'
,
0
,
async
function
(
done
)
{
...
...
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish63KBPromiseJsunit.test.js
浏览文件 @
e29fa0a0
...
...
@@ -24,7 +24,7 @@ let useSoftware = true;
export
default
function
SecurityHuksDSABasicFinish63KBPromiseJsunit
()
{
describe
(
'
SecurityHuksDSABasicFinish63KBPromiseJsunit
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
useSoftware
=
checkSoftware
();
useSoftware
=
await
checkSoftware
();
done
();
})
it
(
'
testReformedSignVerifyDSA101
'
,
0
,
async
function
(
done
)
{
...
...
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksDSABasicFinish65KBPromiseJsunit.test.js
浏览文件 @
e29fa0a0
...
...
@@ -24,7 +24,7 @@ let useSoftware = true;
export
default
function
SecurityHuksDSABasicFinish65KBPromiseJsunit
()
{
describe
(
'
SecurityHuksDSABasicFinish65KBPromiseJsunit
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
useSoftware
=
checkSoftware
();
useSoftware
=
await
checkSoftware
();
done
();
})
it
(
'
testReformedSignVerifyDSA103
'
,
0
,
async
function
(
done
)
{
...
...
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksECCBasicFinish65KBPromiseJsunit.test.js
浏览文件 @
e29fa0a0
此差异已折叠。
点击以展开。
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksRSABasicFinish65KBPromiseJsunit.test.js
浏览文件 @
e29fa0a0
此差异已折叠。
点击以展开。
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksRSASignExtendJsunit.test.js
浏览文件 @
e29fa0a0
...
...
@@ -13,9 +13,9 @@
* limitations under the License.
*/
import
huks
from
"
@ohos.security.huks
"
;
import
{
describe
,
it
,
expect
}
from
"
@ohos/hypium
"
;
import
{
describe
,
it
,
expect
,
beforeAll
}
from
"
@ohos/hypium
"
;
import
Data
from
'
../../../../../../utils/data.json
'
;
import
{
stringToUint8Array
}
from
'
../../../../../../utils/param/publicFunc
'
;
import
{
stringToUint8Array
,
checkSoftware
}
from
'
../../../../../../utils/param/publicFunc
'
;
import
{
HuksSignVerifyRSA
}
from
'
../../../../../../utils/param/signverify/publicSignverifyParam
'
;
let
inDataString
=
"
Hks_RSA_Sign_Verify_Test_0000000000000000000000000000000000000000000000000000000
"
+
...
...
@@ -29,6 +29,7 @@ let srcData64 = Data.Data64b;
let
srcData64Kb
=
stringToUint8Array
(
srcData64
);
let
signedResult
;
let
handle
;
let
useSoftware
=
true
;
async
function
publicGenerateKeyFunc
(
srcKeyAlias
,
genHuksOptionsNONECBC
)
{
console
.
error
(
`enter promise generateKeyItem`
);
...
...
@@ -91,7 +92,7 @@ async function publicUpdateSessionFunction(HuksOptions) {
let
isFinished
=
false
;
let
outData
=
[];
while
(
inDataSegPosition
<=
lastInDataPosition
)
{
while
(
inDataSegPosition
<=
lastInDataPosition
)
{
HuksOptions
.
inData
=
new
Uint8Array
(
Array
.
from
(
inData
).
slice
(
inDataSegPosition
,
inDataSegPosition
+
inDataSegSize
)
);
...
...
@@ -127,22 +128,22 @@ async function publicUpdateSessionFunction(HuksOptions) {
}
}
async
function
publicUpdateError
(
HuksOptions
,
errCode
){
async
function
publicUpdateError
(
HuksOptions
,
errCode
)
{
console
.
error
(
`enter promise doUpdate`
);
try
{
await
huks
.
updateSession
(
handle
,
HuksOptions
)
.
then
((
data
)
=>
{
console
.
error
(
`promise: doUpdate success, data =
${
JSON
.
stringify
(
data
)}
`
);
expect
(
null
).
assertFail
();
})
.
catch
(
error
=>
{
console
.
error
(
`promise: doUpdate failed, code:
${
error
.
code
}
, msg:
${
error
.
message
}
`
);
expect
(
err
.
code
==
errCode
).
assertTrue
();
});
}
catch
(
error
)
{
console
.
error
(
`promise: doUpdate input arg invalid, code:
${
error
.
code
}
, msg:
${
error
.
message
}
`
);
expect
(
null
).
assertFail
();
}
try
{
await
huks
.
updateSession
(
handle
,
HuksOptions
)
.
then
((
data
)
=>
{
console
.
error
(
`promise: doUpdate success, data =
${
JSON
.
stringify
(
data
)}
`
);
expect
(
null
).
assertFail
();
})
.
catch
(
error
=>
{
console
.
error
(
`promise: doUpdate failed, code:
${
error
.
code
}
, msg:
${
error
.
message
}
`
);
expect
(
err
.
code
==
errCode
).
assertTrue
();
});
}
catch
(
error
)
{
console
.
error
(
`promise: doUpdate input arg invalid, code:
${
error
.
code
}
, msg:
${
error
.
message
}
`
);
expect
(
null
).
assertFail
();
}
}
async
function
publicFinishSessionFunc
(
HuksOptions
)
{
...
...
@@ -184,7 +185,10 @@ async function publicDeleteKeyFunc(srcKeyAlias, genHuksOptionsNONECBC) {
export
default
function
SecurityHuksRSASignExtendJsunit
()
{
describe
(
'
SecurityHuksRSASignExtendJsunit
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
useSoftware
=
await
checkSoftware
();
done
();
})
/**
* @tc.number Security_HUKS_RSA_SignExtend_0100
* @tc.name No Padding and Sign Verify with RSA.
...
...
@@ -192,48 +196,50 @@ export default function SecurityHuksRSASignExtendJsunit() {
*/
it
(
"
Security_HUKS_RSA_SignExtend_0100
"
,
0
,
async
function
(
done
)
{
let
srcKeyAliesGen
=
"
Security_HUKS_RSA_SignExtend_0100_Gen
"
;
let
HuksOptionsGen
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeSINGVERIFY
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
};
let
HuksOptionsSign
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeSIGN
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
}
await
publicGenerateKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
srcData64Kb
;
await
publicUpdateSessionFunction
(
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
new
Uint8Array
(
new
Array
());
await
publicFinishSessionFunc
(
HuksOptionsSign
);
if
(
useSoftware
)
{
let
HuksOptionsGen
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeSINGVERIFY
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
};
let
HuksOptionsSign
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeSIGN
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
}
await
publicGenerateKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
srcData64Kb
;
await
publicUpdateSessionFunction
(
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
new
Uint8Array
(
new
Array
());
await
publicFinishSessionFunc
(
HuksOptionsSign
);
let
HuksOptionsVerify
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeVERIFY
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
let
HuksOptionsVerify
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeVERIFY
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
}
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
srcData64Kb
;
publicUpdateSessionFunction
(
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
signedResult
;
await
publicFinishSessionFunc
(
HuksOptionsVerify
);
await
publicDeleteKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
}
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
srcData64Kb
;
publicUpdateSessionFunction
(
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
signedResult
;
await
publicFinishSessionFunc
(
HuksOptionsVerify
);
await
publicDeleteKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
done
();
})
...
...
@@ -244,48 +250,50 @@ export default function SecurityHuksRSASignExtendJsunit() {
*/
it
(
"
Security_HUKS_RSA_SignExtend_0200
"
,
0
,
async
function
(
done
)
{
let
srcKeyAliesGen
=
"
Security_HUKS_RSA_SignExtend_0200
"
;
let
HuksOptionsGen
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeSINGVERIFY
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
};
let
HuksOptionsSign
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeSIGN
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
}
await
publicGenerateKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
srcData64Kb
;
await
publicUpdateSessionFunction
(
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
new
Uint8Array
(
new
Array
());
await
publicFinishSessionFunc
(
HuksOptionsSign
);
if
(
useSoftware
)
{
let
HuksOptionsGen
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeSINGVERIFY
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
};
let
HuksOptionsSign
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeSIGN
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
}
await
publicGenerateKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
srcData64Kb
;
await
publicUpdateSessionFunction
(
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
new
Uint8Array
(
new
Array
());
await
publicFinishSessionFunc
(
HuksOptionsSign
);
let
HuksOptionsVerify
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeVERIFY
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
let
HuksOptionsVerify
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeVERIFY
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
}
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
srcData64Kb
;
publicUpdateSessionFunction
(
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
signedResult
;
await
publicFinishSessionFunc
(
HuksOptionsVerify
);
await
publicDeleteKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
}
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
srcData64Kb
;
publicUpdateSessionFunction
(
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
signedResult
;
await
publicFinishSessionFunc
(
HuksOptionsVerify
);
await
publicDeleteKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
done
();
})
...
...
@@ -314,29 +322,31 @@ export default function SecurityHuksRSASignExtendJsunit() {
),
inData
:
srcData64Kb
,
}
await
publicGenerateKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
srcData64Kb
;
await
publicUpdateSessionFunction
(
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
new
Uint8Array
(
new
Array
());
await
publicFinishSessionFunc
(
HuksOptionsSign
);
if
(
useSoftware
)
{
await
publicGenerateKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
srcData64Kb
;
await
publicUpdateSessionFunction
(
HuksOptionsSign
);
HuksOptionsSign
.
inData
=
new
Uint8Array
(
new
Array
());
await
publicFinishSessionFunc
(
HuksOptionsSign
);
let
HuksOptionsVerify
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeVERIFY
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
let
HuksOptionsVerify
=
{
properties
:
new
Array
(
HuksSignVerifyRSA
.
HuksKeyAlgRSA
,
HuksSignVerifyRSA
.
HuksKeyRSAPurposeVERIFY
,
HuksSignVerifyRSA
.
HuksTagPKCS1DigestSHA256
,
HuksSignVerifyRSA
.
HuksKeyRSAPADDINGPKCS1V15
,
HuksSignVerifyRSA
.
HuksKeyRSASize4096
),
inData
:
srcData64Kb
,
}
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
srcData64Kb
;
publicUpdateSessionFunction
(
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
signedResult
;
await
publicFinishSessionFunc
(
HuksOptionsVerify
);
await
publicDeleteKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
}
await
publicInitFunc
(
srcKeyAliesGen
,
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
srcData64Kb
;
publicUpdateSessionFunction
(
HuksOptionsVerify
);
HuksOptionsVerify
.
inData
=
signedResult
;
await
publicFinishSessionFunc
(
HuksOptionsVerify
);
await
publicDeleteKeyFunc
(
srcKeyAliesGen
,
HuksOptionsGen
);
done
();
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录