Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
28d3c52d
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看板
提交
28d3c52d
编写于
5月 10, 2023
作者:
Q
qiaozzzh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Structure splitting and adjustment of use case execution time
Signed-off-by:
N
qiaozzzh
<
qiaozhang@huawei.com
>
上级
034912e8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
758 addition
and
725 deletion
+758
-725
security/cryptoFramework/js_api_test_one/BUILD.gn
security/cryptoFramework/js_api_test_one/BUILD.gn
+2
-1
security/cryptoFramework/js_api_test_one/Test.json
security/cryptoFramework/js_api_test_one/Test.json
+3
-3
security/cryptoFramework/js_api_test_one/src/main/js/test/AsymmetricCryptography.test.js
..._test_one/src/main/js/test/AsymmetricCryptography.test.js
+3
-721
security/cryptoFramework/js_api_test_one/src/main/js/test/AsymmetricCryptographySecond.test.js
...one/src/main/js/test/AsymmetricCryptographySecond.test.js
+748
-0
security/cryptoFramework/js_api_test_one/src/main/js/test/List.test.js
...toFramework/js_api_test_one/src/main/js/test/List.test.js
+2
-0
未找到文件。
security/cryptoFramework/js_api_test_one/BUILD.gn
浏览文件 @
28d3c52d
...
...
@@ -11,7 +11,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
base_root = "../../../../../../"
import("$base_root/test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsCryptoFrameworkJSNormalTest") {
hap_profile = "./src/main/config.json"
...
...
security/cryptoFramework/js_api_test_one/Test.json
浏览文件 @
28d3c52d
...
...
@@ -2,9 +2,9 @@
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"
9
00000"
,
"shell-timeout"
:
"
9
00000"
,
"testcase-timeout"
:
"
18
0000"
,
"test-timeout"
:
"
18
00000"
,
"shell-timeout"
:
"
18
00000"
,
"testcase-timeout"
:
"
90
0000"
,
"bundle-name"
:
"com.openharmony.cryptoFramework1"
,
"package-name"
:
"com.openharmony.cryptoFramework1"
},
...
...
security/cryptoFramework/js_api_test_one/src/main/js/test/AsymmetricCryptography.test.js
浏览文件 @
28d3c52d
...
...
@@ -665,726 +665,8 @@ export default function AsymmetricCryptographyJsunit() {
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_1100
* @tc.name Test RSA2048|PSS|SHA1|MGF1_SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1100
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcess
(
"
RSA8192
"
,
"
RSA8192|PSS|SHA512|MGF1_SHA512
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1100 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_1200
* @tc.name Test RSA2048|PSS|SHA1|MGF1_SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1200
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcess
(
"
RSA512
"
,
"
RSA512|PSS|SHA384|MGF1_SHA384
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1200 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_5000
* @tc.name Test RSA2048|PSS|SHA1|MGF1_SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_5000
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcessDataException
(
"
RSA512
"
,
"
RSA512|PSS|SHA384|MGF1_SHA384
"
,
"
null
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
Error: [Data]: must be of the DataBlob type.
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_5000 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_1300
* @tc.name Test RSA256 or null normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1300
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
createAsyKeyGeneratorFail
(
"
RSA256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of null
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1300 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
await
asyPromise
.
createAsyKeyGeneratorFail
(
"
null
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of null
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1300 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_1400
* @tc.name Test RSA2048|PSS|SHA1|MGF1_SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1400
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
createAsySignFail
(
"
RSA3072
"
,
"
RSA4096|null|SHA256
"
,
"
RSA4096|PKCS1|null
"
,
"
RSA4096|PKCS1|SHA122
"
,
"
RSA4096|PKCS3|SHA256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1400 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_Encryption_RSA_2000
* @tc.name Test RSA4096|PKCS1 normal encryption and decryption
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_2000
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
encryptAndDecryptNormalProcessSuperdata
(
"
RSA4096
"
,
"
RSA4096|PKCS1
"
,
"
490
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_2000 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_2100
* @tc.name Test RSA3072|PKCS1|SHA224 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_2100
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
signAndVerifyNormalProcessSuperdata
(
"
RSA3072
"
,
"
RSA3072|PKCS1|SHA224
"
,
"
350
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_2100 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_1500
* @tc.name Test RSA2048|PSS|SHA1|MGF1_SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1500
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
createAsyVerifyFail
(
"
RSA3072
"
,
"
RSA4096|null|SHA256
"
,
"
RSA4096|PKCS1|null
"
,
"
RSA4096|PKCS1|SHA122
"
,
"
RSA4096|PKCS3|SHA256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1500 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0100
* @tc.name Test ECC224|SHA256 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0100
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
signAndVerifyNormalProcess
(
"
ECC224
"
,
"
ECC224|SHA256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0100 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0200
* @tc.name Test ECC256|SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0200
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcess
(
"
ECC256
"
,
"
ECC256|SHA1
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0200 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0300
* @tc.name Test ECC224|SHA256 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0300
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
signAndVerifyNormalProcess
(
"
ECC384
"
,
"
ECC384|SHA224
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0300 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0400
* @tc.name Test ECC521|SHA384 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0400
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcess
(
"
ECC521
"
,
"
ECC521|SHA384
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0400 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0500
* @tc.name Test ECC224|SHA512 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0500
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcess
(
"
ECC224
"
,
"
ECC224|SHA512
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0500 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0600
* @tc.name Test ECC1 or NULL normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0600
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
createAsyKeyGeneratorFail
(
"
ECC1
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of null
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0600 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
await
asyCallback
.
createAsyKeyGeneratorFail
(
"
null
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of null
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0600 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0700
* @tc.name Test ECC224 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0700
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
createAsySignFail
(
"
ECC224
"
,
"
ECC224|SHA257
"
,
"
ECC224|NULL
"
,
"
NULL|SHA1
"
,
"
ECC|SHA
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0700:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0800
* @tc.name Test RSA3072 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0800
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
createAsyVerifyFail
(
"
ECC224
"
,
"
ECC1|SHA256
"
,
"
NULL|SHA256
"
,
"
ECC224|SHA122
"
,
"
ECC224|NULL
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0800 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0900
* @tc.name Test ECC224|SHA512 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0900
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
signAndVerifyNormalProcessSuperdata
(
"
ECC224
"
,
"
ECC224|SHA512
"
,
"
350
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0900 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0100
* @tc.name Test ECC224 SignVerify ECDH
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0100
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
keyAgreementProcess
(
"
ECC224
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0100 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0200
* @tc.name Test ECC256 SignVerify ECDH
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0200
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
keyAgreementProcess
(
"
ECC256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0200 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0300
* @tc.name Test ECC384 SignVerify ECDH
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0300
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
keyAgreementProcess
(
"
ECC384
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0300 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0400
* @tc.name Test ECC521 SignVerify ECDH
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0400
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
keyAgreementProcess
(
"
ECC521
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0400 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0500
* @tc.name Test ECC5 or null SignVerify ECDH
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0500
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
createAsyKeyAgreementFail
(
"
ECC5
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0500 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
await
asyCallback
.
createAsyKeyAgreementFail
(
"
null
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0500 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0600
* @tc.name Test ECC256 SignVerify ECDH
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0600
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
keyAgreementProcessParameterException
(
"
ECC256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
Error: [PriKey]: param unwarp error.
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0600 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0700
* @tc.name Test RSA3072 SignVerify ECDH
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0700
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
keyAgreementProcessFail
(
"
RSA3072
"
,
"
ECC521
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
Error: An exception occurs.
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0700 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_Encryption_RSA_3300
* @tc.name Test convertKey
* @tc.desc Use RSA3072|PRIMES_2 algorithm
*/
it
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_3300
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
convertKeyEncryptAndDecryptProcess
(
"
RSA3072|PRIMES_2
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_3300 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_Encryption_RSA_3100
* @tc.name Test convertKey
* @tc.desc Use RSA1024|PRIMES_2 algorithm
*/
it
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_3100
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
AsyPriKeyClearProcess
(
"
RSA1024|PRIMES_2
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_3100 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
});
});
}
\ No newline at end of file
security/cryptoFramework/js_api_test_one/src/main/js/test/AsymmetricCryptographySecond.test.js
0 → 100644
浏览文件 @
28d3c52d
/*
* 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.
*/
import
{
describe
,
beforeAll
,
afterEach
,
it
,
expect
}
from
"
@ohos/hypium
"
;
import
*
as
asyPromise
from
"
./utils/asymmetric/publicAsymmetricPromise
"
;
import
*
as
asyCallback
from
"
./utils/asymmetric/publicAsymmetricCallback
"
;
export
default
function
AsymmetricCryptographyJsuni1
()
{
describe
(
"
AsymmetricCryptographyJsunit1
"
,
function
()
{
console
.
info
(
"
##########start AsymmetricCryptographyJsunit##########
"
);
beforeAll
(
function
()
{});
afterEach
(
function
()
{});
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_1200
* @tc.name Test RSA2048|PSS|SHA1|MGF1_SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1200
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcess
(
"
RSA512
"
,
"
RSA512|PSS|SHA384|MGF1_SHA384
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1200 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_5000
* @tc.name Test RSA2048|PSS|SHA1|MGF1_SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_5000
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcessDataException
(
"
RSA512
"
,
"
RSA512|PSS|SHA384|MGF1_SHA384
"
,
"
null
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
Error: [Data]: must be of the DataBlob type.
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_5000 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_1300
* @tc.name Test RSA256 or null normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1300
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
createAsyKeyGeneratorFail
(
"
RSA256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of null
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1300 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
await
asyPromise
.
createAsyKeyGeneratorFail
(
"
null
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of null
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1300 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_1400
* @tc.name Test RSA2048|PSS|SHA1|MGF1_SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1400
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
createAsySignFail
(
"
RSA3072
"
,
"
RSA4096|null|SHA256
"
,
"
RSA4096|PKCS1|null
"
,
"
RSA4096|PKCS1|SHA122
"
,
"
RSA4096|PKCS3|SHA256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1400 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_Encryption_RSA_2000
* @tc.name Test RSA4096|PKCS1 normal encryption and decryption
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_2000
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
encryptAndDecryptNormalProcessSuperdata
(
"
RSA4096
"
,
"
RSA4096|PKCS1
"
,
"
490
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_2000 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_2100
* @tc.name Test RSA3072|PKCS1|SHA224 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_2100
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
signAndVerifyNormalProcessSuperdata
(
"
RSA3072
"
,
"
RSA3072|PKCS1|SHA224
"
,
"
350
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_2100 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_1500
* @tc.name Test RSA2048|PSS|SHA1|MGF1_SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1500
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
createAsyVerifyFail
(
"
RSA3072
"
,
"
RSA4096|null|SHA256
"
,
"
RSA4096|PKCS1|null
"
,
"
RSA4096|PKCS1|SHA122
"
,
"
RSA4096|PKCS3|SHA256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1500 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0100
* @tc.name Test ECC224|SHA256 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0100
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
signAndVerifyNormalProcess
(
"
ECC224
"
,
"
ECC224|SHA256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0100 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0200
* @tc.name Test ECC256|SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0200
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcess
(
"
ECC256
"
,
"
ECC256|SHA1
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0200 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0300
* @tc.name Test ECC224|SHA256 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0300
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
signAndVerifyNormalProcess
(
"
ECC384
"
,
"
ECC384|SHA224
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0300 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0400
* @tc.name Test ECC521|SHA384 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0400
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcess
(
"
ECC521
"
,
"
ECC521|SHA384
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0400 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0500
* @tc.name Test ECC224|SHA512 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0500
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcess
(
"
ECC224
"
,
"
ECC224|SHA512
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0500 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0600
* @tc.name Test ECC1 or NULL normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0600
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
createAsyKeyGeneratorFail
(
"
ECC1
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of null
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0600 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
await
asyCallback
.
createAsyKeyGeneratorFail
(
"
null
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of null
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0600 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0700
* @tc.name Test ECC224 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0700
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
createAsySignFail
(
"
ECC224
"
,
"
ECC224|SHA257
"
,
"
ECC224|NULL
"
,
"
NULL|SHA1
"
,
"
ECC|SHA
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0700:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0800
* @tc.name Test RSA3072 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0800
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
createAsyVerifyFail
(
"
ECC224
"
,
"
ECC1|SHA256
"
,
"
NULL|SHA256
"
,
"
ECC224|SHA122
"
,
"
ECC224|NULL
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0800 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0900
* @tc.name Test ECC224|SHA512 normal sign and verify
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0900
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
signAndVerifyNormalProcessSuperdata
(
"
ECC224
"
,
"
ECC224|SHA512
"
,
"
350
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDSA_0900 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0100
* @tc.name Test ECC224 SignVerify ECDH
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0100
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
keyAgreementProcess
(
"
ECC224
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0100 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0200
* @tc.name Test ECC256 SignVerify ECDH
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0200
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
keyAgreementProcess
(
"
ECC256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0200 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0300
* @tc.name Test ECC384 SignVerify ECDH
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0300
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
keyAgreementProcess
(
"
ECC384
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0300 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0400
* @tc.name Test ECC521 SignVerify ECDH
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0400
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
keyAgreementProcess
(
"
ECC521
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0400 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0500
* @tc.name Test ECC5 or null SignVerify ECDH
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0500
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
createAsyKeyAgreementFail
(
"
ECC5
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0500 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
await
asyCallback
.
createAsyKeyAgreementFail
(
"
null
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0500 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0600
* @tc.name Test ECC256 SignVerify ECDH
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0600
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
keyAgreementProcessParameterException
(
"
ECC256
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
Error: [PriKey]: param unwarp error.
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0600 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_ECDH_0700
* @tc.name Test RSA3072 SignVerify ECDH
* @tc.desc Use the Callback Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0700
"
,
0
,
async
function
(
done
)
{
await
asyCallback
.
keyAgreementProcessFail
(
"
RSA3072
"
,
"
ECC521
"
)
.
then
((
data
)
=>
{
expect
(
data
==
"
Error: An exception occurs.
"
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_ECDH_0700 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_Encryption_RSA_3300
* @tc.name Test convertKey
* @tc.desc Use RSA3072|PRIMES_2 algorithm
*/
it
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_3300
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
convertKeyEncryptAndDecryptProcess
(
"
RSA3072|PRIMES_2
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_3300 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_Encryption_RSA_3100
* @tc.name Test convertKey
* @tc.desc Use RSA1024|PRIMES_2 algorithm
*/
it
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_3100
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
AsyPriKeyClearProcess
(
"
RSA1024|PRIMES_2
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_Encryption_RSA_3100 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
/**
* @tc.number Security_crypto_framework_ASymmetric_SignVerify_RSA_1100
* @tc.name Test RSA2048|PSS|SHA1|MGF1_SHA1 normal sign and verify
* @tc.desc Use the Promise Style of Interface
*/
it
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1100
"
,
0
,
async
function
(
done
)
{
await
asyPromise
.
signAndVerifyNormalProcess
(
"
RSA8192
"
,
"
RSA8192|PSS|SHA512|MGF1_SHA512
"
)
.
then
((
data
)
=>
{
expect
(
data
==
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
Security_crypto_framework_ASymmetric_SignVerify_RSA_1100 catch error:
"
+
err
);
expect
(
null
).
assertFail
();
});
done
();
}
);
});
}
security/cryptoFramework/js_api_test_one/src/main/js/test/List.test.js
浏览文件 @
28d3c52d
...
...
@@ -15,12 +15,14 @@
import
SymmetricCryptographyJsunit
from
"
./SymmetricCryptography.test
"
;
import
AsymmetricCryptographyJsunit
from
"
./AsymmetricCryptography.test
"
;
import
AsymmetricCryptographyJsSecondunit
from
"
./AsymmetricCryptographySecond.test
"
;
import
DigestAlgorithmJsunit
from
"
./DigestAlgorithm.test
"
;
import
SecurityRandomJsunit
from
"
./SecurityRandom.test
"
;
export
default
function
testsuite
()
{
SymmetricCryptographyJsunit
();
AsymmetricCryptographyJsunit
();
AsymmetricCryptographyJsSecondunit
();
DigestAlgorithmJsunit
();
SecurityRandomJsunit
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录