未验证 提交 05b521e7 编写于 作者: O openharmony_ci 提交者: Gitee

!9027 【OpenHarmony 4.0.8.2】【安全子系统】【master】huks XTS Adapter

Merge pull request !9027 from qiaozzzh/0619_1
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import huks from "@ohos.security.huks"; 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 Data from '../../../../../../utils/data.json';
import { import {
stringToUint8Array, stringToUint8Array,
...@@ -56,7 +56,7 @@ let handle; ...@@ -56,7 +56,7 @@ let handle;
let IV = '0000000000000000'; let IV = '0000000000000000';
let IVErr = '00000000000000000000000000000000000000000000000000000000000000000000'; let IVErr = '00000000000000000000000000000000000000000000000000000000000000000000';
let AAD = '0000000000000000'; let AAD = '0000000000000000';
let NONCE = '00000000000'; let NONCE = '000000000000';
let AEAD = '0000000000000000'; let AEAD = '0000000000000000';
let useSoftware = true; let useSoftware = true;
...@@ -239,7 +239,7 @@ async function publicExportFunc(srcKeyAlies, HuksOptions) { ...@@ -239,7 +239,7 @@ async function publicExportFunc(srcKeyAlies, HuksOptions) {
export default function SecurityHuksRSASignExtendJsunit() { export default function SecurityHuksRSASignExtendJsunit() {
describe('SecurityHuksRSASignExtendJsunit', function () { describe('SecurityHuksRSASignExtendJsunit', function () {
beforeAll(async function (done) { beforeAll(async function (done) {
useSoftware = checkSoftware(); useSoftware = await checkSoftware();
done(); done();
}) })
......
...@@ -68,17 +68,14 @@ async function checkSoftware() { ...@@ -68,17 +68,14 @@ async function checkSoftware() {
HuksSignVerifyDSA.HuksTagDSADigestSHA256 HuksSignVerifyDSA.HuksTagDSADigestSHA256
) )
}; };
try { let res = await huks.generateKey(dsaAlies, dsaOption);
let res = await huks.generateKeyItem(dsaAlies, dsaOption); console.log(`test generate:${JSON.stringify(res)}`);
if (res == null) { if (res.errorCode == 0) {
await huks.deleteKeyItem(dsaAlies, dsaOption); await huks.deleteKey(dsaAlies, dsaOption);
console.error("This device uses software"); console.error("This device uses software");
return true; return true;
} else { } else {
console.error("This device does not use software"); console.error("This device does not use software");
return false;
}
} catch (e) {
return false; return false;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册