diff --git a/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksAccessControlJsunit.test.js b/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksAccessControlJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..202ac6a56d50383df00d39b648c5fcf2c71e120d --- /dev/null +++ b/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksAccessControlJsunit.test.js @@ -0,0 +1,438 @@ +/* + * Copyright (C) 2021 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, expect } from 'deccjsunit/index'; +import huks from '@ohos.security.huks'; +import Data from '../../../../../../../utils/data.json'; +import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'; +import { + HuksSignVerifyDSA, + HuksSignVerifyRSA, + HuksSignVerifyECC +} from '../../../../../../../utils/param/signverify/publicSignverifyParam'; +import { HuksAgreeDH, HuksAgreeECDH } from '../../../../../../../utils/param/agree/publicAgreeParam'; +import { HuksCipherAES, HuksCipherRSA } from '../../../../../../../utils/param/cipher/publicCipherParam'; +import { HuksHmac } from '../../../../../../../utils/param/hmac/publicHmacParam'; + +let srcData63 = Data.Data63b; +let srcData63Kb = stringToUint8Array(srcData63); + +function generateKey(srcKeyAlies, HuksOptions) { + return new Promise((resolve, reject) => { + huks.generateKey(srcKeyAlies, HuksOptions, function (err, data) { + console.log(`test generateKey data: ${JSON.stringify(data)}`); + if (err.code !== 0) { + console.log('test generateKey err information: ' + JSON.stringify(err)); + reject(err); + } else { + resolve(data); + } + }); + }); +} + +function exportKey(srcKeyAlies, HuksOptions) { + return new Promise((resolve, reject) => { + huks.exportKey(srcKeyAlies, HuksOptions, function (err, data) { + console.log(`test exportKey data: ${JSON.stringify(data)}`); + if (err.code !== 0) { + console.log('test exportKey err information: ' + JSON.stringify(err)); + reject(err); + } else { + resolve(data); + } + }); + }); +} + +function init(srcKeyAlies, HuksOptions) { + return new Promise((resolve, reject) => { + huks.init(srcKeyAlies, HuksOptions, function (err, data) { + if (err.code !== 0) { + console.log('test init err information: ' + JSON.stringify(err)); + reject(err); + } else { + resolve(data); + } + }); + }); +} + +function deleteKey(srcKeyAlies, HuksOptions) { + return new Promise((resolve, reject) => { + huks.deleteKey(srcKeyAlies, HuksOptions, function (err, data) { + if (err.code !== 0) { + console.log('test deleteKey err information: ' + JSON.stringify(err)); + reject(err); + } else { + resolve(data); + } + }); + }); +} + +async function generateKeyFunc(srcKeyAlies, HuksOptions) { + await generateKey(srcKeyAlies, HuksOptions) + .then((data) => { + console.log(`test generateKey data: ${JSON.stringify(data)}`); + expect(data.errorCode == 0).assertTrue(); + }) + .catch((err) => { + console.log('test generateKey err information: ' + JSON.stringify(err)); + expect(null).assertFail(); + }); +} + +async function deleteKeyFunc(srcKeyAlies, HuksOptions) { + await deleteKey(srcKeyAlies, HuksOptions) + .then((data) => { + console.log(`test deleteKey data ${JSON.stringify(data)}`); + expect(data.errorCode == 0).assertTrue(); + }) + .catch((err) => { + console.log('test deleteKey err information: ' + JSON.stringify(err)); + expect(null).assertFail(); + }); +} + +async function exportKeyFunc(srcKeyAlias, HuksOptions) { + await exportKey(srcKeyAlias, HuksOptions) + .then((data) => { + console.log('test exportKey data = ' + JSON.stringify(data)); + expect(data.errorCode == 0).assertTrue(); + }).catch((err) => { + console.log(`test exportKey err: " + ${JSON.stringify(err)}`); + expect(null).assertFail(); + }) +} + +describe('SecurityHuksAccessControlJsunit', function () { + it('HUKS_Basic_Capability_AccessControl_0100', 0, async function (done) { + let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_0100"; + let HuksOptions = { + properties: new Array( + HuksSignVerifyDSA.HuksKeyAlgDSA, + HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY, + HuksSignVerifyDSA.HuksKeySIZE1024, + HuksSignVerifyDSA.HuksTagDSADigestSHA1 + ), + inData: srcData63Kb, + } + await generateKeyFunc(srcKeyAlias, HuksOptions); + await exportKeyFunc(srcKeyAlias, HuksOptions); + + HuksOptions.properties.splice(1, 1, HuksAgreeDH.HuksKeyPurposeDH); + HuksOptions.properties.splice(3, 1); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(data.errorCode == -112).assertTrue(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -112).assertTrue(); + }); + + await deleteKeyFunc(srcKeyAlias, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_AccessControl_0200', 0, async function (done) { + let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_0200"; + let HuksOptions = { + properties: new Array( + HuksSignVerifyECC.HuksKeyAlgECC, + HuksSignVerifyECC.HuksKeyECCPurposeSINGVERIFY, + HuksSignVerifyECC.HuksKeyECCSize224, + HuksSignVerifyECC.HuksTagECCDigestNONE, + ), + inData: srcData63Kb, + } + await generateKeyFunc(srcKeyAlias, HuksOptions); + await exportKeyFunc(srcKeyAlias, HuksOptions); + + HuksOptions.properties.splice(0, 1, HuksAgreeECDH.HuksKeyAlgECDH); + HuksOptions.properties.splice(1, 1, HuksAgreeECDH.HuksKeyPurposeECDH); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(data.errorCode == -3).assertTrue(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -3).assertTrue(); + }); + await deleteKeyFunc(srcKeyAlias, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_AccessControl_0300', 0, async function (done) { + let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_0300"; + let HuksOptions = { + properties: new Array( + HuksSignVerifyDSA.HuksKeyAlgDSA, + HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY, + HuksSignVerifyDSA.HuksKeySIZE1024, + HuksSignVerifyDSA.HuksTagDSADigestSHA1 + ), + inData: srcData63Kb, + }; + await generateKeyFunc(srcKeyAlias, HuksOptions); + await exportKeyFunc(srcKeyAlias, HuksOptions); + + HuksOptions.properties.splice(1, 1, HuksCipherAES.HuksKeyPurposeENCRYPT); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(null).assertFail(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -112).assertTrue(); + }); + + HuksOptions.properties.splice(1, 1, HuksCipherAES.HuksKeyPurposeDECRYPT); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(null).assertFail(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -112).assertTrue(); + }); + + await deleteKeyFunc(srcKeyAlias, HuksOptions); + done(); + }) + + it("HUKS_Basic_Capability_AccessControl_0400", 0, async function (done) { + let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_0400"; + let HuksOptions = { + properties: new Array( + HuksSignVerifyRSA.HuksKeyAlgRSA, + HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN, + HuksSignVerifyRSA.HuksTagPKCS1DigestMD5, + HuksSignVerifyRSA.HuksKeyRSAPADDINGPKCS1V15, + HuksSignVerifyRSA.HuksKeyRSASize512 + ), + inData: srcData63Kb, + }; + await generateKeyFunc(srcKeyAlias, HuksOptions); + await exportKeyFunc(srcKeyAlias, HuksOptions); + + HuksOptions.properties.splice(1, 1, HuksCipherRSA.HuksKeyPurposeENCRYPT); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(data.errorCode == -3).assertTrue(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -3).assertTrue(); + }); + + HuksOptions.properties.splice(1, 1, HuksCipherRSA.HuksKeyPurposeDECRYPT); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(data.errorCode == -3).assertTrue(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -3).assertTrue(); + }); + + HuksOptions.properties.splice(1, 1, HuksHmac.HuksKeyPurpose); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(data.errorCode == -112).assertTrue(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -112).assertTrue(); + }); + + await deleteKeyFunc(srcKeyAlias, HuksOptions); + done(); + }); + + it("HUKS_Basic_Capability_AccessControl_0500", 0, async function (done) { + let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_0500"; + let HuksOptions = { + properties: new Array( + HuksCipherAES.HuksKeyAlgAES, + HuksCipherAES.HuksKeyPurpose, + HuksCipherAES.HuksKeyAESSize128, + HuksCipherAES.HuksKeyAESBLOCKMODE, + HuksCipherAES.HuksKeyAESPADDINGNONE, + ), + }; + await generateKeyFunc(srcKeyAlias, HuksOptions); + HuksOptions.properties.splice(1, 1, HuksHmac.HuksKeyPurpose); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(data.errorCode == -112).assertTrue(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -112).assertTrue(); + }); + + await deleteKeyFunc(srcKeyAlias, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_AccessControl_0600', 0, async function (done) { + let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_0600"; + let HuksOptions = { + properties: new Array( + HuksSignVerifyDSA.HuksKeyAlgDSA, + HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY, + HuksSignVerifyDSA.HuksKeySIZE1024, + HuksSignVerifyDSA.HuksTagDSADigestSHA1 + ), + inData: srcData63Kb, + }; + await generateKeyFunc(srcKeyAlias, HuksOptions); + await exportKeyFunc(srcKeyAlias, HuksOptions); + + HuksOptions.properties.splice(1, 1, HuksHmac.HuksKeyPurpose); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(null).assertFail(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -112).assertTrue(); + }); + + await deleteKeyFunc(srcKeyAlias, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_AccessControl_0700', 0, async function (done) { + let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_0700"; + let HuksOptions = { + properties: new Array( + HuksCipherAES.HuksKeyAlgAES, + HuksCipherAES.HuksKeyPurpose, + HuksCipherAES.HuksKeyAESSize128, + HuksCipherAES.HuksKeyAESBLOCKMODE, + HuksCipherAES.HuksKeyAESPADDINGNONE, + ), + }; + await generateKeyFunc(srcKeyAlias, HuksOptions); + + HuksOptions.properties.splice(1, 1, HuksSignVerifyRSA.HuksKeyRSAPurposeSIGN); + HuksOptions.properties.splice(5, 1, HuksSignVerifyRSA.HuksTagPKCS1DigestNONE); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(null).assertFail(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -112).assertTrue(); + }); + + HuksOptions.properties.splice(1, 1, HuksSignVerifyRSA.HuksKeyRSAPurposeVERIFY); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(null).assertFail(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -112).assertTrue(); + }); + + await deleteKeyFunc(srcKeyAlias, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_AccessControl_0800', 0, async function (done) { + let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_0800"; + let HuksOptions = { + properties: new Array( + HuksAgreeECDH.HuksKeyAlgECC, + HuksAgreeECDH.HuksKeyPurposeECDH, + HuksAgreeECDH.HuksKeyECCSize224, + HuksAgreeECDH.HuksKeyECCDIGEST, + HuksAgreeECDH.HuksKeyECCPADDING, + HuksAgreeECDH.HuksKeyECCBLOCKMODE + ), + inData: srcData63Kb, + }; + await generateKeyFunc(srcKeyAlias, HuksOptions); + await exportKeyFunc(srcKeyAlias, HuksOptions); + + HuksOptions.properties.splice(0, 1, HuksSignVerifyECC.HuksKeyECCPurposeSIGN); + HuksOptions.properties.splice(4, 2); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(data.errorCode == -3).assertTrue(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -3).assertTrue(); + }); + + HuksOptions.properties.splice(0, 1, HuksSignVerifyECC.HuksKeyECCPurposeVERIFY); + HuksOptions.properties.splice(4, 2); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(data.errorCode == -3).assertTrue(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -3).assertTrue(); + }); + + await deleteKeyFunc(srcKeyAlias, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_AccessControl_0900', 0, async function (done) { + let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_0900"; + let HuksOptions = { + properties: new Array( + HuksSignVerifyDSA.HuksKeyAlgDSA, + HuksSignVerifyDSA.HuksKeyRSAPurposeSINGVERIFY, + HuksSignVerifyDSA.HuksKeySIZE1024, + HuksSignVerifyDSA.HuksTagDSADigestSHA1 + ), + inData: srcData63Kb, + } + await generateKeyFunc(srcKeyAlias, HuksOptions); + await exportKeyFunc(srcKeyAlias, HuksOptions); + + HuksOptions.properties.splice(1, 1, HuksAgreeDH.HuksKeyPurposeDH); + HuksOptions.properties.splice(3, 1); + await huks.init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(data.errorCode == -112).assertTrue(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -112).assertTrue(); + }); + + await deleteKeyFunc(srcKeyAlias, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_AccessControl_1000', 0, async function (done) { + let srcKeyAlias = "HUKS_Basic_Capability_AccessControl_1000"; + let HuksOptions = { + properties: new Array( + HuksCipherAES.HuksKeyAlgAES, + HuksCipherAES.HuksKeyPurposeENCRYPT, + HuksCipherAES.HuksKeyAESSize128, + HuksCipherAES.HuksKeyAESBLOCKMODE, + HuksCipherAES.HuksKeyAESPADDINGNONE, + ), + }; + await generateKeyFunc(srcKeyAlias, HuksOptions); + HuksOptions.properties.splice(1, 1, HuksCipherAES.HuksKeyPurposeDECRYPT); + await init(srcKeyAlias, HuksOptions).then((data) => { + console.log(`test init data: ${JSON.stringify(data)}`); + expect(data.errorCode == -3).assertTrue(); + }).catch((err) => { + console.log(`test init err: " + ${JSON.stringify(err)}`); + expect(err.code == -3).assertTrue(); + }); + + await deleteKeyFunc(srcKeyAlias, HuksOptions); + done(); + }); +}); diff --git a/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksImportJsunit.test.js b/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksImportJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..1c8da16e9b1d6d15106a4059b5e96645986c357d --- /dev/null +++ b/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/HMAC/SecurityHuksImportJsunit.test.js @@ -0,0 +1,1183 @@ +/* + * 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, expect } from 'deccjsunit/index'; +import { stringToUint8Array } from '../../../../../../../utils/param/publicFunc'; +import huks from '@ohos.security.huks'; +import Data from '../../../../../../../utils/data.json'; +import { HuksCipherAES, HuksCipherRSA, HuksCipherSM4 } from '../../../../../../../utils/param/cipher/publicCipherParam' +import { HuksHmac } from '../../../../../../../utils/param/hmac/publicHmacParam' +import { HuksSignVerifyECC, HuksSignVerifyED25519, HuksSignVerifyRSA, HuksSignVerifySM2, HuksSignVerifyDSA } from '../../../../../../../utils/param/signverify/publicSignverifyParam' +import { HuksKeyAlgX25519, HuksAgreeECDH } from '../../../../../../../utils/param/agree/publicAgreeParam' + +let IV = '0000000000000000'; +let srcData63 = Data.Data63b; +let srcData63Kb = stringToUint8Array(srcData63); +let inputEccPair = new Uint8Array([ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0xa5, 0xb8, 0xa3, 0x78, 0x1d, 0x6d, 0x76, 0xe0, 0xb3, 0xf5, 0x6f, 0x43, + 0x9d, 0xcf, 0x60, 0xf6, 0x0b, 0x3f, 0x64, 0x45, 0xa8, 0x3f, 0x1a, 0x96, 0xf1, 0xa1, 0xa4, 0x5d, + 0x3e, 0x2c, 0x3f, 0x13, 0xd7, 0x81, 0xf7, 0x2a, 0xb5, 0x8d, 0x19, 0x3d, 0x9b, 0x96, 0xc7, 0x6a, + 0x10, 0xf0, 0xaa, 0xbc, 0x91, 0x6f, 0x4d, 0xa7, 0x09, 0xb3, 0x57, 0x88, 0x19, 0x6f, 0x00, 0x4b, + 0xad, 0xee, 0x34, 0x35, 0xfb, 0x8b, 0x9f, 0x12, 0xa0, 0x83, 0x19, 0xbe, 0x6a, 0x6f, 0x63, 0x2a, + 0x7c, 0x86, 0xba, 0xca, 0x64, 0x0b, 0x88, 0x96, 0xe2, 0xfa, 0x77, 0xbc, 0x71, 0xe3, 0x0f, 0x0f, + 0x9e, 0x3c, 0xe5, 0xf9]); +let inputECCKey = new Uint8Array([ + 0x5b, 0x00, 0x00, 0x00, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, + 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xc0, + 0xfe, 0x1c, 0x67, 0xde, 0x86, 0x0e, 0xfb, 0xaf, 0xb5, 0x85, 0x52, 0xb4, 0x0e, 0x1f, 0x6c, 0x6c, + 0xaa, 0xc5, 0xd9, 0xd2, 0x4d, 0xb0, 0x8a, 0x72, 0x24, 0xa1, 0x99, 0xaf, 0xfc, 0x3e, 0x55, 0x5a, + 0xac, 0x99, 0x3d, 0xe8, 0x34, 0x72, 0xb9, 0x47, 0x9c, 0xa6, 0xd8, 0xfb, 0x00, 0xa0, 0x1f, 0x9f, + 0x7a, 0x41, 0xe5, 0x44, 0x3e, 0xb2, 0x76, 0x08, 0xa2, 0xbd, 0xe9, 0x41, 0xd5, 0x2b, 0x9e, 0x10, + 0x00, 0x00, 0x00, 0xbf, 0xf9, 0x69, 0x41, 0xf5, 0x49, 0x85, 0x31, 0x35, 0x14, 0x69, 0x12, 0x57, + 0x9c, 0xc8, 0xb7, 0x10, 0x00, 0x00, 0x00, 0x2d, 0xb7, 0xf1, 0x5a, 0x0f, 0xb8, 0x20, 0xc5, 0x90, + 0xe5, 0xca, 0x45, 0x84, 0x5c, 0x08, 0x08, 0x10, 0x00, 0x00, 0x00, 0x43, 0x25, 0x1b, 0x2f, 0x5b, + 0x86, 0xd8, 0x87, 0x04, 0x4d, 0x38, 0xc2, 0x65, 0xcc, 0x9e, 0xb7, 0x20, 0x00, 0x00, 0x00, 0xf4, + 0xe8, 0x93, 0x28, 0x0c, 0xfa, 0x4e, 0x11, 0x6b, 0xe8, 0xbd, 0xa8, 0xe9, 0x3f, 0xa7, 0x8f, 0x2f, + 0xe3, 0xb3, 0xbf, 0xaf, 0xce, 0xe5, 0x06, 0x2d, 0xe6, 0x45, 0x5d, 0x19, 0x26, 0x09, 0xe7, 0x10, + 0x00, 0x00, 0x00, 0xf4, 0x1e, 0x7b, 0x01, 0x7a, 0x84, 0x36, 0xa4, 0xa8, 0x1c, 0x0d, 0x3d, 0xde, + 0x57, 0x66, 0x73, 0x10, 0x00, 0x00, 0x00, 0xe3, 0xff, 0x29, 0x97, 0xad, 0xb3, 0x4a, 0x2c, 0x50, + 0x08, 0xb5, 0x68, 0xe1, 0x90, 0x5a, 0xdc, 0x10, 0x00, 0x00, 0x00, 0x26, 0xae, 0xdc, 0x4e, 0xa5, + 0x6e, 0xb1, 0x38, 0x14, 0x24, 0x47, 0x1c, 0x41, 0x89, 0x63, 0x11, 0x04, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0b, 0xcb, 0xa9, 0xa8, 0x5f, 0x5a, 0x9d, 0xbf, 0xa1, + 0xfc, 0x72, 0x74, 0x87, 0x79, 0xf2, 0xf4, 0x22, 0x0c, 0x8a, 0x4d, 0xd8, 0x7e, 0x10, 0xc8, 0x44, + 0x17, 0x95, 0xab, 0x3b, 0xd2, 0x8f, 0x0a +]); + +let inputX25519Pair = new Uint8Array([ + 0x65, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x9c, 0xf6, 0x7a, 0x8d, 0xce, 0xc2, 0x7f, 0xa7, 0xd9, 0xfd, 0xf1, 0xad, + 0xac, 0xf0, 0xb3, 0x8c, 0xe8, 0x16, 0xa2, 0x65, 0xcc, 0x18, 0x55, 0x60, 0xcd, 0x2f, 0xf5, 0xe5, + 0x72, 0xc9, 0x3c, 0x54, 0x20, 0xd5, 0xbb, 0x54, 0x6f, 0x1f, 0x00, 0x30, 0x4e, 0x33, 0x38, 0xb9, + 0x8e, 0x6a, 0xdf, 0xad, 0x33, 0x6f, 0x51, 0x23, 0xff, 0x4d, 0x95, 0x26, 0xdc, 0xb0, 0x74, 0xb2, + 0x5c, 0x7e, 0x85, 0x6c]); +let inputX25519Key = new Uint8Array([ + 0x20, 0x00, 0x00, 0x00, 0xdc, 0xa3, 0xe3, 0xec, 0xa3, 0x99, 0x06, 0x59, 0xc8, 0x7f, 0xb8, 0x6a, + 0x82, 0xe3, 0x35, 0xfb, 0xa8, 0x8e, 0x0e, 0x10, 0x71, 0x65, 0x22, 0x98, 0x8a, 0x75, 0x94, 0xeb, + 0x01, 0x32, 0xa0, 0x41, 0x10, 0x00, 0x00, 0x00, 0xbf, 0xf9, 0x69, 0x41, 0xf5, 0x49, 0x85, 0x31, + 0x35, 0x14, 0x69, 0x12, 0x57, 0x9c, 0xc8, 0xb7, 0x10, 0x00, 0x00, 0x00, 0x2d, 0xb7, 0xf1, 0x5a, + 0x0f, 0xb8, 0x20, 0xc5, 0x90, 0xe5, 0xca, 0x45, 0x84, 0x5c, 0x08, 0x08, 0x10, 0x00, 0x00, 0x00, + 0x4d, 0xcc, 0xa1, 0x39, 0x68, 0x38, 0xb7, 0x6b, 0xeb, 0xdc, 0x61, 0x6a, 0xe8, 0xe2, 0x47, 0x4b, + 0x20, 0x00, 0x00, 0x00, 0xfa, 0x88, 0xdb, 0x7b, 0x01, 0x89, 0xce, 0x6b, 0x86, 0x09, 0x0a, 0x3d, + 0x3d, 0xb0, 0x80, 0x2b, 0x35, 0x01, 0xdf, 0xa4, 0xb2, 0x3b, 0x58, 0xf3, 0xf2, 0x20, 0xcb, 0x42, + 0x71, 0xf8, 0x91, 0x73, 0x10, 0x00, 0x00, 0x00, 0xf4, 0x1e, 0x7b, 0x01, 0x7a, 0x84, 0x36, 0xa4, + 0xa8, 0x1c, 0x0d, 0x3d, 0xde, 0x57, 0x66, 0x73, 0x10, 0x00, 0x00, 0x00, 0xe3, 0xff, 0x29, 0x97, + 0xad, 0xb3, 0x4a, 0x2c, 0x50, 0x08, 0xb5, 0x68, 0xe1, 0x90, 0x5a, 0xdc, 0x10, 0x00, 0x00, 0x00, + 0xed, 0x0e, 0x12, 0x2d, 0x6b, 0x3d, 0xb3, 0x44, 0xdc, 0x9f, 0xc3, 0xb8, 0xb7, 0x25, 0xff, 0x99, + 0x04, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x25, 0x78, 0xc2, 0xd2, + 0x91, 0x75, 0x1c, 0x82, 0xb9, 0xc9, 0x2b, 0xa8, 0x9e, 0xf3, 0x65, 0x0a, 0x02, 0x8a, 0xaa, 0x96, + 0x26, 0x81, 0x3c, 0x9b, 0xbe, 0x26, 0xfc, 0x7b, 0x7b, 0xca, 0x7d, 0xcb, 0x7e, 0x07, 0x0e, 0xdd, + 0xa3, 0x9b, 0xc5, 0x52, 0xff, 0x8c, 0xe2, 0x4f, 0x8d, 0x64, 0x04, 0x48, 0x79, 0x80, 0x1e, 0x44, + 0xc8, 0xf2, 0x49, 0x07, 0xfc, 0xaa, 0xd5, 0x7e, 0x4d, 0xf9, 0x72, 0x68, 0xda, 0x05, 0xb7, 0x1f, + 0xf8, 0xca, 0x75, 0xb8, 0x55, 0x14, 0xe9, 0xa4, 0x4b, 0xb1, 0x85, 0x28, 0xae, 0xe2, 0xb6, 0x1b +]); + +let aes128Key = new Uint8Array([ + 0x20, 0x00, 0x00, 0x00, 0xdc, 0xa3, 0xe3, 0xec, 0xa3, 0x99, 0x06, 0x59, 0xc8, 0x7f, 0xb8, 0x6a +]); + +let aes192Key = new Uint8Array([ + 0x20, 0x00, 0x00, 0x00, 0xdc, 0xa3, 0xe3, 0xec, 0xa3, 0x99, 0x06, 0x59, 0xc8, 0x7f, 0xb8, 0x6a, + 0x20, 0x00, 0x00, 0x00, 0xdc, 0xa3, 0xe3, 0xec +]); + +let aes256Key = new Uint8Array([ + 0x00, 0x00, 0x00, 0x00, 0x9c, 0xf6, 0x7a, 0x8d, 0xce, 0xc2, 0x7f, 0xa7, 0xd9, 0xfd, 0xf1, 0xad, + 0xac, 0xf0, 0xb3, 0x8c, 0xe8, 0x16, 0xa2, 0x65, 0xcc, 0x18, 0x55, 0x60, 0xcd, 0x2f, 0xf5, 0xe5 +]); + +let aes512Key = new Uint8Array([ + 0x71, 0xf8, 0x91, 0x73, 0x10, 0x00, 0x00, 0x00, 0xf4, 0x1e, 0x7b, 0x01, 0x7a, 0x84, 0x36, 0xa4, + 0xa8, 0x1c, 0x0d, 0x3d, 0xde, 0x57, 0x66, 0x73, 0x10, 0x00, 0x00, 0x00, 0xe3, 0xff, 0x29, 0x97, + 0xad, 0xb3, 0x4a, 0x2c, 0x50, 0x08, 0xb5, 0x68, 0xe1, 0x90, 0x5a, 0xdc, 0x10, 0x00, 0x00, 0x00, + 0xed, 0x0e, 0x12, 0x2d, 0x6b, 0x3d, 0xb3, 0x44, 0xdc, 0x9f, 0xc3, 0xb8, 0xb7, 0x25, 0xff, 0x99 +]); + +let rsa512Key = new Uint8Array([ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0xb6, 0xd8, 0x9b, 0x33, 0x78, 0xa2, 0x63, 0x21, 0x84, 0x47, 0xa1, 0x72, + 0x3d, 0x73, 0x10, 0xbd, 0xe9, 0x5d, 0x78, 0x44, 0x3d, 0x80, 0x18, 0x12, 0x60, 0xed, 0x29, 0x3e, + 0xc7, 0x23, 0x0d, 0x3f, 0x02, 0x59, 0x28, 0xe2, 0x8f, 0x83, 0xdf, 0x37, 0x4b, 0x77, 0xce, 0x5f, + 0xb6, 0xcd, 0x61, 0x72, 0xee, 0x01, 0xe2, 0x37, 0x4d, 0xfd, 0x4f, 0x39, 0xcf, 0xbd, 0xff, 0x84, + 0x57, 0x44, 0xa5, 0x03, 0x01, 0x00, 0x01, 0x35, 0x63, 0x89, 0xed, 0xbd, 0x8b, 0xac, 0xe6, 0x5c, + 0x79, 0x8d, 0xea, 0x8d, 0x86, 0xcb, 0x9c, 0xa8, 0x47, 0x62, 0x96, 0x8a, 0x5e, 0x9c, 0xa8, 0xc1, + 0x24, 0x7e, 0xa6, 0x95, 0xfe, 0xe6, 0x1e, 0xc0, 0xf3, 0x29, 0x76, 0xbb, 0x4d, 0xe4, 0xbc, 0x78, + 0x64, 0xe1, 0x79, 0xcd, 0x8a, 0x45, 0xac, 0x5c, 0x88, 0xea, 0xb4, 0x10, 0xd8, 0x90, 0x65, 0x7b, + 0x94, 0xe8, 0x87, 0x30, 0x2a, 0x04, 0x01, +]); + +let rsa768Key = new Uint8Array([ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x60, 0x00, 0x00, 0x00, 0xc7, 0x06, 0x9c, 0x4b, 0x70, 0x57, 0x9a, 0xb9, 0xd0, 0x3a, 0x4b, 0x0b, + 0xb8, 0x4b, 0x81, 0x54, 0xe7, 0xba, 0xfa, 0xda, 0xf5, 0x04, 0xf0, 0x28, 0x42, 0x6a, 0xb5, 0xb9, + 0xf5, 0x1c, 0x5c, 0x2d, 0xc1, 0x11, 0xe6, 0xe6, 0xe6, 0xfc, 0xeb, 0x33, 0xa0, 0x45, 0xa9, 0x3b, + 0xbf, 0x8f, 0x9d, 0x6e, 0xf5, 0x26, 0xe7, 0xa1, 0xf5, 0x8d, 0x48, 0x48, 0x7f, 0x2a, 0xf8, 0x05, + 0x43, 0xd5, 0xea, 0x56, 0xf4, 0xcf, 0x95, 0xf7, 0x7e, 0x34, 0x0f, 0xee, 0x46, 0x34, 0x05, 0x42, + 0x01, 0xce, 0xce, 0xa0, 0xa4, 0x70, 0x61, 0xb1, 0x99, 0x0d, 0xd8, 0x3c, 0xbf, 0xf9, 0xb2, 0x2a, + 0x32, 0x51, 0x3d, 0xc5, 0x01, 0x00, 0x01, 0x5b, 0x7c, 0xf0, 0x6f, 0xc5, 0x2e, 0xa0, 0x13, 0x76, + 0x62, 0xb5, 0x88, 0xa7, 0xa9, 0x1d, 0xc4, 0x97, 0xd9, 0x5d, 0xe3, 0x34, 0xea, 0x96, 0x33, 0x0b, + 0x84, 0xde, 0x10, 0xa3, 0x59, 0xec, 0x0d, 0xa4, 0x48, 0xc4, 0x69, 0xb4, 0x18, 0xe3, 0x4d, 0x92, + 0x09, 0x33, 0xa8, 0x21, 0x80, 0xb5, 0x0f, 0x32, 0xd7, 0x04, 0xf3, 0x4e, 0x77, 0xba, 0x9b, 0xc5, + 0x20, 0x2c, 0x1e, 0xf7, 0xb3, 0x87, 0x08, 0x03, 0x1f, 0x12, 0x63, 0x4a, 0xbe, 0x5f, 0x71, 0x4d, + 0xf5, 0x5d, 0x3e, 0x4a, 0xaf, 0x84, 0x17, 0x50, 0x9a, 0x5e, 0x04, 0x9e, 0x1f, 0x5a, 0xbd, 0x63, + 0xe7, 0x76, 0x0b, 0x00, 0x22, 0x77, 0xa9, +]); + +let rsa1024Key = new Uint8Array([ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xc7, 0x5e, 0x46, 0xc3, 0x5b, 0x4f, 0x9f, 0x2f, 0x5a, 0xcf, 0x31, 0x65, + 0xcc, 0x71, 0x6e, 0x47, 0x60, 0x17, 0x1d, 0x86, 0xb9, 0x8f, 0xe5, 0x4b, 0x85, 0x7a, 0x67, 0xfe, + 0xa2, 0x03, 0x05, 0x55, 0x16, 0xab, 0x51, 0x20, 0x65, 0xc6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e3, 0x6e, 0x87, 0x88, 0xfd, 0xb4, 0x99, 0xec, 0x37, 0xf0, 0x0b, 0x48, 0x9b, 0xf1, 0x85, + 0x78, 0x20, 0x69, 0xb5, 0xe6, 0xdd, 0xe6, 0x9c, 0x71, 0x1c, 0x17, 0xc6, 0x3d, 0x18, 0x9b, 0xfa, + 0x08, 0x7d, 0xe0, 0xd9, 0x05, 0x4c, 0x3d, +]); + +let rsa2048Key = new Uint8Array([ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0xc5, 0x35, 0x62, 0x48, 0xc4, 0x92, 0x87, 0x73, 0x0d, 0x42, 0x96, 0xfc, + 0x7b, 0x11, 0x05, 0x06, 0x0f, 0x8d, 0x66, 0xc1, 0x0e, 0xad, 0x37, 0x44, 0x92, 0x95, 0x2f, 0x6a, + 0x55, 0xba, 0xec, 0x1d, 0x54, 0x62, 0x0a, 0x4b, 0xd3, 0xc7, 0x05, 0xe4, 0x07, 0x40, 0xd9, 0xb7, + 0xc2, 0x12, 0xcb, 0x9a, 0x90, 0xad, 0xe3, 0x24, 0xe8, 0x5e, 0xa6, 0xf8, 0xd0, 0x6e, 0xbc, 0xd1, + 0x69, 0x7f, 0x6b, 0xe4, 0x2b, 0x4e, 0x1a, 0x65, 0xbb, 0x73, 0x88, 0x6b, 0x7c, 0xaf, 0x7e, 0xd0, + 0x47, 0x26, 0xeb, 0xa5, 0xbe, 0xd6, 0xe8, 0xee, 0x9c, 0xa5, 0x66, 0xa5, 0xc9, 0xd3, 0x25, 0x13, + 0xc4, 0x0e, 0x6c, 0xab, 0x50, 0xb6, 0x50, 0xc9, 0xce, 0x8f, 0x0a, 0x0b, 0xc6, 0x28, 0x69, 0xe9, + 0x83, 0x69, 0xde, 0x42, 0x56, 0x79, 0x7f, 0xde, 0x86, 0x24, 0xca, 0xfc, 0xaa, 0xc0, 0x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, 0xa1, 0xa9, 0x8f, 0x0b, 0x6d, + 0x78, 0x8d, 0x1c, 0xdf, 0xe5, 0x63, 0x82, 0x0b, 0x7d, 0x23, 0x04, 0xb4, 0x75, 0x8c, 0xed, 0x77, + 0xfc, 0x1a, 0x85, 0x29, 0x11, 0xe0, 0x61, +]); + +let rsa3072Key = new Uint8Array([ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0xda, 0xa5, 0x05, 0x33, 0x0c, 0x08, 0x77, 0x97, 0xf3, 0x9f, 0x11, 0xab, + 0x2c, 0xb3, 0xc0, 0xd7, 0xd2, 0x4e, 0x84, 0x62, 0xd8, 0x40, 0x27, 0x4f, 0xb3, 0x3e, 0xa4, 0x61, + 0x75, 0xa9, 0x20, 0x1f, 0xc4, 0xe2, 0x79, 0xe9, 0xf5, 0xba, 0xcc, 0x49, 0x30, 0x03, 0xf3, 0xd4, + 0x1b, 0x81, 0xa2, 0x2e, 0xa3, 0x3a, 0x1e, 0xb9, 0x5e, 0xdc, 0xcd, 0x1b, 0xad, 0x64, 0xfb, 0xb6, + 0x78, 0x2f, 0xf6, 0x14, 0x8d, 0x5f, 0x23, 0xca, 0xbd, 0x81, 0xa5, 0x66, 0xfa, 0x26, 0xc8, 0xe1, + 0xa4, 0x16, 0x23, 0x78, 0x49, 0x00, 0xc1, 0xe5, 0xa8, 0xa0, 0x2f, 0xf7, 0xac, 0xcc, 0x82, 0x6f, + 0xa1, 0x89, 0xd9, 0x2f, 0x44, 0x9f, 0x3d, 0x42, 0x81, 0xae, 0x0e, 0xcb, 0x83, 0xaf, 0x4c, 0x7a, + 0x82, 0x2c, 0x8e, 0xc6, 0x88, 0x18, 0x09, 0xaf, 0x15, 0xd0, 0xe9, 0xfa, 0xb5, 0xc2, 0x67, 0xac, + 0x49, 0x96, 0x5b, 0x42, 0x99, 0x20, 0x95, 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x5a, 0x01, 0xd7, 0x6a, 0xba, 0xa1, 0xee, 0xd8, 0xe0, 0x76, 0x70, 0xde, 0x0a, 0x19, + 0x13, 0xe8, 0xb4, 0x33, 0x90, 0xb2, 0x56, 0x74, 0x43, 0xae, 0x84, 0x15, 0x67, 0x26, 0xc9, 0xed, + 0xb4, 0x4c, 0x85, 0x8e, 0x46, 0xbf, 0xe6, 0xac, 0xaa, 0x75, 0x59, 0xcd, 0xc4, 0x90, 0x50, 0x60, + 0x62, 0x9c, 0xbc, 0xfe, 0x5e, 0x04, 0x02, 0x2c, 0x76, 0x92, 0xfe, 0xad, 0x39, 0xc9, 0x74, 0xd8, + 0x12, 0x61, 0xb0, 0x0b, 0xef, 0x81, 0xb6, 0x20, 0x41, 0x08, 0x99, 0x4c, 0x61, 0x85, 0xca, 0x45, + 0xa0, 0x37, 0xd9, 0xe3, 0xb0, 0xe7, 0x88, 0xe3, 0x7c, 0xd0, 0x70, 0xc2, 0x38, 0x22, 0x50, 0xd8, + 0xa8, 0xe8, 0xba, 0x76, 0x6e, 0x4b, 0x9d, 0x2b, 0x5c, 0x84, 0xf7, 0x0b, 0xce, 0xc9, 0x63, 0x5c, + 0x6e, 0x27, 0xa3, 0xac, 0xad, 0x42, 0xfb, 0xa6, 0x6c, 0x48, 0xca, 0x10, 0xa2, 0x30, 0x29, 0xc3, + 0x00, 0x07, 0x2c, 0xd8, 0x3f, 0xd1, 0x39, 0xee, 0x58, 0x9a, 0x8b, 0x54, 0x8b, 0xf0, 0xc4, 0x3a, + 0xeb, 0x84, 0xda, 0x14, 0x63, 0x06, 0xe0, 0x03, 0xcb, 0x83, 0x75, 0x61, 0xa5, 0x54, 0x24, 0xc3, + 0xb6, 0xd8, 0xa8, 0xbc, 0x26, 0x50, 0x74, 0x45, 0x9d, 0x7a, 0xea, 0xe2, 0x37, 0xf0, 0xfb, 0x5a, + 0xd1, 0xff, 0x3b, 0x97, 0x43, 0xad, 0xf5, 0x19, 0xbf, 0x7a, 0x6f, 0xb7, 0x68, 0x50, 0xbb, 0x84, + 0xaa, 0x6e, 0xc8, 0xf4, 0xd2, 0x4e, 0xd0, 0x5d, 0xd2, 0x19, 0x22, 0xaf, 0xf1, 0xd2, 0x39, 0x93, + 0x7d, 0xfa, 0x00, 0x1b, 0x61, 0x02, 0x82, 0xcf, 0x13, 0xf1, 0xdf, 0x09, 0x9d, 0x73, 0xeb, 0x3a, + 0x3a, 0x8b, 0x01, 0x02, 0xff, 0xf3, 0x1a, 0xa3, 0xb3, 0x3a, 0xe8, 0xac, 0xd1, 0x72, 0xe4, 0xac, + 0x31, 0x25, 0x17, 0xe1, 0xdb, 0x7d, 0x9b, 0x04, 0x2d, 0x58, 0xbf, 0x27, 0xa2, 0x49, 0x4e, 0x3d, + 0x84, 0x0b, 0xd6, 0xf0, 0x1d, 0xc9, 0x80, 0xfb, 0xf5, 0x80, 0xa5, 0x06, 0x75, 0x97, 0xf2, 0x09, + 0x41, 0x4c, 0xe4, 0x10, 0x2b, 0xfc, 0x61, +]); + +let rsa4096Key = new Uint8Array([ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0xcd, 0x1f, 0x40, 0xcd, 0x37, 0x56, 0x2f, 0x78, 0xbb, 0x27, 0x1e, 0xba, + 0x66, 0xba, 0x84, 0xc6, 0xdb, 0xa0, 0x72, 0xf3, 0x1b, 0x53, 0x8c, 0x46, 0x99, 0x65, 0x0d, 0xf7, + 0xb4, 0xae, 0x19, 0x46, 0x1e, 0x05, 0xb0, 0xbc, 0xe1, 0x84, 0x9b, 0x44, 0xc5, 0x06, 0x18, 0xef, + 0x68, 0x4b, 0x80, 0xf4, 0xfc, 0x00, 0x79, 0x8e, 0x21, 0x5e, 0x8f, 0x26, 0x65, 0x69, 0x09, 0x31, + 0x4b, 0xa0, 0x95, 0x37, 0x53, 0xa2, 0xf5, 0x52, 0x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x09, 0x09, + 0xe6, 0x26, 0x37, 0x63, 0x4e, 0x43, 0x4e, 0x70, 0xc1, 0xc8, 0xc7, 0xf1, 0x98, 0x81, 0xa3, 0x94, + 0xa3, 0x3f, 0xe5, 0x40, 0x00, 0x26, 0xf9, 0xef, 0x37, 0x57, 0xdc, 0xf4, 0x14, 0x52, 0x8e, 0x24, + 0xf2, 0x80, 0xf7, 0x09, 0x94, 0x29, 0x04, 0xc0, 0x93, 0xdc, 0xc4, 0xfb, 0x67, 0xa3, 0x93, 0x48, + 0xfe, 0x3e, 0x50, 0x3e, 0x40, 0xbf, 0xa5, 0xfb, 0x73, 0xf7, 0x72, 0xad, 0x1e, 0x79, 0x95, 0x3d, + 0x52, 0x06, 0x6c, 0xc1, 0xfa, 0x63, 0x92, 0xcd, 0xfc, 0xc8, 0x61, 0x9f, 0x8d, 0xc1, 0xc3, 0xce, + 0x5d, 0x88, 0xcd, 0xf0, 0xce, 0x82, 0xb4, 0x2d, 0x17, 0x01, 0x03, 0x74, 0xb1, 0x4c, 0x7c, 0xeb, + 0x53, 0xd6, 0x2a, 0x4c, 0x99, 0xb1, 0x17, 0x89, 0xb6, 0x50, 0x37, 0x51, 0xb4, 0xea, 0x54, 0x4f, + 0x34, 0x5c, 0xc2, 0xa6, 0xe7, 0x15, 0x6c, 0x35, 0xa4, 0x18, 0x76, 0x44, 0x52, 0xda, 0x66, 0x0c, + 0x18, 0x49, 0x2f, 0x7e, 0x54, 0x59, 0xfa, 0x9c, 0xbb, 0xc3, 0xf4, 0x57, 0x59, 0x53, 0x90, 0xca, + 0x73, 0x62, 0xc6, 0xbd, 0xd4, 0x37, 0x0f, 0x6b, 0xb8, 0x6f, 0xbf, 0x24, 0xd4, 0xef, 0xde, 0x98, + 0x9c, 0x05, 0x30, 0xc5, 0xa6, 0xb9, 0x39, 0xe8, 0x5b, 0xc5, 0x30, 0xb8, 0x18, 0xb0, 0x86, 0x33, + 0x1f, 0x36, 0x64, 0xe7, 0x18, 0xd5, 0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x33, 0xc1, 0xdd, 0x88, 0xcc, + 0x37, 0xc9, 0xcd, 0xa3, 0x2b, 0x2b, 0x2c, 0xe2, 0xdb, 0xd7, 0xca, 0x34, 0xe0, 0x0c, 0xb5, 0x3c, + 0xa3, 0x12, 0xa6, 0x94, 0x68, 0xaa, 0x66, 0xc7, 0x92, 0xe2, 0xde, 0x06, 0xbb, 0x48, 0xee, 0x27, + 0x03, 0x7c, 0x0e, 0xf5, 0x51, 0xca, 0xd9, +]); + +let ecc224Key = new Uint8Array([ + 0x02, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x1c, 0x00, 0x00, 0x00, 0x44, 0x84, 0xdd, 0x24, 0xe3, 0x2a, 0xff, 0x99, 0x5e, 0x2a, 0x48, 0x56, + 0xc9, 0x13, 0x16, 0xdf, 0x78, 0x93, 0x1d, 0x3a, 0xbe, 0xba, 0x24, 0xf3, 0xbb, 0x2e, 0xcd, 0x1f, + 0x3f, 0x4a, 0x06, 0x7a, 0xb8, 0xc8, 0x8d, 0x5d, 0x60, 0x19, 0x92, 0x29, 0x06, 0x3c, 0x22, 0xdc, + 0x57, 0x32, 0x45, 0xb9, 0xe4, 0x42, 0x9f, 0xf2, 0xf6, 0xb7, 0xf9, 0xbe, 0x5b, 0x5b, 0x05, 0xea, + 0xec, 0xbf, 0x77, 0xba, 0x29, 0x79, 0x54, 0x5a, 0x4d, 0x10, 0x56, 0x3d, 0x1c, 0x37, 0x12, 0x4c, + 0x34, 0xf7, 0x71, 0xb6, 0x68, 0xf1, 0x26, 0x28, +]); + +let ecc256Key = new Uint8Array([ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0xa5, 0xb8, 0xa3, 0x78, 0x1d, 0x6d, 0x76, 0xe0, 0xb3, 0xf5, 0x6f, 0x43, + 0x9d, 0xcf, 0x60, 0xf6, 0x0b, 0x3f, 0x64, 0x45, 0xa8, 0x3f, 0x1a, 0x96, 0xf1, 0xa1, 0xa4, 0x5d, + 0x3e, 0x2c, 0x3f, 0x13, 0xd7, 0x81, 0xf7, 0x2a, 0xb5, 0x8d, 0x19, 0x3d, 0x9b, 0x96, 0xc7, 0x6a, + 0x10, 0xf0, 0xaa, 0xbc, 0x91, 0x6f, 0x4d, 0xa7, 0x09, 0xb3, 0x57, 0x88, 0x19, 0x6f, 0x00, 0x4b, + 0xad, 0xee, 0x34, 0x35, 0xfb, 0x8b, 0x9f, 0x12, 0xa0, 0x83, 0x19, 0xbe, 0x6a, 0x6f, 0x63, 0x2a, + 0x7c, 0x86, 0xba, 0xca, 0x64, 0x0b, 0x88, 0x96, 0xe2, 0xfa, 0x77, 0xbc, 0x71, 0xe3, 0x0f, 0x0f, + 0x9e, 0x3c, 0xe5, 0xf9, +]); + +let ecc384Key = new Uint8Array([ + 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x30, 0x00, 0x00, 0x00, 0xcf, 0xd3, 0x04, 0xa8, 0xe8, 0x10, 0xf9, 0x95, 0xe3, 0xf3, 0x6c, 0xbb, + 0x72, 0x1b, 0x7c, 0x82, 0x38, 0x67, 0xc7, 0x0f, 0xd5, 0x2e, 0x6d, 0xdf, 0x49, 0xb0, 0xf0, 0x21, + 0x2c, 0x70, 0xb7, 0xcf, 0x21, 0x9d, 0xf3, 0xcd, 0x2e, 0x3e, 0xf9, 0x46, 0x34, 0x8f, 0xc1, 0x77, + 0xc7, 0x4d, 0x72, 0x3c, 0xb5, 0x87, 0xfd, 0xd1, 0x15, 0xb1, 0x1a, 0x42, 0x9d, 0x72, 0x04, 0xee, + 0x29, 0xb6, 0x8d, 0xc0, 0x18, 0x23, 0xc1, 0x5e, 0x85, 0x61, 0xe9, 0xaf, 0x2c, 0x58, 0x62, 0x77, + 0x5d, 0x44, 0xe5, 0x06, 0x30, 0x67, 0x9c, 0x3d, 0xa8, 0x42, 0xc6, 0x8e, 0x35, 0x5e, 0xc4, 0x67, + 0x04, 0xce, 0x88, 0x2d, 0xd5, 0x12, 0xd7, 0x12, 0x29, 0x17, 0xe8, 0x27, 0x08, 0xe3, 0x30, 0x42, + 0xe5, 0xa4, 0x11, 0xbd, 0xbd, 0x1b, 0x27, 0xb2, 0xc6, 0x74, 0xe4, 0xbd, 0x5e, 0x2c, 0x75, 0xd1, + 0xd8, 0x2b, 0xe7, 0x14, 0x0c, 0xee, 0x36, 0x24, 0x99, 0x7a, 0x12, 0xeb, 0xac, 0x57, 0x78, 0x76, + 0xfb, 0x4b, 0x2e, 0x9e, +]); + +let ecc521Key = new Uint8Array([ + 0x02, 0x00, 0x00, 0x00, 0x09, 0x02, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, + 0x42, 0x00, 0x00, 0x00, 0x00, 0x50, 0xfb, 0xd2, 0x63, 0x0f, 0xfb, 0xd3, 0x05, 0x22, 0xd4, 0x05, + 0x8a, 0x79, 0xab, 0x38, 0xac, 0x59, 0xe7, 0x20, 0xfb, 0xf3, 0x2f, 0x07, 0xbf, 0xdf, 0x3e, 0x72, + 0xe6, 0xef, 0x04, 0x46, 0x9e, 0xc0, 0x6e, 0x5e, 0x37, 0x04, 0xe5, 0x88, 0x4d, 0xba, 0x54, 0x73, + 0x68, 0x43, 0xe4, 0x15, 0x3e, 0x9a, 0x9c, 0xc4, 0x6e, 0x84, 0xea, 0xb8, 0xa4, 0x85, 0x0c, 0xd6, + 0x71, 0x2d, 0x61, 0xca, 0xe3, 0xe2, 0x01, 0xa2, 0x5a, 0x25, 0xa7, 0x4f, 0xe6, 0xfb, 0x81, 0xbf, + 0x99, 0x35, 0x0f, 0x6f, 0xf1, 0x92, 0xa1, 0xbb, 0x2b, 0x2a, 0xfa, 0xb7, 0x8d, 0x36, 0xe2, 0x90, + 0xcb, 0xe2, 0xc0, 0x0f, 0xdd, 0x5b, 0x4d, 0x23, 0x6d, 0x9e, 0x77, 0x61, 0x25, 0x92, 0x72, 0x48, + 0xf7, 0x47, 0x35, 0xb2, 0xf6, 0xd6, 0x24, 0x1d, 0x77, 0xd6, 0x7e, 0x9b, 0x0d, 0x5c, 0x67, 0x54, + 0xc6, 0xf4, 0xcf, 0xa5, 0x32, 0x17, 0x08, 0xc6, 0x01, 0xe0, 0x12, 0xfc, 0xbe, 0xe8, 0xc5, 0x35, + 0xeb, 0xd0, 0xa8, 0xdd, 0x9a, 0xc4, 0xbe, 0x29, 0xb4, 0x66, 0x85, 0x24, 0x12, 0x4e, 0xaf, 0x33, + 0x8c, 0x29, 0x0f, 0x48, 0x8d, 0x9c, 0x1b, 0x96, 0xc1, 0x6a, 0x18, 0x12, 0x68, 0x67, 0xf0, 0x43, + 0xac, 0x8f, 0x82, 0xa9, 0x86, 0x30, 0xce, 0xa4, 0x53, 0x71, 0xd6, 0x01, 0x0f, 0x28, 0x1d, 0x8b, + 0x31, 0x73, 0xb1, 0xe5, 0x2f, 0xb9, 0x0b, 0xa1, 0x88, 0x5e, +]); + +let x25519Key = new Uint8Array([ + 0x65, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x9c, 0xf6, 0x7a, 0x8d, 0xce, 0xc2, 0x7f, 0xa7, 0xd9, 0xfd, 0xf1, 0xad, + 0xac, 0xf0, 0xb3, 0x8c, 0xe8, 0x16, 0xa2, 0x65, 0xcc, 0x18, 0x55, 0x60, 0xcd, 0x2f, 0xf5, 0xe5, + 0x72, 0xc9, 0x3c, 0x54, 0x20, 0xd5, 0xbb, 0x54, 0x6f, 0x1f, 0x00, 0x30, 0x4e, 0x33, 0x38, 0xb9, + 0x8e, 0x6a, 0xdf, 0xad, 0x33, 0x6f, 0x51, 0x23, 0xff, 0x4d, 0x95, 0x26, 0xdc, 0xb0, 0x74, 0xb2, + 0x5c, 0x7e, 0x85, 0x6c, +]); + +let ed25519Key = new Uint8Array([ + 0x66, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xab, 0xc7, 0x0f, 0x99, 0x4f, 0x6a, 0x08, 0xd0, 0x9c, 0x5d, 0x10, 0x60, + 0xf8, 0x93, 0xd2, 0x8e, 0xe0, 0x63, 0x0e, 0x70, 0xbf, 0xad, 0x30, 0x41, 0x43, 0x09, 0x27, 0x2d, + 0xb3, 0x30, 0x95, 0xa7, 0x61, 0xd3, 0xe7, 0x53, 0x6d, 0x79, 0x5d, 0x71, 0xc2, 0x2a, 0x51, 0x2d, + 0x5e, 0xcb, 0x67, 0x3d, 0xdd, 0xde, 0xf0, 0xac, 0xdb, 0xba, 0x24, 0xfd, 0xf8, 0x3a, 0x7b, 0x32, + 0x6e, 0x05, 0xe6, 0x37, +]); + +let sm2Key = new Uint8Array([ + 0x96, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0xa4, 0x3e, 0x4b, 0x83, 0x63, 0x72, 0xfb, 0xc8, 0x08, 0xa8, 0xc1, 0xe7, + 0x2b, 0x99, 0xa6, 0x34, 0x3e, 0xd0, 0x56, 0x66, 0xa9, 0xd0, 0x60, 0x3c, 0x95, 0xcb, 0x76, 0xce, + 0x23, 0x70, 0xb6, 0xf6, 0x25, 0xd5, 0x4e, 0xdf, 0x8c, 0x2e, 0x1a, 0x55, 0x05, 0x9f, 0x2b, 0xed, + 0xaf, 0x43, 0x92, 0x34, 0x74, 0xd1, 0x4c, 0xee, 0x7e, 0xa6, 0x04, 0xdd, 0x6c, 0x3d, 0x19, 0x20, + 0x52, 0xf4, 0xb3, 0x3b, 0x37, 0x92, 0x24, 0xee, 0xef, 0x90, 0x59, 0xdb, 0x37, 0x83, 0x58, 0x66, + 0xd9, 0xa0, 0xc1, 0xd4, 0xfa, 0xfc, 0x18, 0xea, 0x87, 0xfd, 0x55, 0x19, 0xce, 0xf9, 0x27, 0xe9, + 0x48, 0x43, 0x68, 0xae, +]); + +let dsa2048Key = new Uint8Array([ + 0x03, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x99, 0x97, 0x76, 0x67, + 0x4a, 0xd1, 0x21, 0xe2, 0xbd, 0x75, 0xf3, 0x05, 0x34, 0xe6, 0xc2, 0x27, 0xf9, 0x4b, 0xb0, 0x47, + 0xb4, 0x7c, 0xc0, 0x16, 0x05, 0x2c, 0x93, 0xd2, 0xdf, 0xe6, 0x13, 0xa8, 0x9b, 0xf4, 0x99, 0x33, + 0x05, 0xf0, 0x0c, 0xa9, 0x88, 0xcc, 0xb0, 0x3e, 0x17, 0x6b, 0x67, 0xc7, 0x8e, 0x31, 0x6d, 0xf7, + 0x34, 0xfe, 0xdd, 0x76, 0x8e, 0x3d, 0xfa, 0x8c, 0x39, 0xdd, 0xce, 0xfa, 0xa9, 0xe2, 0x7b, 0xc0, + 0x01, 0x23, 0xf6, 0x62, 0x93, 0x77, 0x69, 0x91, 0x6e, 0xa5, 0x32, 0x46, 0xbb, 0x95, 0x67, 0x81, + 0xbd, 0xe8, 0xb1, 0xe4, 0xdf, 0xc8, 0x75, 0x99, 0x23, 0xc0, 0x29, 0x1b, 0xc7, 0x23, 0x0b, 0xf2, + 0x11, 0xb8, 0x0e, 0x59, 0x25, 0xe3, 0xa2, 0x3f, 0x22, 0xe4, 0xf6, 0x20, 0xd2, 0xdf, 0x58, 0xd2, + 0x99, 0x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, 0x32, 0x93, 0xc2, 0xd0, 0x54, 0xe0, 0x37, 0x6f, 0xff, 0x0d, 0x67, + 0x4a, 0x90, 0x41, 0x06, 0x33, 0xfc, 0xab, 0xf8, 0xdc, 0x1e, 0x16, 0xf2, 0x06, 0x93, 0xe3, 0x52, + 0x18, 0x46, 0x5e, 0xe3, 0x7f, 0xba, 0x98, 0x56, 0x89, 0x0b, 0xce, 0x0b, 0xba, 0x01, 0xe2, 0x66, + 0x71, 0x85, 0x2a, 0x32, 0x43, 0x9d, 0x48, 0xaf, 0xb9, 0xe4, 0xd3, 0xc8, 0xdc, 0x3a, 0x8e, 0xb4, + 0xf0, 0xa5, 0x11, 0xd4, 0x5f, 0xbf, 0x65, 0x62, 0x76, 0x4c, 0x30, 0xfb, 0x29, 0x1c, 0x15, 0xa6, + 0x16, 0x8a, 0x7f, 0x17, 0x56, 0x40, 0x79, 0x33, 0xd4, 0x91, 0x29, 0xf1, 0x39, 0x8d, 0xfd, 0x48, + 0x97, 0x84, 0xc6, 0x42, 0x1e, 0x83, 0xd2, 0xe5, 0xf9, 0xa4, 0x26, 0x3c, 0xb8, 0x6a, 0xce, 0x8b, + 0xb5, 0x0d, 0xd8, 0x72, 0x38, 0x3b, 0x65, 0xc8, 0x7c, 0x01, 0xf7, 0x6d, 0x8d, 0x50, 0x87, 0xc2, + 0xce, 0x55, 0xfb, 0xe4, 0xf9, 0xe2, 0x98, 0x28, 0x9e, 0x05, 0xdf, 0x28, 0xcc, 0x0f, 0xe3, 0x54, + 0x64, 0x36, 0x2d, 0xa4, 0x7c, 0x5a, 0x0c, 0xcd, 0xe0, 0x51, 0x8f, 0x38, 0x3a, 0xe7, 0x82, 0x3a, + 0x62, 0x69, 0xce, 0xee, 0x53, 0x2a, 0x7c, 0xec, 0x46, 0x5c, 0x51, 0x33, +]); + +function makeImportECCOptions() { + let properties = new Array(); + properties[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_ECC + }; + properties[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_ECC_KEY_SIZE_256 + }; + properties[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP + }; + properties[3] = { + tag: huks.HuksTag.HUKS_TAG_DIGEST, + value: huks.HuksKeyDigest.HUKS_DIGEST_SHA256 + }; + properties[4] = { + tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, + value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR, + }; + let options = { properties: properties, inData: inputEccPair }; + return options; +}; + +function makeImportECCOptions2() { + let properties = new Array(); + properties[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES + }; + properties[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256 + }; + properties[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT + }; + properties[3] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC + }; + properties[4] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE + }; + properties[5] = { + tag: huks.HuksTag.HUKS_TAG_UNWRAP_ALGORITHM_SUITE, + value: huks.HuksUnwrapSuite.HUKS_UNWRAP_SUITE_ECDH_AES_256_GCM_NOPADDING + }; + let options = { properties: properties }; + return options; +}; + +function makeImportX25519Options() { + let properties = new Array(); + properties[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_X25519 + }; + properties[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256 + }; + properties[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP + }; + properties[3] = { + tag: huks.HuksTag.HUKS_TAG_DIGEST, + value: huks.HuksKeyDigest.HUKS_DIGEST_SHA256 + }; + properties[4] = { + tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, + value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR, + }; + let options = { properties: properties, inData: inputX25519Pair }; + return options; +}; + +function makeImportX25519Options2() { + let properties = new Array(); + properties[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_ED25519 + }; + properties[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256 + }; + properties[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY + }; + properties[3] = { + tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, + value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR, + }; + properties[4] = { + tag: huks.HuksTag.HUKS_TAG_UNWRAP_ALGORITHM_SUITE, + value: huks.HuksUnwrapSuite.HUKS_UNWRAP_SUITE_X25519_AES_256_GCM_NOPADDING + }; + let options = { properties: properties }; + return options; +}; + +async function publicGenerateKeyFunc(keyAlias, HuksOptions) { + await huks + .generateKey(keyAlias, HuksOptions) + .then((data) => { + console.error(`test generateKey data: ${JSON.stringify(data)}`); + expect(data.errorCode == 0).assertTrue(); + }) + .catch((err) => { + console.error('test generateKey err information: ' + JSON.stringify(err)); + expect(null).assertFail(); + }); +} + +async function publicImportKey(keyAlias, HuksOptions) { + await huks.importKey(keyAlias, HuksOptions) + .then((data) => { + console.error(`test ImportKey data: ${JSON.stringify(data)}`); + expect(data.errorCode == 0).assertTrue(); + }) + .catch((err) => { + console.error('test exportKey err information: ' + JSON.stringify(err)); + expect(null).assertFail(); + }); +} + +async function publicDeleteKeyFunc(KeyAlias, HuksOptions) { + await huks.deleteKey(KeyAlias, HuksOptions) + .then((data) => { + console.error(`test deleteKey data: ${JSON.stringify(data)}`); + expect(data.errorCode == 0).assertTrue(); + }) + .catch((err) => { + console.error('test deleteKey err information: ' + JSON.stringify(err)); + expect(null).assertFail(); + }); +} + +async function TestImportWrappedFunc(alias, wrappingAlias, options) { + let result = await huks.importWrappedKey(alias, wrappingAlias, options); + if (result.errorCode === 0) { + console.error('test importWrappedKey success'); + expect(result.errorCode == 0).assertTrue(); + } else { + console.error('test importWrappedKey fail'); + expect(null).assertFail(); + } +} + +async function TestImportWrappedKeyECCFunc(alias, wrappingAlias, genOptions, importOptions) { + await publicImportKey(wrappingAlias, genOptions); + importOptions.inData = inputECCKey; + await TestImportWrappedFunc(alias, wrappingAlias, importOptions); +} + +async function TestImportWrappedKeyX25519Func(alias, wrappingAlias, genOptions, importOptions) { + await publicImportKey(wrappingAlias, genOptions); + importOptions.inData = inputX25519Key; + await TestImportWrappedFunc(alias, wrappingAlias, importOptions); +} + +describe('SecurityHuksImportJsunit', function () { + it('HUKS_Basic_Capability_Import_0100', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_0100'; + let HuksOptions = { + properties: new Array( + HuksSignVerifyECC.HuksKeyAlgECC, + HuksSignVerifyECC.HuksKeyECCPurposeSINGVERIFY, + HuksSignVerifyECC.HuksKeyECCSize224, + HuksSignVerifyECC.HuksTagECCDigestNONE, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: ecc224Key, + }; + await publicGenerateKeyFunc(srcKeyAlies, HuksOptions); + await publicImportKey(srcKeyAlies, HuksOptions); + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_0200', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_0200'; + let HuksOptions = { + properties: new Array( + HuksSignVerifyECC.HuksKeyAlgECC, + HuksSignVerifyECC.HuksKeyECCPurposeSINGVERIFY, + HuksSignVerifyECC.HuksKeyECCSize224, + HuksSignVerifyECC.HuksTagECCDigestNONE, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: dsa2048Key, + }; + await huks.importKey(srcKeyAlies, HuksOptions) + .then((data) => { + console.error(`test ImportKey data: ${JSON.stringify(data)}`); + expect(data.errorCode == -19).assertTrue(); + }) + .catch((err) => { + console.error('test exportKey err information: ' + JSON.stringify(err)); + expect(err.code == -19).assertTrue(); + }); + done(); + }); + + it('HUKS_Basic_Capability_Import_0300', 0, async function (done) { + const srcKeyAlies1 = 'HUKS_Basic_Capability_Import_0300'; + const srcKeyAlies2 = 'HUKS_Basic_Capability_Import_0300Wrap'; + let genOptionsECC = makeImportECCOptions(); + let importOptionsECC = makeImportECCOptions2(); + await TestImportWrappedKeyECCFunc(srcKeyAlies1, srcKeyAlies2, genOptionsECC, importOptionsECC); + await publicDeleteKeyFunc(srcKeyAlies1, genOptionsECC); + await publicDeleteKeyFunc(srcKeyAlies2, importOptionsECC); + done(); + }); + + it('HUKS_Basic_Capability_Import_0400', 0, async function (done) { + const srcKeyAlies1 = 'HUKS_Basic_Capability_Import_0400'; + const srcKeyAlies2 = 'HUKS_Basic_Capability_Import_0400Wrap'; + let genOptionsX25519 = makeImportX25519Options(); + let importOptionsX25519 = makeImportX25519Options2(); + await TestImportWrappedKeyX25519Func(srcKeyAlies1, srcKeyAlies2, genOptionsX25519, importOptionsX25519); + await publicDeleteKeyFunc(srcKeyAlies1, genOptionsX25519); + await publicDeleteKeyFunc(srcKeyAlies2, importOptionsX25519); + done(); + }); + + it('HUKS_Basic_Capability_Import_0500', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_0500'; + let HuksOptions = { + properties: new Array( + HuksCipherAES.HuksKeyAlgAES, + HuksCipherAES.HuksKeyPurposeENCRYPT, + HuksCipherAES.HuksKeyAESSize128, + HuksCipherAES.HuksKeyAESPADDINGNONE, + HuksCipherAES.HuksKeyAESBLOCKMODE, + HuksCipherAES.HuksKeyAESDIGESTNONE + ), + inData: aes128Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_0600', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_0600'; + let HuksOptions = { + properties: new Array( + HuksCipherAES.HuksKeyAlgAES, + HuksCipherAES.HuksKeyPurposeENCRYPT, + HuksCipherAES.HuksKeyAESSize192, + HuksCipherAES.HuksKeyAESPADDINGNONE, + HuksCipherAES.HuksKeyAESBLOCKMODE, + HuksCipherAES.HuksKeyAESDIGESTNONE + ), + inData: aes192Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_0700', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_0700'; + let HuksOptions = { + properties: new Array( + HuksCipherAES.HuksKeyAlgAES, + HuksCipherAES.HuksKeyPurposeENCRYPT, + HuksCipherAES.HuksKeyAESSize256, + HuksCipherAES.HuksKeyAESPADDINGNONE, + HuksCipherAES.HuksKeyAESBLOCKMODE, + HuksCipherAES.HuksKeyAESDIGESTNONE + ), + inData: aes256Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_0800', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_0800'; + let HuksOptions = { + properties: new Array( + HuksCipherAES.HuksKeyAlgAES, + HuksCipherAES.HuksKeyPurposeENCRYPT, + HuksCipherAES.HuksKeyAESSize512, + HuksCipherAES.HuksKeyAESPADDINGNONE, + HuksCipherAES.HuksKeyAESBLOCKMODE, + HuksCipherAES.HuksKeyAESDIGESTNONE + ), + inData: aes512Key, + }; + await huks.importKey(srcKeyAlies, HuksOptions) + .then((data) => { + console.error(`test ImportKey data: ${JSON.stringify(data)}`); + expect(data.errorCode == -19).assertTrue(); + }) + .catch((err) => { + console.error('test exportKey err information: ' + JSON.stringify(err)); + expect(err.code == -19).assertTrue(); + }); + done(); + }); + + it('HUKS_Basic_Capability_Import_0900', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_0900'; + let HuksOptions = { + properties: new Array( + HuksCipherRSA.HuksKeyAlgRSA, + HuksCipherRSA.HuksKeyPurpose, + HuksSignVerifyRSA.HuksKeyRSASize512, + HuksCipherRSA.HuksKeyRSAPADDINGNONE, + HuksCipherRSA.HuksKeyRSABLOCKMODEECB, + HuksCipherRSA.HuksKeyRSADIGESTSHA256, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: rsa512Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_1000', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_1000'; + let HuksOptions = { + properties: new Array( + HuksCipherRSA.HuksKeyAlgRSA, + HuksCipherRSA.HuksKeyPurpose, + HuksSignVerifyRSA.HuksKeyRSASize768, + HuksCipherRSA.HuksKeyRSAPADDINGNONE, + HuksCipherRSA.HuksKeyRSABLOCKMODEECB, + HuksCipherRSA.HuksKeyRSADIGESTSHA256, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: rsa768Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_1100', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_1100'; + let HuksOptions = { + properties: new Array( + HuksCipherRSA.HuksKeyAlgRSA, + HuksCipherRSA.HuksKeyPurpose, + HuksSignVerifyRSA.HuksKeyRSASize1024, + HuksCipherRSA.HuksKeyRSAPADDINGNONE, + HuksCipherRSA.HuksKeyRSABLOCKMODEECB, + HuksCipherRSA.HuksKeyRSADIGESTSHA256, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: rsa1024Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_1200', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_1200'; + let HuksOptions = { + properties: new Array( + HuksCipherRSA.HuksKeyAlgRSA, + HuksCipherRSA.HuksKeyPurpose, + HuksSignVerifyRSA.HuksKeyRSASize2048, + HuksCipherRSA.HuksKeyRSAPADDINGNONE, + HuksCipherRSA.HuksKeyRSABLOCKMODEECB, + HuksCipherRSA.HuksKeyRSADIGESTSHA256, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: rsa2048Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_1300', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_1300'; + let HuksOptions = { + properties: new Array( + HuksCipherRSA.HuksKeyAlgRSA, + HuksCipherRSA.HuksKeyPurpose, + HuksSignVerifyRSA.HuksKeyRSASize3072, + HuksCipherRSA.HuksKeyRSAPADDINGNONE, + HuksCipherRSA.HuksKeyRSABLOCKMODEECB, + HuksCipherRSA.HuksKeyRSADIGESTSHA256, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: rsa3072Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_1400', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_1400'; + let HuksOptions = { + properties: new Array( + HuksCipherRSA.HuksKeyAlgRSA, + HuksCipherRSA.HuksKeyPurpose, + HuksSignVerifyRSA.HuksKeyRSASize4096, + HuksCipherRSA.HuksKeyRSAPADDINGNONE, + HuksCipherRSA.HuksKeyRSABLOCKMODEECB, + HuksCipherRSA.HuksKeyRSADIGESTSHA256, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: rsa4096Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_1500', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_1500'; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeySIZE, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSHA1 + ), + inData: aes512Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_1600', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_1600'; + let HuksOptions = { + properties: new Array( + HuksSignVerifyECC.HuksKeyAlgECC, + HuksSignVerifyECC.HuksKeyECCPurposeSIGN, + HuksSignVerifyECC.HuksTagECCDigestNONE, + HuksSignVerifyECC.HuksKeyECCSize224, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: ecc224Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_1700', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_1700'; + let HuksOptions = { + properties: new Array( + HuksSignVerifyECC.HuksKeyAlgECC, + HuksSignVerifyECC.HuksKeyECCPurposeSIGN, + HuksSignVerifyECC.HuksTagECCDigestNONE, + HuksSignVerifyECC.HuksKeyECCSize256, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: ecc256Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_1800', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_1800'; + let HuksOptions = { + properties: new Array( + HuksSignVerifyECC.HuksKeyAlgECC, + HuksSignVerifyECC.HuksKeyECCPurposeSIGN, + HuksSignVerifyECC.HuksTagECCDigestNONE, + HuksSignVerifyECC.HuksKeyECCSize384, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: ecc384Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_1900', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_1900'; + let HuksOptions = { + properties: new Array( + HuksSignVerifyECC.HuksKeyAlgECC, + HuksSignVerifyECC.HuksKeyECCPurposeSIGN, + HuksSignVerifyECC.HuksTagECCDigestNONE, + HuksSignVerifyECC.HuksKeyECCSize521, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: ecc521Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_2000', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_2000'; + let HuksOptions = { + properties: new Array( + HuksAgreeECDH.HuksKeyAlgECC, + HuksAgreeECDH.HuksKeyPurposeECDH, + HuksAgreeECDH.HuksKeyECCSize224, + HuksAgreeECDH.HuksKeyECCDIGEST, + HuksAgreeECDH.HuksKeyECCPADDING, + HuksAgreeECDH.HuksKeyECCBLOCKMODE, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: ecc224Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_2100', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_2100'; + let HuksOptions = { + properties: new Array( + HuksAgreeECDH.HuksKeyAlgECC, + HuksAgreeECDH.HuksKeyPurposeECDH, + HuksAgreeECDH.HuksKeyECCSize256, + HuksAgreeECDH.HuksKeyECCDIGEST, + HuksAgreeECDH.HuksKeyECCPADDING, + HuksAgreeECDH.HuksKeyECCBLOCKMODE, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: ecc256Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_2200', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_2200'; + let HuksOptions = { + properties: new Array( + HuksAgreeECDH.HuksKeyAlgECC, + HuksAgreeECDH.HuksKeyPurposeECDH, + HuksAgreeECDH.HuksKeyECCSize384, + HuksAgreeECDH.HuksKeyECCDIGEST, + HuksAgreeECDH.HuksKeyECCPADDING, + HuksAgreeECDH.HuksKeyECCBLOCKMODE, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: ecc384Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_2300', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_2300'; + let HuksOptions = { + properties: new Array( + HuksAgreeECDH.HuksKeyAlgECC, + HuksAgreeECDH.HuksKeyPurposeECDH, + HuksAgreeECDH.HuksKeyECCSize521, + HuksAgreeECDH.HuksKeyECCDIGEST, + HuksAgreeECDH.HuksKeyECCPADDING, + HuksAgreeECDH.HuksKeyECCBLOCKMODE, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: ecc521Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_2400', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_2400'; + let HuksOptions = { + properties: new Array( + HuksKeyAlgX25519.HuksKeyAlgX25519, + HuksKeyAlgX25519.HuksKeyPurposeAGREE, + HuksKeyAlgX25519.HuksKeyCURVE25519Size256, + HuksKeyAlgX25519.HuksKeyDIGEST, + HuksKeyAlgX25519.HuksKeyPADDING, + HuksKeyAlgX25519.HuksKeyBLOCKMODE, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: x25519Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_2500', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_2500'; + let HuksOptions = { + properties: new Array( + HuksSignVerifyED25519.HuksKeyAlgED25519, + HuksSignVerifyED25519.HuksKeyED25519PurposeSIGN, + HuksSignVerifyED25519.HuksKeyED25519Size256, + HuksSignVerifyED25519.HuksTagDigestSHA1, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: ed25519Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_2600', 0, async function (done) { + const srcKeyAlies1 = 'HUKS_Basic_Capability_Import_2600'; + const srcKeyAlies2 = 'HUKS_Basic_Capability_Import_2600Wrap'; + let genOptionsECC = makeImportECCOptions(); + let importOptionsECC = makeImportECCOptions2(); + await TestImportWrappedKeyECCFunc(srcKeyAlies1, srcKeyAlies2, genOptionsECC, importOptionsECC); + await TestImportWrappedKeyECCFunc(srcKeyAlies1, srcKeyAlies2, genOptionsECC, importOptionsECC); + await publicDeleteKeyFunc(srcKeyAlies1, genOptionsECC); + await publicDeleteKeyFunc(srcKeyAlies2, importOptionsECC); + done(); + }); + + it('HUKS_Basic_Capability_Import_2700', 0, async function (done) { + const srcKeyAlies1 = 'HUKS_Basic_Capability_Import_2700_ECC'; + const srcKeyAlies2 = 'HUKS_Basic_Capability_Import_2700_ECCWrap'; + const srcKeyAlies4 = 'HUKS_Basic_Capability_Import_2700_X25519Wrap'; + let genOptionsECC = makeImportECCOptions(); + let importOptionsECC = makeImportECCOptions2(); + let genOptionsx25519 = makeImportX25519Options(); + let importOptionsx25519 = makeImportX25519Options2(); + await publicImportKey(srcKeyAlies2, genOptionsECC); + importOptionsECC.inData = inputECCKey; + await publicImportKey(srcKeyAlies4, genOptionsx25519); + importOptionsx25519.inData = inputECCKey; + await huks.importWrappedKey(srcKeyAlies1, srcKeyAlies2, importOptionsx25519) + .then((data) => { + console.error(`test ImportKey data: ${JSON.stringify(data)}`); + expect(data.errorCode == -31).assertTrue(); + }) + .catch((err) => { + console.error('test exportKey err information: ' + JSON.stringify(err)); + expect(err.code == -31).assertTrue(); + }); + await publicDeleteKeyFunc(srcKeyAlies2, importOptionsECC); + await publicDeleteKeyFunc(srcKeyAlies4, genOptionsx25519); + done(); + }); + + it('HUKS_Basic_Capability_Import_2800', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_2800'; + let HuksOptions = { + properties: new Array( + HuksSignVerifyDSA.HuksKeyAlgDSA, + HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN, + HuksSignVerifyDSA.HuksTagDSADigestSHA256, + { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048 }, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: dsa2048Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_2900', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_2900'; + let HuksOptions = { + properties: new Array( + HuksSignVerifySM2.HuksKeyAlgSM2, + HuksSignVerifySM2.HuksKeySM2PurposeSINGVERIFY, + HuksSignVerifySM2.HuksKeySize256, + HuksSignVerifySM2.HuksTagSM2DigestSM3, + { tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR } + ), + inData: sm2Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_3000', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_3000'; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksKeySIZE, + HuksHmac.HuksTagDigestSM3 + ), + inData: aes512Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); + + it('HUKS_Basic_Capability_Import_3100', 0, async function (done) { + const srcKeyAlies = 'HUKS_Basic_Capability_Import_3100'; + let HuksOptions = { + properties: new Array( + HuksCipherSM4.HuksKeyAlgSM4, + HuksCipherSM4.HuksKeyPurposeENCRYPT, + HuksCipherSM4.HuksKeySM4Size128, + HuksCipherSM4.HuksKeySM4PADDINGNONE, + HuksCipherSM4.HuksKeySM4BLOCKMODECBC + ), + inData: aes128Key, + }; + await publicImportKey(srcKeyAlies, HuksOptions); + await publicDeleteKeyFunc(srcKeyAlies, HuksOptions); + done(); + }); +}) \ No newline at end of file diff --git a/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/List.test.js b/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/List.test.js index c1577523b98849d3ccf760e7255cf16e5f3a3954..6ffc73f865f221c9712652fb95c865b8bf46f730 100644 --- a/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/List.test.js +++ b/security/security_huks_basic/huks_hmac_callback_BasicTest/entry/src/main/js/test/List.test.js @@ -14,3 +14,5 @@ */ require('./HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js'); +require('./HMAC/SecurityHuksAccessControlJsunit.test.js'); +require('./HMAC/SecurityHuksImportJsunit.test.js'); diff --git a/security/security_huks_basic/utils/param/cipher/publicCipherParam.js b/security/security_huks_basic/utils/param/cipher/publicCipherParam.js index 081a3aee5e184367741086fa2f7a6b4ac46a1f32..49a4542284b8cabcfb1f9c47d480baa12c163b14 100644 --- a/security/security_huks_basic/utils/param/cipher/publicCipherParam.js +++ b/security/security_huks_basic/utils/param/cipher/publicCipherParam.js @@ -44,6 +44,10 @@ let HuksCipherAES = { tag: param.HksTag.HKS_TAG_KEY_SIZE, value: param.HksKeySize.HKS_AES_KEY_SIZE_256, }, + HuksKeyAESSize512: { + tag: param.HksTag.HKS_TAG_KEY_SIZE, + value: param.HksKeySize.HKS_AES_KEY_SIZE_512, + }, HuksKeyAESPADDINGNONE: { tag: param.HksTag.HKS_TAG_PADDING, value: param.HksKeyPadding.HKS_PADDING_NONE,