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

!3112 hukscode basic代码verify规格修改

Merge pull request !3112 from 胡吉翔/security_20220505_2
......@@ -96,7 +96,6 @@ async function publicUpdateFunc(HuksOptions, thirdInderfaceName, isEncrypt) {
let inDataArray = HuksOptions.inData;
if (Array.from(inDataArray).length < dateSize) {
await update(handle, HuksOptions);
// HuksOptions.inData = new Uint8Array(new Array());
await publicFinishAbortFunc(HuksOptions, thirdInderfaceName, isEncrypt, 0);
} else {
let count = Math.floor(Array.from(inDataArray).length / dateSize);
......@@ -116,12 +115,7 @@ async function publicUpdateFunc(HuksOptions, thirdInderfaceName, isEncrypt) {
)
);
}
await publicFinishAbortFunc(
HuksOptions,
thirdInderfaceName,
isEncrypt,
remainder
);
await publicFinishAbortFunc(HuksOptions, thirdInderfaceName, isEncrypt);
}
}
......@@ -158,8 +152,7 @@ function updateCallback(handle, HuksOptions) {
async function publicFinishAbortFunc(
HuksOptions,
thirdInderfaceName,
isEncrypt,
remainder
isEncrypt
) {
if (thirdInderfaceName == 'finish') {
await finish(HuksOptions, isEncrypt);
......
......@@ -92,12 +92,7 @@ async function publicUpdateFunc(HuksOptions, thirdInderfaceName, isEncrypt) {
} else {
HuksOptions.inData = new Uint8Array(new Array());
}
await publicFinishAbortFunc(
HuksOptions,
thirdInderfaceName,
isEncrypt,
remainder
);
await publicFinishAbortFunc(HuksOptions, thirdInderfaceName, isEncrypt);
}
}
......@@ -124,8 +119,7 @@ async function update(handle, HuksOptions) {
async function publicFinishAbortFunc(
HuksOptions,
thirdInderfaceName,
isEncrypt,
remainder
isEncrypt
) {
if (thirdInderfaceName == 'finish') {
await finish(HuksOptions, isEncrypt);
......
......@@ -36,7 +36,8 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () {
NewSrcKeyAlies,
HuksOptions,
'abort',
true
true,
srcData63Kb
);
done();
});
......
......@@ -37,7 +37,8 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () {
NewSrcKeyAlies,
HuksOptions,
'abort',
true
true,
srcData65Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
let finishOutData;
describe('SecurityHuksSignVerifyDSACallbackJsunit', function () {
it('testSignVerifyDSA001', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias001';
......@@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () {
),
inData: srcData63Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
newSrcKeyAlies,
HuksOptions,
'finish',
true
true,
srcData63Kb
);
HuksOptions = {
properties: new Array(
......@@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () {
HuksSignVerifyDSA.HuksTagDSADigestSHA1,
HuksSignVerifyDSA.HuksTagDSACOMMONSIZE
),
inData: srcData63Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
newSrcKeyAlies,
HuksOptions,
'finish',
false
false,
srcData63Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
let finishOutData;
describe('SecurityHuksSignVerifyDSACallbackJsunit', function () {
it('testSignVerifyDSA003', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias003';
......@@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () {
),
inData: srcData65Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
newSrcKeyAlies,
HuksOptions,
'finish',
true
true,
srcData65Kb
);
HuksOptions = {
properties: new Array(
......@@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyDSACallbackJsunit', function () {
HuksSignVerifyDSA.HuksTagDSADigestSHA1,
HuksSignVerifyDSA.HuksKeySIZE1024
),
inData: srcData65Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
newSrcKeyAlies,
HuksOptions,
'finish',
false
false,
srcData65Kb
);
done();
});
......
......@@ -36,7 +36,8 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData63Kb
);
done();
});
......
......@@ -36,7 +36,8 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData65Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
let finishOutData;
describe('SecurityHuksSignVerifyECCCallbackJsunit', function () {
it('testSignVerifyECC001', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyECCSize224SIGNNONEKeyAlias001';
......@@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () {
),
inData: srcData63Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData63Kb
);
HuksOptions = {
properties: new Array(
......@@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () {
HuksSignVerifyECC.HuksTagECCDigestNONE,
HuksSignVerifyECC.HuksKeyECCSize224
),
inData: srcData63Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
false
false,
srcData63Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
let finishOutData;
describe('SecurityHuksSignVerifyECCCallbackJsunit', function () {
it('testSignVerifyECC003', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyECCSize224SIGNNONEKeyAlias003';
......@@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () {
),
inData: srcData65Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData65Kb
);
HuksOptions = {
properties: new Array(
......@@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyECCCallbackJsunit', function () {
HuksSignVerifyECC.HuksTagECCDigestNONE,
HuksSignVerifyECC.HuksKeyECCSize224
),
inData: srcData65Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
false
false,
srcData65Kb
);
done();
});
......
......@@ -21,6 +21,7 @@ let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
let finishOutData;
describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () {
it('testSignVerifyED25519001', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyED25519Size256SIGNKeyAlias001';
......@@ -33,12 +34,13 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () {
),
inData: srcData63Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData63Kb
);
HuksOptions = {
......@@ -48,14 +50,15 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () {
HuksSignVerifyED25519.HuksKeyED25519Size256,
HuksSignVerifyED25519.HuksTagDigestSHA1
),
inData: srcData63Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
false
false,
srcData63Kb
);
done();
});
......@@ -76,7 +79,8 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData63Kb
);
done();
});
......@@ -92,12 +96,13 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () {
),
inData: srcData65Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData65Kb
);
HuksOptions = {
properties: new Array(
......@@ -106,14 +111,15 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () {
HuksSignVerifyED25519.HuksKeyED25519Size256,
HuksSignVerifyED25519.HuksTagDigestSHA1
),
inData: srcData65Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
false
false,
srcData65Kb
);
done();
});
......@@ -134,7 +140,8 @@ describe('SecurityHuksSignVerifyED25519CallbackJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData63Kb
);
done();
});
......
......@@ -40,7 +40,8 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData63Kb
);
done();
});
......
......@@ -37,7 +37,8 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData65Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
let finishOutData;
describe('SecurityHuksSignVerifyRSACallbackJsunit', function () {
it('testSignVerifyRSA001', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias001';
......@@ -32,12 +33,13 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () {
),
inData: srcData63Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData63Kb
);
HuksOptions = {
properties: new Array(
......@@ -47,14 +49,15 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () {
HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15,
HuksSignVerifyRSA.HuksKeyRSASize512
),
inData: srcData63Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
false
false,
srcData63Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
let finishOutData;
describe('SecurityHuksSignVerifyRSACallbackJsunit', function () {
it('testSignVerifyRSA003', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias003';
......@@ -32,12 +33,13 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () {
),
inData: srcData65Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData65Kb
);
HuksOptions = {
properties: new Array(
......@@ -47,14 +49,15 @@ describe('SecurityHuksSignVerifyRSACallbackJsunit', function () {
HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15,
HuksSignVerifyRSA.HuksKeyRSASize512
),
inData: srcData65Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
false,
srcData65Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
let finishOutData;
describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () {
it('testSignVerifyDSA102', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias102';
......@@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () {
),
inData: srcData63Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
NewSrcKeyAlies,
HuksOptions,
'abort',
true
true,
srcData63Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
let finishOutData;
describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () {
it('testSignVerifyDSA104', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias104';
......@@ -36,7 +37,8 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () {
NewSrcKeyAlies,
HuksOptions,
'abort',
true
true,
srcData65Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
let finishOutData;
describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () {
it('testSignVerifyDSA101', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias101';
......@@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () {
),
inData: srcData63Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
newSrcKeyAlies,
HuksOptions,
'finish',
true
true,
srcData63Kb
);
HuksOptions = {
properties: new Array(
......@@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () {
HuksSignVerifyDSA.HuksTagDSADigestSHA1,
HuksSignVerifyDSA.HuksTagDSACOMMONSIZE
),
inData: srcData63Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
newSrcKeyAlies,
HuksOptions,
'finish',
false
false,
srcData63Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
let finishOutData;
describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () {
it('testSignVerifyDSA103', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyDSASIGNSHA1KeyAlias103';
......@@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () {
),
inData: srcData65Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
newSrcKeyAlies,
HuksOptions,
'finish',
true
true,
srcData65Kb
);
HuksOptions = {
properties: new Array(
......@@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyDSAPromiseJsunit', function () {
HuksSignVerifyDSA.HuksTagDSADigestSHA1,
HuksSignVerifyDSA.HuksKeySIZE1024
),
inData: srcData65Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
newSrcKeyAlies,
HuksOptions,
'finish',
false
false,
srcData65Kb
);
done();
});
......
......@@ -36,7 +36,8 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData63Kb
);
done();
});
......
......@@ -36,7 +36,8 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData65Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
let finishOutData;
describe('SecurityHuksSignVerifyECCPromiseJsunit', function () {
it('testSignVerifyECC101', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyECCSize224SIGNNONEKeyAlias101';
......@@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () {
),
inData: srcData63Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData63Kb
);
HuksOptions = {
properties: new Array(
......@@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () {
HuksSignVerifyECC.HuksTagECCDigestNONE,
HuksSignVerifyECC.HuksKeyECCSize224
),
inData: srcData63Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
false
false,
srcData63Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
let finishOutData;
describe('SecurityHuksSignVerifyECCPromiseJsunit', function () {
it('testSignVerifyECC103', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyECCSize224SIGNNONEKeyAlias103';
......@@ -31,12 +32,13 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () {
),
inData: srcData65Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData65Kb
);
HuksOptions = {
properties: new Array(
......@@ -45,14 +47,15 @@ describe('SecurityHuksSignVerifyECCPromiseJsunit', function () {
HuksSignVerifyECC.HuksTagECCDigestNONE,
HuksSignVerifyECC.HuksKeyECCSize224
),
inData: srcData65Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
false
false,
srcData65Kb
);
done();
});
......
......@@ -21,6 +21,7 @@ let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
let finishOutData;
describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () {
it('testSignVerifyED25519101', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyED25519Size256SIGNKeyAlias101';
......@@ -33,12 +34,13 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () {
),
inData: srcData63Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData63Kb
);
HuksOptions = {
......@@ -48,14 +50,15 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () {
HuksSignVerifyED25519.HuksKeyED25519Size256,
HuksSignVerifyED25519.HuksTagDigestSHA1
),
inData: srcData63Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
false
false,
srcData63Kb
);
done();
});
......@@ -76,7 +79,8 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData63Kb
);
done();
});
......@@ -92,12 +96,13 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () {
),
inData: srcData65Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData65Kb
);
HuksOptions = {
properties: new Array(
......@@ -106,14 +111,15 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () {
HuksSignVerifyED25519.HuksKeyED25519Size256,
HuksSignVerifyED25519.HuksTagDigestSHA1
),
inData: srcData65Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
false
false,
srcData65Kb
);
done();
});
......@@ -134,7 +140,8 @@ describe('SecurityHuksSignVerifyED25519PromiseJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData65Kb
);
done();
});
......
......@@ -37,7 +37,8 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData63Kb
);
done();
});
......
......@@ -38,7 +38,8 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () {
srcKeyAlies + 'New',
HuksOptions,
'abort',
true
true,
srcData65Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
let finishOutData;
describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () {
it('testSignVerifyRSA101', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias101';
......@@ -32,12 +33,13 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () {
),
inData: srcData63Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData63Kb
);
HuksOptions = {
properties: new Array(
......@@ -47,14 +49,15 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () {
HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15,
HuksSignVerifyRSA.HuksKeyRSASize512
),
inData: srcData63Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
false
false,
srcData63Kb
);
done();
});
......
......@@ -19,6 +19,7 @@ import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
let finishOutData;
describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () {
it('testSignVerifyRSA103', 0, async function (done) {
const srcKeyAlies = 'testSignVerifyRSASize512SIGNPKCS1MD5KeyAlias103';
......@@ -32,12 +33,13 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () {
),
inData: srcData65Kb,
};
await publicSignVerifyFunc(
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
true,
srcData65Kb
);
HuksOptions = {
......@@ -48,14 +50,15 @@ describe('SecurityHuksSignVerifyRSAPromiseJsunit', function () {
HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15,
HuksSignVerifyRSA.HuksKeyRSASize512
),
inData: srcData65Kb,
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true
false,
srcData65Kb
);
done();
});
......
......@@ -49,7 +49,7 @@ function generateKey(srcKeyAlies, HuksOptions) {
async function publicImportKey(keyAlias, HuksOptions) {
let _InData = HuksOptions.inData;
HuksOptions.inData = finishOutData;
HuksOptions.inData = exportKey;
await importKey(keyAlias, HuksOptions)
.then((data) => {
console.log(`test ImportKey data: ${JSON.stringify(data)}`);
......@@ -79,7 +79,7 @@ async function publicExportKey(keyAlias, HuksOptions) {
await exportkey(keyAlias, HuksOptions)
.then((data) => {
console.log(`test exportKey data: ${JSON.stringify(data)}`);
finishOutData = data.outData;
exportKey = data.outData;
})
.catch((err) => {
console.log('test exportKey err information: ' + JSON.stringify(err));
......@@ -127,13 +127,8 @@ function init(srcKeyAlies, HuksOptions) {
});
}
async function publicUpdateFunc(HuksOptions, isBigData) {
let dateSize = 0;
if (isBigData) {
dateSize = 64 * 1024;
} else {
dateSize = 64;
}
async function publicUpdateFunc(HuksOptions) {
let dateSize = 64;
let tempHuksOptionsInData = HuksOptions.inData;
let inDataArray = HuksOptions.inData;
if (uint8ArrayToString(inDataArray).length < dateSize) {
......@@ -194,7 +189,7 @@ async function publicFinishFunc(HuksOptions) {
await finish(handle, HuksOptions)
.then((data) => {
console.log(`test finish data: ${JSON.stringify(data)}`);
exportKey = data.outData;
finishOutData = data.outData;
expect(data.errorCode == 0).assertTrue();
})
.catch((err) => {
......@@ -272,66 +267,52 @@ async function publicSignVerifyFunc(
HuksOptions,
thirdInderfaceName,
isSING,
isBigData
rawData
) {
try {
let keyAlias = srcKeyAlies;
let purposeSignVerigy = HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY;
let purposeSign = HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN;
let PurposeVerify = HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY;
if (isSING) {
HuksOptions.properties.splice(
1,
1,
HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY
);
HuksOptions.properties.splice(1, 1, purposeSignVerigy);
if (HuksOptions.properties[0].value == HksKeyAlg.HKS_ALG_DSA) {
HuksOptions.properties.splice(2, 0, HuksSignVerifyDSA.HuksKeySIZE1024);
}
await publicGenerateKeyFunc(keyAlias, HuksOptions);
HuksOptions.properties.splice(
1,
1,
HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN
);
HuksOptions.properties.splice(1, 1, purposeSign);
if (HuksOptions.properties[0].value == HksKeyAlg.HKS_ALG_DSA) {
HuksOptions.properties.splice(2, 1);
}
} else {
keyAlias = newSrcKeyAlies;
finishOutData = HuksOptions.inData;
await publicImportKey(keyAlias, HuksOptions);
}
await publicInitFunc(keyAlias, HuksOptions);
await publicUpdateFunc(HuksOptions, isBigData);
HuksOptions.inData = rawData;
await publicUpdateFunc(HuksOptions);
if (thirdInderfaceName == 'finish') {
if (isSING) {
HuksOptions.outData = new Uint8Array(new Array(1024));
HuksOptions.inData = new Uint8Array(new Array());
await publicFinishFunc(HuksOptions);
HuksOptions.properties.splice(
1,
1,
HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY
);
HuksOptions.properties.splice(1, 1, purposeSignVerigy);
await publicExportKey(keyAlias, HuksOptions);
} else {
HuksOptions.outData = exportKey;
HuksOptions.inData = finishOutData;
await publicFinishFunc(HuksOptions);
}
} else {
await publicAbortFucn(HuksOptions);
}
if (isSING && thirdInderfaceName == 'abort') {
HuksOptions.properties.splice(
1,
1,
HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY
);
HuksOptions.properties.splice(1, 1, purposeSignVerigy);
await publicDeleteKeyFunc(srcKeyAlies, HuksOptions);
} else if (!isSING) {
HuksOptions.properties.splice(
1,
1,
HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY
);
HuksOptions.properties.splice(1, 1, PurposeVerify);
await publicDeleteKeyFunc(newSrcKeyAlies, HuksOptions);
}
return finishOutData;
} catch (e) {
expect(null).assertFail();
}
......
......@@ -36,7 +36,7 @@ async function publicGenerateKeyFunc(keyAlias, HuksOptions) {
async function publicImportKey(keyAlias, HuksOptions) {
let _InData = HuksOptions.inData;
HuksOptions.inData = finishOutData;
HuksOptions.inData = exportKey;
await huks
.importKey(keyAlias, HuksOptions)
.then((data) => {
......@@ -54,7 +54,7 @@ async function publicExportKey(keyAlias, HuksOptions) {
.exportKey(keyAlias, HuksOptions)
.then((data) => {
console.log(`test exportKey data: ${JSON.stringify(data)}`);
finishOutData = data.outData;
exportKey = data.outData;
})
.catch((err) => {
console.log('test exportKey err information: ' + JSON.stringify(err));
......@@ -76,13 +76,8 @@ async function publicInitFunc(keyAlias, HuksOptions) {
});
}
async function publicUpdateFunc(HuksOptions, isBigData) {
let dateSize = 0;
if (isBigData) {
dateSize = 64 * 1024;
} else {
dateSize = 64;
}
async function publicUpdateFunc(HuksOptions) {
let dateSize = 64;
let tempHuksOptionsInData = HuksOptions.inData;
let inDataArray = HuksOptions.inData;
if (uint8ArrayToString(inDataArray).length < dateSize) {
......@@ -132,7 +127,7 @@ async function publicFinishFunc(HuksOptions) {
.finish(handle, HuksOptions)
.then((data) => {
console.log(`test finish data: ${JSON.stringify(data)}`);
exportKey = data.outData;
finishOutData = data.outData;
expect(data.errorCode == 0).assertTrue();
})
.catch((err) => {
......@@ -173,66 +168,52 @@ async function publicSignVerifyFunc(
HuksOptions,
thirdInderfaceName,
isSING,
isBigData
rawData
) {
try {
let keyAlias = srcKeyAlies;
let purposeSignVerigy = HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY;
let purposeSign = HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN;
let PurposeVerify = HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY;
if (isSING) {
HuksOptions.properties.splice(
1,
1,
HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY
);
HuksOptions.properties.splice(1, 1, purposeSignVerigy);
if (HuksOptions.properties[0].value == HksKeyAlg.HKS_ALG_DSA) {
HuksOptions.properties.splice(2, 0, HuksSignVerifyDSA.HuksKeySIZE1024);
}
await publicGenerateKeyFunc(keyAlias, HuksOptions);
HuksOptions.properties.splice(
1,
1,
HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN
);
HuksOptions.properties.splice(1, 1, purposeSign);
if (HuksOptions.properties[0].value == HksKeyAlg.HKS_ALG_DSA) {
HuksOptions.properties.splice(2, 1);
}
} else {
keyAlias = newSrcKeyAlies;
finishOutData = HuksOptions.inData;
await publicImportKey(keyAlias, HuksOptions);
}
await publicInitFunc(keyAlias, HuksOptions);
await publicUpdateFunc(HuksOptions, isBigData);
HuksOptions.inData = rawData;
await publicUpdateFunc(HuksOptions);
if (thirdInderfaceName == 'finish') {
if (isSING) {
HuksOptions.outData = new Uint8Array(new Array(1024).fill(''));
HuksOptions.inData = new Uint8Array(new Array());
await publicFinishFunc(HuksOptions);
HuksOptions.properties.splice(
1,
1,
HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY
);
HuksOptions.properties.splice(1, 1, purposeSignVerigy);
await publicExportKey(keyAlias, HuksOptions);
} else {
HuksOptions.outData = exportKey;
HuksOptions.inData = finishOutData;
await publicFinishFunc(HuksOptions);
}
} else {
await publicAbortFucn(HuksOptions);
}
if (isSING && thirdInderfaceName == 'abort') {
HuksOptions.properties.splice(
1,
1,
HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY
);
HuksOptions.properties.splice(1, 1, purposeSignVerigy);
await publicDeleteKeyFunc(srcKeyAlies, HuksOptions);
} else if (!isSING) {
HuksOptions.properties.splice(
1,
1,
HuksSignVerifyDSA.HuksKeyDSAPurposeVERIFY
);
HuksOptions.properties.splice(1, 1, PurposeVerify);
await publicDeleteKeyFunc(newSrcKeyAlies, HuksOptions);
}
return finishOutData;
} catch (e) {
expect(null).assertFail();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册