提交 5ed51502 编写于 作者: H hu-jixiang1

国密新增

Signed-off-by: Nhu-jixiang1 <hujixiang1@huawei.com>
Change-Id: I0d4065ea1453b9740a425d1c514fa44381b21f16
上级 b6727106
......@@ -360,3 +360,5 @@ describe('SecurityHuksCipherAESCallbackJsunit', function () {
done();
});
});
export {publicCipherFunc, IV, updateResult};
......@@ -15,3 +15,4 @@
require('./Cipher/SecurityHuksAESBasicCallbackJsunit.test.js');
require('./Cipher/SecurityHuksRSABasicCallbackJsunit.test.js');
require('./Cipher/SecurityHuksSM4BasicCallbackJsunit.test.js');
\ No newline at end of file
......@@ -291,3 +291,5 @@ describe('SecurityHuksCipherAESPromiseJsunit', function () {
done();
});
});
export {publicCipherFunc, IV, updateResult};
\ No newline at end of file
......@@ -15,3 +15,4 @@
require('./Cipher/SecurityHuksCipherAESBasicPromiseJsunit.test.js');
require('./Cipher/SecurityHuksCipherRSABasicPromiseJsunit.test.js');
require('./Cipher/SecurityHuksCipherSM4BasicPromiseJsunit.test.js');
\ No newline at end of file
......@@ -271,3 +271,113 @@ describe('SecurityHuksHmacCallbackJsunit', function () {
done();
});
});
describe('SecurityHuksHmacCallbackJsunit', function () {
it('testHmacSHA1001', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSHA1KeyAlias001';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1
),
inData: srcData63Kb,
};
await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'finish');
done();
});
it('testHmacSHA1002', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSHA1KeyAlias002';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1
),
inData: srcData63Kb,
};
await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort');
done();
});
it('testHmacSHA1003', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSHA1KeyAlias003';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1
),
inData: srcData65Kb,
};
await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'finish');
done();
});
it('testHmacSHA1004', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSHA1KeyAlias004';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSHA1
),
inData: srcData65Kb,
};
await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort');
done();
});
it('testHmacSM3001', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSM3KeyAlias001';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSM3
),
inData: srcData63Kb,
};
await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'finish');
done();
});
it('testHmacSM3002', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSM3KeyAlias002';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSM3
),
inData: srcData63Kb,
};
await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort');
done();
});
it('testHmacSM3003', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSM3KeyAlias003';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSM3
),
inData: srcData65Kb,
};
await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'finish');
done();
});
it('testHmacSM3004', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSM3KeyAlias004';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSM3
),
inData: srcData65Kb,
};
await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort');
done();
});
});
......@@ -179,4 +179,58 @@ describe('SecurityHuksHmacBasicPromiseJsunit', function () {
await publicHmacFunc(srcKeyAlies, HuksOptions, 'abort');
done();
});
it('testHmacSM3001', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSM3KeyAlias001';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSM3
),
inData: srcData63Kb,
};
await publicHmacFunc(srcKeyAlies, HuksOptions, 'finish');
done();
});
it('testHmacSM3002', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSM3KeyAlias002';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSM3
),
inData: srcData63Kb,
};
await publicHmacFunc(srcKeyAlies, HuksOptions, 'abort');
done();
});
it('testHmacSM3003', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSM3KeyAlias003';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSM3
),
inData: srcData65Kb,
};
await publicHmacFunc(srcKeyAlies, HuksOptions, 'finish');
done();
});
it('testHmacSM3004', 0, async function (done) {
let srcKeyAlies = 'testHmacDigestSM3KeyAlias004';
let HuksOptions = {
properties: new Array(
HuksHmac.HuksKeyAlg,
HuksHmac.HuksKeyPurpose,
HuksHmac.HuksTagDigestSM3
),
inData: srcData65Kb,
};
await publicHmacFunc(srcKeyAlies, HuksOptions, 'abort');
done();
});
});
......@@ -26,3 +26,7 @@ require('./SignVerify/SecurityHuksRSABasicAbort63KBCallbackJsunit.test.js');
require('./SignVerify/SecurityHuksRSABasicFinish65KBCallbackJsunit.test.js');
require('./SignVerify/SecurityHuksRSABasicAbort65KBCallbackJsunit.test.js');
require('./SignVerify/SecurityHuksED25519BasicCallbackJsunit.test.js');
require('./SignVerify/SecurityHuksSM2BasicAbort63KBCallbackJsunit.test.js');
require('./SignVerify/SecurityHuksSM2BasicAbort65KBCallbackJsunit.test.js');
require('./SignVerify/SecurityHuksSM2BasicFinish63KBCallbackJsunit.test.js');
require('./SignVerify/SecurityHuksSM2BasicFinish65KBCallbackJsunit.test.js');
\ No newline at end of file
/*
* 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, it } from 'deccjsunit/index';
import Data from '../../../../../../../utils/data.json';
import { HuksSignVerifySM2 } from '../../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyCallback.js';
let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
describe('SecurityHuksSignVerifySM2CallbackJsunit', function () {
it('testSignVerifySM200211111', 0, async function (done) {
const srcKeyAlies = 'testSignVerifySm2Size256SIGNSM3KeyAlias002';
let HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeSIGN,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: srcData63Kb,
};
await publicSignVerifyFunc(
srcKeyAlies,
HuksOptions,
'abort',
true,
srcData63Kb
);
done();
});
});
\ No newline at end of file
/*
* 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, it } from 'deccjsunit/index';
import Data from '../../../../../../../utils/data.json';
import { HuksSignVerifySM2 } from '../../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyCallback.js';
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
describe('SecurityHuksSignVerifySM2CallbackJsunit', function () {
it('testSignVerifySM2004', 0, async function (done) {
const srcKeyAlies = 'testSignVerifySM2Size256SIGNSM3KeyAlias004';
let HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeSIGN,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: srcData65Kb,
};
await publicSignVerifyFunc(
srcKeyAlies,
HuksOptions,
'abort',
true,
srcData65Kb
);
done();
});
});
/*
* 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, it } from 'deccjsunit/index';
import Data from '../../../../../../../utils/data.json';
import { HuksSignVerifySM2 } from '../../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyCallback.js';
let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
let finishOutData;
describe('SecurityHuksSignVerifySM2CallbackJsunit', function () {
it('testSignVerifySM2001', 0, async function (done) {
const srcKeyAlies = 'testSignVerifySM2Size256SIGNSM3KeyAlias001';
let HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeSIGN,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: srcData63Kb,
};
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true,
srcData63Kb
);
HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeVERIFY,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
HuksOptions,
'finish',
false,
srcData63Kb
);
done();
});
});
/*
* 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, it } from 'deccjsunit/index';
import Data from '../../../../../../../utils/data.json';
import { HuksSignVerifySM2 } from '../../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyCallback.js';
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
let finishOutData;
describe('SecurityHuksSignVerifySM2CallbackJsunit', function () {
it('testSignVerifySM2003', 0, async function (done) {
const srcKeyAlies = 'testSignVerifySM2Size256SIGNSM3KeyAlias003';
let HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeSIGN,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: srcData65Kb,
};
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
srcKeyAlies + 'New',
HuksOptions,
'finish',
true,
srcData65Kb
);
HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeVERIFY,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
HuksOptions,
'finish',
false,
srcData65Kb
);
done();
});
});
\ No newline at end of file
......@@ -26,3 +26,7 @@ require('./SignVerify/SecurityHuksRSABasicAbort63KBPromiseJsunit.test.js');
require('./SignVerify/SecurityHuksRSABasicFinish65KBPromiseJsunit.test.js');
require('./SignVerify/SecurityHuksRSABasicAbort65KBPromiseJsunit.test.js');
require('./SignVerify/SecurityHuksED25519BasicPromiseJsunit.test');
require('./SignVerify/SecurityHuksSM2BasicAbort63KBPromiseJsunit.test.js');
require('./SignVerify/SecurityHuksSM2BasicAbort65KBPromiseJsunit.test.js');
require('./SignVerify/SecurityHuksSM2BasicFinish63KBPromiseJsunit.test.js');
require('./SignVerify/SecurityHuksSM2BasicFinish65KBPromiseJsunit.test.js');
\ No newline at end of file
/*
* 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, it } from 'deccjsunit/index';
import Data from '../../../../../../../utils/data.json';
import { HuksSignVerifySM2 } from '../../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
describe('SecurityHuksSignVerifySM2PromiseJsunit', function () {
it('testSignVerifySM2102', 0, async function (done) {
const srcKeyAlies = 'testSignVerifySM2Size256SIGNSM3KeyAlias102';
let HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeSIGN,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: srcData63Kb,
};
await publicSignVerifyFunc(
srcKeyAlies,
HuksOptions,
'abort',
true,
srcData63Kb
);
done();
});
});
/*
* 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, it } from 'deccjsunit/index';
import Data from '../../../../../../../utils/data.json';
import { HuksSignVerifySM2 } from '../../../../../../../utils/param/signverify/publicSignverifyParam';
import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc';
import { publicSignVerifyFunc } from '../../../../../../../utils/param/signverify/publicSignverifyPromise.js';
let srcData65 = Data.Data65b;
let srcData65Kb = stringToUint8Array(srcData65);
describe('SecurityHuksSignVerifySM2PromiseJsunit', function () {
it('testSignVerifySM2104', 0, async function (done) {
const srcKeyAlies = 'testSignVerifySM2Size256SIGNSM3KeyAlias104';
let HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeSIGN,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: srcData65Kb,
};
await publicSignVerifyFunc(srcKeyAlies, HuksOptions, 'abort', true, srcData65Kb);
done();
});
});
/*
* 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, it } from 'deccjsunit/index';
import Data from '../../../../../../../utils/data.json';
import { HuksSignVerifySM2 } from '../../../../../../../utils/param/signverify/publicSignverifyParam';
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('SecurityHuksSignVerifySM2PromiseJsunit', function () {
it('testSignVerifySM2101', 0, async function (done) {
const srcKeyAlies = 'testSignVerifySM2Size256SIGNSM3KeyAlias101';
let HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeSIGN,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: srcData63Kb,
};
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
HuksOptions,
'finish',
true,
srcData63Kb
);
HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeVERIFY,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
HuksOptions,
'finish',
false,
srcData63Kb
);
done();
});
});
/*
* 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, it } from 'deccjsunit/index';
import Data from '../../../../../../../utils/data.json';
import { HuksSignVerifySM2 } from '../../../../../../../utils/param/signverify/publicSignverifyParam';
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('SecurityHuksSignVerifySM2PromiseJsunit', function () {
it('testSignVerifySM2103', 0, async function (done) {
const srcKeyAlies = 'testSignVerifySM2Size256SIGNSM3KeyAlias103';
let HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeSIGN,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: srcData65Kb,
};
finishOutData = await publicSignVerifyFunc(
srcKeyAlies,
HuksOptions,
'finish',
true,
srcData65Kb
);
HuksOptions = {
properties: new Array(
HuksSignVerifySM2.HuksKeyAlgSM2,
HuksSignVerifySM2.HuksKeySM2PurposeVERIFY,
HuksSignVerifySM2.HuksTagSM2DigestSM3,
HuksSignVerifySM2.HuksKeySize256
),
inData: finishOutData,
};
await publicSignVerifyFunc(
srcKeyAlies,
HuksOptions,
'finish',
false,
srcData65Kb
);
done();
});
});
\ No newline at end of file
......@@ -132,4 +132,49 @@ let HuksCipherRSA = {
value: param.HksKeyDigest.HKS_DIGEST_SHA512,
},
};
export { HuksCipherAES, HuksCipherRSA };
let HuksCipherSM4 = {
HuksKeyAlgSM4: {
tag: param.HksTag.HKS_TAG_ALGORITHM,
value: param.HksKeyAlg.HKS_ALG_SM4,
},
HuksKeyPurpose: {
tag: param.HksTag.HKS_TAG_PURPOSE,
value:
param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT |
param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
},
HuksKeyPurposeENCRYPT: {
tag: param.HksTag.HKS_TAG_PURPOSE,
value: param.HksKeyPurpose.HKS_KEY_PURPOSE_ENCRYPT,
},
HuksKeyPurposeDECRYPT: {
tag: param.HksTag.HKS_TAG_PURPOSE,
value: param.HksKeyPurpose.HKS_KEY_PURPOSE_DECRYPT,
},
HuksKeySM4Size128: {
tag: param.HksTag.HKS_TAG_KEY_SIZE,
value: param.HksKeySize.HKS_SM4_KEY_SIZE_128,
},
HuksKeySM4PADDINGNONE: {
tag: param.HksTag.HKS_TAG_PADDING,
value: param.HksKeyPadding.HKS_PADDING_NONE,
},
HuksKeySM4PADDINGPKCS7: {
tag: param.HksTag.HKS_TAG_PADDING,
value: param.HksKeyPadding.HKS_PADDING_PKCS7,
},
HuksKeySM4BLOCKMODECBC: {
tag: param.HksTag.HKS_TAG_BLOCK_MODE,
value: param.HksCipherMode.HKS_MODE_CBC,
},
HuksKeySM4BLOCKMODECTR: {
tag: param.HksTag.HKS_TAG_BLOCK_MODE,
value: param.HksCipherMode.HKS_MODE_CTR,
},
HuksKeySM4BLOCKMODEECB: {
tag: param.HksTag.HKS_TAG_BLOCK_MODE,
value: param.HksCipherMode.HKS_MODE_ECB,
},
};
export { HuksCipherAES, HuksCipherRSA, HuksCipherSM4 };
......@@ -14,7 +14,7 @@
*/
import * as param from '../publicParam';
let HuksHmac = {
let HuksHmac = {
HuksKeyAlg: {
tag: param.HksTag.HKS_TAG_ALGORITHM,
value: param.HksKeyAlg.HKS_ALG_HMAC,
......@@ -47,5 +47,9 @@ let HuksHmac = {
tag: param.HksTag.HKS_TAG_DIGEST,
value: param.HksKeyDigest.HKS_DIGEST_SHA512,
},
HuksTagDigestSM3: {
tag: param.HksTag.HKS_TAG_DIGEST,
value: param.HksKeyDigest.HKS_DIGEST_SM3,
},
};
export { HuksHmac };
......@@ -18,12 +18,15 @@ let HksKeyAlg = {
HKS_ALG_DH: 103,
HKS_ALG_AES: 20,
HKS_ALG_HMAC: 50,
HKS_ALG_X25519: 102,
HKS_ALG_X25519: 101,
HKS_ALG_RSA: 1,
HKS_ALG_PBKDF2: 52,
HKS_ALG_HKDF: 51,
HKS_ALG_DSA: 3,
HKS_ALG_ED25519: 102,
HKS_ALG_SM2: 150,
HKS_ALG_SM3: 151,
HKS_ALG_SM4: 152,
};
let HksKeyPurpose = {
HKS_KEY_PURPOSE_AGREE: 256,
......@@ -67,6 +70,8 @@ let HksKeySize = {
HKS_DSA_KEY_SIZE_2048: 2048,
HKS_DSA_KEY_SIZE_3072: 3072,
HKS_DSA_KEY_SIZE_4096: 4096,
HKS_SM2_KEY_SIZE_256: 256,
HKS_SM4_KEY_SIZE_128: 128,
};
let HksKeyStorageType = {
HKS_STORAGE_TEMP: 0,
......@@ -85,6 +90,7 @@ let HksKeyDigest = {
HKS_DIGEST_SHA256: 12,
HKS_DIGEST_SHA384: 13,
HKS_DIGEST_SHA512: 14,
HKS_DIGEST_SM3: 2,
};
let HksKeyPadding = {
HKS_PADDING_NONE: 0,
......
......@@ -261,4 +261,32 @@ let HuksSignVerifyRSA = {
value: param.HksKeyDigest.HKS_DIGEST_SHA512,
},
};
export { HuksSignVerifyRSA, HuksSignVerifyDSA, HuksSignVerifyECC, HuksSignVerifyED25519 };
let HuksSignVerifySM2 = {
HuksKeySize256: {
tag: param.HksTag.HKS_TAG_KEY_SIZE,
value: param.HksKeySize.HKS_SM2_KEY_SIZE_256,
},
HuksKeyAlgSM2: {
tag: param.HksTag.HKS_TAG_ALGORITHM,
value: param.HksKeyAlg.HKS_ALG_SM2,
},
HuksKeySM2PurposeSIGN: {
tag: param.HksTag.HKS_TAG_PURPOSE,
value: param.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN,
},
HuksKeySM2PurposeVERIFY: {
tag: param.HksTag.HKS_TAG_PURPOSE,
value: param.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
},
HuksTagSM2DigestSM3: {
tag: param.HksTag.HKS_TAG_DIGEST,
value: param.HksKeyDigest.HKS_DIGEST_SM3,
},
HuksKeySM2PurposeSINGVERIFY: {
tag: param.HksTag.HKS_TAG_PURPOSE,
value:
param.HksKeyPurpose.HKS_KEY_PURPOSE_SIGN |
param.HksKeyPurpose.HKS_KEY_PURPOSE_VERIFY,
},
};
export { HuksSignVerifyRSA, HuksSignVerifyDSA, HuksSignVerifyECC, HuksSignVerifyED25519 ,HuksSignVerifySM2};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册