Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
dd14b5d7
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看板
未验证
提交
dd14b5d7
编写于
11月 22, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6616 【OpenHarmony 3.2.9.1】【安全子系统】新增非对称加解密用例
Merge pull request !6616 from qiaozzzh/1121_1
上级
7a112fc9
62e249d4
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
1773 addition
and
142 deletion
+1773
-142
security/cryptoFramework/js_api_test_one/Test.json
security/cryptoFramework/js_api_test_one/Test.json
+1
-0
security/cryptoFramework/js_api_test_one/src/main/js/test/AsymmetricCryptography.test.js
..._test_one/src/main/js/test/AsymmetricCryptography.test.js
+1300
-142
security/cryptoFramework/js_api_test_one/src/main/js/test/utils/asymmetric/publicAsymmetricCallback.js
...main/js/test/utils/asymmetric/publicAsymmetricCallback.js
+330
-0
security/cryptoFramework/js_api_test_one/src/main/js/test/utils/asymmetric/publicAsymmetricPromise.js
.../main/js/test/utils/asymmetric/publicAsymmetricPromise.js
+142
-0
未找到文件。
security/cryptoFramework/js_api_test_one/Test.json
浏览文件 @
dd14b5d7
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
"type"
:
"OHJSUnitTest"
,
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"900000"
,
"test-timeout"
:
"900000"
,
"shell-timeout"
:
"900000"
,
"shell-timeout"
:
"900000"
,
"testcase-timeout"
:
"180000"
,
"bundle-name"
:
"com.openharmony.cryptoFramework1"
,
"bundle-name"
:
"com.openharmony.cryptoFramework1"
,
"package-name"
:
"com.openharmony.cryptoFramework1"
"package-name"
:
"com.openharmony.cryptoFramework1"
},
},
...
...
security/cryptoFramework/js_api_test_one/src/main/js/test/AsymmetricCryptography.test.js
浏览文件 @
dd14b5d7
此差异已折叠。
点击以展开。
security/cryptoFramework/js_api_test_one/src/main/js/test/utils/asymmetric/publicAsymmetricCallback.js
浏览文件 @
dd14b5d7
...
@@ -391,6 +391,17 @@ async function convertKeyEncryptAndDecryptProcess(asyAlgoName) {
...
@@ -391,6 +391,17 @@ async function convertKeyEncryptAndDecryptProcess(asyAlgoName) {
});
});
}
}
async
function
createAsyKeyAgreementFail
(
ECDHAlgoName
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
var
globalECDHData
=
createAsyKeyAgreement
(
ECDHAlgoName
);
resolve
(
globalECDHData
);
expect
(
globalECDHData
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
if
(
globalECDHData
!=
"
TypeError: Cannot read property algName of undefined
"
){
reject
();
}
});
}
async
function
keyAgreementProcess
(
ECDHAlgoName
)
{
async
function
keyAgreementProcess
(
ECDHAlgoName
)
{
var
globalPubKey
;
var
globalPubKey
;
var
globalPriKey
;
var
globalPriKey
;
...
@@ -420,9 +431,328 @@ async function keyAgreementProcess(ECDHAlgoName) {
...
@@ -420,9 +431,328 @@ async function keyAgreementProcess(ECDHAlgoName) {
});
});
}
}
async
function
keyAgreementProcessFail
(
ECDHAlgoName
,
ECDHAlgoName1
)
{
var
globalPubKey
;
var
globalPriKey
;
return
new
Promise
((
resolve
,
reject
)
=>
{
var
rsaGenerator
=
createAsyKeyGenerator
(
ECDHAlgoName
);
expect
(
rsaGenerator
!=
null
).
assertTrue
();
var
globalECDHData
=
createAsyKeyAgreement
(
ECDHAlgoName1
);
expect
(
globalECDHData
!=
null
).
assertTrue
();
generateAsyKeyPair
(
rsaGenerator
)
.
then
((
rsaKeyPair
)
=>
{
expect
(
rsaKeyPair
!=
null
).
assertTrue
();
globalPubKey
=
rsaKeyPair
.
pubKey
;
globalPriKey
=
rsaKeyPair
.
priKey
;
return
generateAsySecret
(
globalECDHData
,
globalPriKey
,
globalPubKey
);
})
.
then
((
result
)
=>
{
console
.
warn
(
"
result data is
"
+
uInt8ArrayToShowStr
(
result
.
data
));
expect
(
result
!=
null
).
assertTrue
();
reject
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
[Callback] keyAgreementProcess catch err:
"
+
err
);
resolve
(
err
);
});
});
}
async
function
keyAgreementProcessParameterException
(
ECDHAlgoName
)
{
var
globalPubKey
;
var
globalPriKey
;
return
new
Promise
((
resolve
,
reject
)
=>
{
var
rsaGenerator
=
createAsyKeyGenerator
(
ECDHAlgoName
);
expect
(
rsaGenerator
!=
null
).
assertTrue
();
var
globalECDHData
=
createAsyKeyAgreement
(
ECDHAlgoName
);
expect
(
globalECDHData
!=
null
).
assertTrue
();
generateAsyKeyPair
(
rsaGenerator
)
.
then
((
rsaKeyPair
)
=>
{
expect
(
rsaKeyPair
!=
null
).
assertTrue
();
globalPubKey
=
rsaKeyPair
.
pubKey
;
globalPriKey
=
rsaKeyPair
.
priKey
;
return
generateAsySecret
(
globalECDHData
,
null
,
null
);
})
.
then
((
result
)
=>
{
console
.
warn
(
"
result data is
"
+
uInt8ArrayToShowStr
(
result
.
data
));
expect
(
result
!=
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
expect
(
err
==
"
Error: [PriKey]: param unwarp error.
"
).
assertTrue
();
});
generateAsyKeyPair
(
rsaGenerator
)
.
then
((
rsaKeyPair
)
=>
{
expect
(
rsaKeyPair
!=
null
).
assertTrue
();
globalPubKey
=
rsaKeyPair
.
pubKey
;
globalPriKey
=
rsaKeyPair
.
priKey
;
return
generateAsySecret
(
globalECDHData
,
globalPubKey
,
null
);
})
.
then
((
result
)
=>
{
console
.
warn
(
"
result data is
"
+
uInt8ArrayToShowStr
(
result
.
data
));
expect
(
result
!=
null
).
assertTrue
();
})
.
catch
((
err
)
=>
{
expect
(
err
==
"
Error: [PubKey]: param unwarp error.
"
).
assertTrue
();
});
generateAsyKeyPair
(
rsaGenerator
)
.
then
((
rsaKeyPair
)
=>
{
expect
(
rsaKeyPair
!=
null
).
assertTrue
();
globalPubKey
=
rsaKeyPair
.
pubKey
;
globalPriKey
=
rsaKeyPair
.
priKey
;
return
generateAsySecret
(
globalECDHData
,
null
,
globalPriKey
);
})
.
then
((
result
)
=>
{
console
.
warn
(
"
result data is
"
+
uInt8ArrayToShowStr
(
result
.
data
));
expect
(
result
!=
null
).
assertTrue
();
reject
();
})
.
catch
((
err
)
=>
{
expect
(
err
==
"
Error: [PriKey]: param unwarp error.
"
).
assertTrue
();
resolve
(
err
);
});
});
}
async
function
createAsyKeyGeneratorFail
(
asyAlgoName
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
var
rsaGenerator
=
createAsyKeyGenerator
(
asyAlgoName
);
resolve
(
rsaGenerator
);
expect
(
rsaGenerator
==
"
TypeError: Cannot read property algName of null
"
).
assertTrue
();
if
(
rsaGenerator
!=
"
TypeError: Cannot read property algName of null
"
)
{
reject
();
}
});
}
async
function
encryptAndDecryptNormalProcessSuperdata
(
asyAlgoName
,
cipherAlgoName
,
globalTextLen
)
{
var
globalCipherText
;
var
globalPubKey
;
var
globalPriKey
;
var
globalText
;
var
i
;
var
encryptMode
=
cryptoFramework
.
CryptoMode
.
ENCRYPT_MODE
;
var
decryptMode
=
cryptoFramework
.
CryptoMode
.
DECRYPT_MODE
;
var
t
=
"
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefhijklmnopqrstuvwxyz
"
,
n
=
t
.
length
,
s
=
""
;
for
(
i
=
0
;
i
<
globalTextLen
;
i
++
)
{
globalText
+=
t
.
charAt
(
Math
.
floor
(
Math
.
random
()
*
n
));
}
var
input
=
{
data
:
stringTouInt8Array
(
globalText
)
};
return
new
Promise
((
resolve
,
reject
)
=>
{
var
rsaGenerator
=
createAsyKeyGenerator
(
asyAlgoName
);
expect
(
rsaGenerator
!=
null
).
assertTrue
();
var
cipherGeneratorEncrypt
=
createAsyCipher
(
cipherAlgoName
);
expect
(
cipherGeneratorEncrypt
!=
null
).
assertTrue
();
var
cipherGeneratorDecrypt
=
createAsyCipher
(
cipherAlgoName
);
expect
(
cipherGeneratorDecrypt
!=
null
).
assertTrue
();
generateAsyKeyPair
(
rsaGenerator
)
.
then
((
rsaKeyPair
)
=>
{
expect
(
rsaKeyPair
!=
null
).
assertTrue
();
globalPubKey
=
rsaKeyPair
.
pubKey
;
globalPriKey
=
rsaKeyPair
.
priKey
;
return
initCipher
(
cipherGeneratorEncrypt
,
encryptMode
,
globalPubKey
,
null
);
})
.
then
((
initData
)
=>
{
expect
(
initData
===
"
init success
"
).
assertTrue
();
return
doFinalCipher
(
cipherGeneratorEncrypt
,
encryptMode
,
input
);
})
.
then
((
finalOutput
)
=>
{
expect
(
finalOutput
!=
null
).
assertTrue
();
globalCipherText
=
finalOutput
;
console
.
log
(
"
cipherOutput:
"
+
uInt8ArrayToShowStr
(
globalCipherText
.
data
)
);
return
initCipher
(
cipherGeneratorDecrypt
,
decryptMode
,
globalPriKey
,
null
);
})
.
then
((
initData
)
=>
{
expect
(
initData
===
"
init success
"
).
assertTrue
();
return
doFinalCipher
(
cipherGeneratorDecrypt
,
decryptMode
,
globalCipherText
);
})
.
then
((
finalOutput
)
=>
{
if
(
finalOutput
==
null
)
{
console
.
error
(
"
[Callback]decrypt doFinal out is null
"
);
}
else
{
console
.
log
(
"
[Callback]decrypt doFinal out hex:
"
+
uInt8ArrayToShowStr
(
finalOutput
.
data
)
);
}
let
decryptData
=
uInt8ArrayToString
(
finalOutput
.
data
);
expect
(
decryptData
==
globalText
).
assertTrue
();
resolve
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
[Callback] encryptAndDecryptNormalProcess catch err:
"
+
err
);
reject
(
err
);
});
});
}
async
function
signAndVerifyNormalProcessSuperdata
(
asyAlgoName
,
signVerifyAlgoName
,
globalTextLen
)
{
var
globalSignBlob
;
var
globalPubKey
;
var
globalPriKey
;
var
globalText
;
var
i
;
var
t
=
"
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefhijklmnopqrstuvwxyz
"
,
n
=
t
.
length
,
s
=
""
;
for
(
i
=
0
;
i
<
globalTextLen
;
i
++
)
{
globalText
+=
t
.
charAt
(
Math
.
floor
(
Math
.
random
()
*
n
));
}
var
input
=
{
data
:
stringTouInt8Array
(
globalText
)
};
return
new
Promise
((
resolve
,
reject
)
=>
{
var
rsaGenerator
=
createAsyKeyGenerator
(
asyAlgoName
);
expect
(
rsaGenerator
!=
null
).
assertTrue
();
var
signGenerator
=
createAsySign
(
signVerifyAlgoName
);
expect
(
signGenerator
!=
null
).
assertTrue
();
var
verifyGenerator
=
createAsyVerify
(
signVerifyAlgoName
);
expect
(
verifyGenerator
!=
null
).
assertTrue
();
generateAsyKeyPair
(
rsaGenerator
)
.
then
((
rsaKeyPair
)
=>
{
expect
(
rsaKeyPair
!=
null
).
assertTrue
();
globalPubKey
=
rsaKeyPair
.
pubKey
;
globalPriKey
=
rsaKeyPair
.
priKey
;
return
initSign
(
signGenerator
,
globalPriKey
);
})
.
then
((
initData
)
=>
{
expect
(
initData
===
"
init success
"
).
assertTrue
();
return
updateSign
(
signGenerator
,
input
);
})
.
then
((
updateData
)
=>
{
expect
(
updateData
===
"
update success
"
).
assertTrue
();
return
signForSign
(
signGenerator
,
input
);
})
.
then
((
finalOutput
)
=>
{
expect
(
finalOutput
!=
null
).
assertTrue
();
globalSignBlob
=
finalOutput
;
console
.
log
(
"
signOutput:
"
+
uInt8ArrayToShowStr
(
globalSignBlob
.
data
));
return
initVerify
(
verifyGenerator
,
globalPubKey
);
})
.
then
((
initData
)
=>
{
expect
(
initData
===
"
init success
"
).
assertTrue
();
return
updateVerify
(
verifyGenerator
,
input
);
})
.
then
((
updateData
)
=>
{
expect
(
updateData
===
"
update success
"
).
assertTrue
();
return
verifyForVerify
(
verifyGenerator
,
input
,
globalSignBlob
);
})
.
then
((
finalStatus
)
=>
{
expect
(
finalStatus
).
assertTrue
();
resolve
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
[Callback] signAndVerifyNormalProcess catch err:
"
+
err
);
reject
(
err
);
});
});
}
async
function
encryptAndDecryptNormalProcessNull
(
asyAlgoName
,
cipherAlgoName
)
{
var
globalCipherText
;
var
globalPubKey
;
var
globalPriKey
;
var
encryptMode
=
cryptoFramework
.
CryptoMode
.
ENCRYPT_MODE
;
var
decryptMode
=
cryptoFramework
.
CryptoMode
.
DECRYPT_MODE
;
return
new
Promise
((
resolve
,
reject
)
=>
{
var
rsaGenerator
=
createAsyKeyGenerator
(
asyAlgoName
);
expect
(
rsaGenerator
!=
null
).
assertTrue
();
var
cipherGeneratorEncrypt
=
createAsyCipher
(
cipherAlgoName
);
expect
(
cipherGeneratorEncrypt
!=
null
).
assertTrue
();
var
cipherGeneratorDecrypt
=
createAsyCipher
(
cipherAlgoName
);
expect
(
cipherGeneratorDecrypt
!=
null
).
assertTrue
();
generateAsyKeyPair
(
rsaGenerator
)
.
then
((
rsaKeyPair
)
=>
{
expect
(
rsaKeyPair
!=
null
).
assertTrue
();
globalPubKey
=
rsaKeyPair
.
pubKey
;
globalPriKey
=
rsaKeyPair
.
priKey
;
return
initCipher
(
cipherGeneratorEncrypt
,
encryptMode
,
globalPubKey
,
null
);
})
.
then
((
initData
)
=>
{
expect
(
initData
===
"
init success
"
).
assertTrue
();
return
doFinalCipher
(
cipherGeneratorEncrypt
,
encryptMode
,
null
);
})
.
then
((
finalOutput
)
=>
{
expect
(
finalOutput
!=
null
).
assertTrue
();
globalCipherText
=
finalOutput
;
console
.
log
(
"
cipherOutput:
"
+
uInt8ArrayToShowStr
(
globalCipherText
.
data
)
);
return
initCipher
(
cipherGeneratorDecrypt
,
decryptMode
,
globalPriKey
,
null
);
})
.
then
((
initData
)
=>
{
expect
(
initData
===
"
init success
"
).
assertTrue
();
return
doFinalCipher
(
cipherGeneratorDecrypt
,
decryptMode
,
globalCipherText
);
})
.
then
((
finalOutput
)
=>
{
if
(
finalOutput
==
null
)
{
console
.
error
(
"
[Callback]decrypt doFinal out is null
"
);
}
else
{
console
.
log
(
"
[Callback]decrypt doFinal out hex:
"
+
uInt8ArrayToShowStr
(
finalOutput
.
data
)
);
}
let
decryptData
=
uInt8ArrayToString
(
finalOutput
.
data
);
expect
(
decryptData
==
globalText
).
assertTrue
();
reject
();
})
.
catch
((
err
)
=>
{
console
.
error
(
"
[Callback] encryptAndDecryptNormalProcess catch err:
"
+
err
);
resolve
(
err
);
});
});
}
export
{
export
{
encryptAndDecryptNormalProcess
,
encryptAndDecryptNormalProcess
,
signAndVerifyNormalProcess
,
signAndVerifyNormalProcess
,
convertKeyEncryptAndDecryptProcess
,
convertKeyEncryptAndDecryptProcess
,
keyAgreementProcess
,
keyAgreementProcess
,
createAsyKeyAgreementFail
,
keyAgreementProcessFail
,
keyAgreementProcessParameterException
,
createAsyKeyGeneratorFail
,
encryptAndDecryptNormalProcessSuperdata
,
signAndVerifyNormalProcessSuperdata
,
encryptAndDecryptNormalProcessNull
,
};
};
security/cryptoFramework/js_api_test_one/src/main/js/test/utils/asymmetric/publicAsymmetricPromise.js
浏览文件 @
dd14b5d7
...
@@ -351,6 +351,74 @@ async function signAndVerifyNormalProcess(asyAlgoName, signVerifyAlgoName) {
...
@@ -351,6 +351,74 @@ async function signAndVerifyNormalProcess(asyAlgoName, signVerifyAlgoName) {
});
});
}
}
async
function
signAndVerifyNormalProcessDataException
(
asyAlgoName
,
signVerifyAlgoName
,
dataType
)
{
var
globalPubKey
;
var
globalPriKey
;
var
globalSignBlob
;
var
globalText
=
"
This is a sign test
"
;
var
input
;
if
(
dataType
==
"
null
"
)
{
input
=
null
;
}
else
{
input
=
{
data
:
stringTouInt8Array
(
globalText
)
};
};
return
new
Promise
((
resolve
,
reject
)
=>
{
var
rsaGenerator
=
createAsyKeyGenerator
(
asyAlgoName
);
expect
(
rsaGenerator
!=
null
).
assertTrue
();
var
signGenerator
=
createAsySign
(
signVerifyAlgoName
);
expect
(
signGenerator
!=
null
).
assertTrue
();
var
verifyGenerator
=
createAsyVerify
(
signVerifyAlgoName
);
expect
(
verifyGenerator
!=
null
).
assertTrue
();
generateAsyKeyPair
(
rsaGenerator
)
.
then
((
rsaKeyPair
)
=>
{
expect
(
rsaKeyPair
!=
null
).
assertTrue
();
globalPubKey
=
rsaKeyPair
.
pubKey
;
globalPriKey
=
rsaKeyPair
.
priKey
;
return
initSign
(
signGenerator
,
globalPriKey
);
})
.
then
((
initData
)
=>
{
expect
(
initData
===
"
init success
"
).
assertTrue
();
return
updateSign
(
signGenerator
,
input
);
})
.
then
((
updateData
)
=>
{
expect
(
updateData
===
"
update success
"
).
assertTrue
();
return
signForSign
(
signGenerator
,
input
);
})
.
then
((
finalOutput
)
=>
{
expect
(
finalOutput
!=
null
).
assertTrue
();
globalSignBlob
=
finalOutput
;
console
.
log
(
"
signOutput:
"
+
uInt8ArrayToShowStr
(
globalSignBlob
.
data
));
return
initVerify
(
verifyGenerator
,
globalPubKey
);
})
.
then
((
initData
)
=>
{
expect
(
initData
===
"
init success
"
).
assertTrue
();
return
updateVerify
(
verifyGenerator
,
input
);
})
.
then
((
updateData
)
=>
{
expect
(
updateData
===
"
update success
"
).
assertTrue
();
return
verifyForVerify
(
verifyGenerator
,
input
,
globalSignBlob
);
})
.
then
((
finalStatus
)
=>
{
expect
(
finalStatus
).
assertTrue
();
if
(
dataType
==
"
null
"
)
{
reject
();
}
else
{
resolve
();
}
})
.
catch
((
err
)
=>
{
console
.
error
(
"
[promise] signAndVerifyNormalProcess catch err:
"
+
err
);
if
(
dataType
==
"
null
"
)
{
resolve
(
err
);
}
else
{
reject
(
err
);
}
});
});
}
async
function
convertKeyEncryptAndDecryptProcess
(
asyAlgoName
)
{
async
function
convertKeyEncryptAndDecryptProcess
(
asyAlgoName
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
var
rsaGenerator
=
createAsyKeyGenerator
(
asyAlgoName
);
var
rsaGenerator
=
createAsyKeyGenerator
(
asyAlgoName
);
...
@@ -445,10 +513,84 @@ async function AsyPriKeyClearProcess(asyAlgoName) {
...
@@ -445,10 +513,84 @@ async function AsyPriKeyClearProcess(asyAlgoName) {
});
});
}
}
async
function
createAsyKeyGeneratorFail
(
asyAlgoName
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
var
rsaGenerator
=
createAsyKeyGenerator
(
asyAlgoName
);
resolve
(
rsaGenerator
);
expect
(
rsaGenerator
==
"
TypeError: Cannot read property algName of null
"
).
assertTrue
();
if
(
rsaGenerator
!=
"
TypeError: Cannot read property algName of null
"
)
{
reject
();
}
});
}
async
function
createAsySignFail
(
asyAlgoName
,
signVerifyAlgoName
,
signVerifyAlgoName1
,
signVerifyAlgoName2
,
signVerifyAlgoName3
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
var
rsaGenerator
=
createAsyKeyGenerator
(
asyAlgoName
);
expect
(
rsaGenerator
!=
null
).
assertTrue
();
var
rsaKeyPair
=
generateAsyKeyPair
(
rsaGenerator
);
expect
(
rsaKeyPair
!=
null
).
assertTrue
();
var
signGenerator
=
createAsySign
(
signVerifyAlgoName
);
expect
(
signGenerator
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
var
signGenerator
=
createAsySign
(
signVerifyAlgoName1
);
expect
(
signGenerator
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
var
signGenerator
=
createAsySign
(
signVerifyAlgoName2
);
expect
(
signGenerator
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
var
signGenerator
=
createAsySign
(
signVerifyAlgoName3
);
resolve
(
signGenerator
);
expect
(
signGenerator
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
if
(
signGenerator
!=
"
TypeError: Cannot read property algName of undefined
"
)
{
reject
();
}
});
}
async
function
createAsyVerifyFail
(
asyAlgoName
,
signVerifyAlgoName
,
signVerifyAlgoName1
,
signVerifyAlgoName2
,
signVerifyAlgoName3
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
var
rsaGenerator
=
createAsyKeyGenerator
(
asyAlgoName
);
expect
(
rsaGenerator
!=
null
).
assertTrue
();
var
rsaKeyPair
=
generateAsyKeyPair
(
rsaGenerator
);
expect
(
rsaKeyPair
!=
null
).
assertTrue
();
var
verifyGenerator
=
createAsyVerify
(
signVerifyAlgoName
);
expect
(
verifyGenerator
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
var
verifyGenerator
=
createAsyVerify
(
signVerifyAlgoName1
);
expect
(
verifyGenerator
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
var
verifyGenerator
=
createAsyVerify
(
signVerifyAlgoName2
);
expect
(
verifyGenerator
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
var
verifyGenerator
=
createAsyVerify
(
signVerifyAlgoName3
);
resolve
(
verifyGenerator
);
expect
(
verifyGenerator
==
"
TypeError: Cannot read property algName of undefined
"
).
assertTrue
();
if
(
verifyGenerator
!=
"
TypeError: Cannot read property algName of undefined
"
)
{
reject
();
}
});
}
export
{
export
{
encryptAndDecryptNormalProcess
,
encryptAndDecryptNormalProcess
,
signAndVerifyNormalProcess
,
signAndVerifyNormalProcess
,
convertKeyEncryptAndDecryptProcess
,
convertKeyEncryptAndDecryptProcess
,
keyAgreementProcess
,
keyAgreementProcess
,
AsyPriKeyClearProcess
,
AsyPriKeyClearProcess
,
signAndVerifyNormalProcessDataException
,
createAsyKeyGeneratorFail
,
createAsySignFail
,
createAsyVerifyFail
,
};
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录