“4c3e13de9509d4c854bc5b5ffe8fe8bb692dccfb”上不存在“...fluid/tests/git@gitcode.net:paddlepaddle/Paddle.git”
未验证 提交 934b06ac 编写于 作者: O openharmony_ci 提交者: Gitee

!10768 修改变量类型

Merge pull request !10768 from zhangcheng/master
...@@ -56,8 +56,8 @@ RSA512, RSA768, RSA1024, RSA2048, RSA3072, RSA4096, ECC224, ECC256, ECC384, ECC5 ...@@ -56,8 +56,8 @@ RSA512, RSA768, RSA1024, RSA2048, RSA3072, RSA4096, ECC224, ECC256, ECC384, ECC5
import huks from '@ohos.security.huks'; import huks from '@ohos.security.huks';
function StringToUint8Array(str) { function StringToUint8Array(str) {
var arr = []; let arr = [];
for (var i = 0, j = str.length; i < j; ++i) { for (let i = 0, j = str.length; i < j; ++i) {
arr.push(str.charCodeAt(i)); arr.push(str.charCodeAt(i));
} }
return new Uint8Array(arr); return new Uint8Array(arr);
...@@ -190,10 +190,10 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) { ...@@ -190,10 +190,10 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) {
}); });
} }
var srcKeyAlias = 'hukRsaKeyAlias'; let srcKeyAlias = 'hukRsaKeyAlias';
var srcKeyAliasSecond = 'huksRsaKeyAliasSecond'; let srcKeyAliasSecond = 'huksRsaKeyAliasSecond';
var exportKey; let exportKey;
var inputEccPair = new Uint8Array([ let inputEccPair = new Uint8Array([
0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 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, 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, 0x9d, 0xcf, 0x60, 0xf6, 0x0b, 0x3f, 0x64, 0x45, 0xa8, 0x3f, 0x1a, 0x96, 0xf1, 0xa1, 0xa4, 0x5d,
...@@ -205,7 +205,7 @@ var inputEccPair = new Uint8Array([ ...@@ -205,7 +205,7 @@ var inputEccPair = new Uint8Array([
async function testImportExport() { async function testImportExport() {
/* 集成生成密钥参数集 */ /* 集成生成密钥参数集 */
var exportProperties = new Array(); let exportProperties = new Array();
exportProperties[0] = { exportProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_RSA, value: huks.HuksKeyAlg.HUKS_ALG_RSA,
...@@ -232,7 +232,7 @@ async function testImportExport() { ...@@ -232,7 +232,7 @@ async function testImportExport() {
tag: huks.HuksTag.HUKS_TAG_DIGEST, tag: huks.HuksTag.HUKS_TAG_DIGEST,
value: huks.HuksKeyDigest.HUKS_DIGEST_SHA256, value: huks.HuksKeyDigest.HUKS_DIGEST_SHA256,
} }
var huksOptions = { let huksOptions = {
properties: exportProperties, properties: exportProperties,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
...@@ -244,7 +244,7 @@ async function testImportExport() { ...@@ -244,7 +244,7 @@ async function testImportExport() {
await publicExportKeyFunc(srcKeyAlias, huksOptions); await publicExportKeyFunc(srcKeyAlias, huksOptions);
/* 集成导入密钥参数集 */ /* 集成导入密钥参数集 */
var importProperties = new Array(); let importProperties = new Array();
importProperties[0] = { importProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_ECC value: huks.HuksKeyAlg.HUKS_ALG_ECC
...@@ -265,7 +265,7 @@ async function testImportExport() { ...@@ -265,7 +265,7 @@ async function testImportExport() {
tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR,
}; };
var importOptions = { let importOptions = {
properties: importProperties, properties: importProperties,
inData: inputEccPair inData: inputEccPair
}; };
...@@ -466,11 +466,11 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) { ...@@ -466,11 +466,11 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) {
}); });
} }
var importAlias = "importAlias"; let importAlias = "importAlias";
var wrapAlias = "wrappingKeyAlias"; let wrapAlias = "wrappingKeyAlias";
var exportKey; let exportKey;
var inputEccPair = new Uint8Array([ let inputEccPair = new Uint8Array([
0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 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, 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, 0x9d, 0xcf, 0x60, 0xf6, 0x0b, 0x3f, 0x64, 0x45, 0xa8, 0x3f, 0x1a, 0x96, 0xf1, 0xa1, 0xa4, 0x5d,
...@@ -480,7 +480,7 @@ var inputEccPair = new Uint8Array([ ...@@ -480,7 +480,7 @@ var inputEccPair = new Uint8Array([
0x7c, 0x86, 0xba, 0xca, 0x64, 0x0b, 0x88, 0x96, 0xe2, 0xfa, 0x77, 0xbc, 0x71, 0xe3, 0x0f, 0x0f, 0x7c, 0x86, 0xba, 0xca, 0x64, 0x0b, 0x88, 0x96, 0xe2, 0xfa, 0x77, 0xbc, 0x71, 0xe3, 0x0f, 0x0f,
0x9e, 0x3c, 0xe5, 0xf9]); 0x9e, 0x3c, 0xe5, 0xf9]);
var properties = new Array(); let properties = new Array();
properties[0] = { properties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_ECC value: huks.HuksKeyAlg.HUKS_ALG_ECC
...@@ -501,12 +501,12 @@ properties[4] = { ...@@ -501,12 +501,12 @@ properties[4] = {
tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE, tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR, value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR,
}; };
var huksOptions = { let huksOptions = {
properties: properties, properties: properties,
inData: inputEccPair inData: inputEccPair
}; };
var importProperties = new Array(); let importProperties = new Array();
importProperties[0] = { importProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_AES value: huks.HuksKeyAlg.HUKS_ALG_AES
...@@ -531,7 +531,7 @@ importProperties[5] = { ...@@ -531,7 +531,7 @@ importProperties[5] = {
tag: huks.HuksTag.HUKS_TAG_UNWRAP_ALGORITHM_SUITE, tag: huks.HuksTag.HUKS_TAG_UNWRAP_ALGORITHM_SUITE,
value: huks.HuksUnwrapSuite.HUKS_UNWRAP_SUITE_ECDH_AES_256_GCM_NOPADDING value: huks.HuksUnwrapSuite.HUKS_UNWRAP_SUITE_ECDH_AES_256_GCM_NOPADDING
}; };
var importOptions = { let importOptions = {
properties: importProperties, properties: importProperties,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
}; };
...@@ -556,7 +556,7 @@ async function importWrappedKeyItemTest() { ...@@ -556,7 +556,7 @@ async function importWrappedKeyItemTest() {
* nonce1的长度(4字节) + nonce1的数据 + tag1的长度(4字节) + tag1的数据 + * nonce1的长度(4字节) + nonce1的数据 + tag1的长度(4字节) + tag1的数据 +
* keyA长度占用的内存长度(4字节) + keyA的长度 + keyA_enc的长度(4字节) + keyA_enc的数据 * keyA长度占用的内存长度(4字节) + keyA的长度 + keyA_enc的长度(4字节) + keyA_enc的数据
*/ */
var inputKey = new Uint8Array([ let inputKey = new Uint8Array([
0x5b, 0x00, 0x00, 0x00, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 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, 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, 0xfe, 0x1c, 0x67, 0xde, 0x86, 0x0e, 0xfb, 0xaf, 0xb5, 0x85, 0x52, 0xb4, 0x0e, 0x1f, 0x6c, 0x6c,
...@@ -663,16 +663,16 @@ struct Index { ...@@ -663,16 +663,16 @@ struct Index {
import huks from '@ohos.security.huks'; import huks from '@ohos.security.huks';
function StringToUint8Array(str) { function StringToUint8Array(str) {
var arr = []; let arr = [];
for (var i = 0, j = str.length; i < j; ++i) { for (let i = 0, j = str.length; i < j; ++i) {
arr.push(str.charCodeAt(i)); arr.push(str.charCodeAt(i));
} }
return new Uint8Array(arr); return new Uint8Array(arr);
} }
function Uint8ArrayToString(fileData) { function Uint8ArrayToString(fileData) {
var dataString = ''; let dataString = '';
for (var i = 0; i < fileData.length; i++) { for (let i = 0; i < fileData.length; i++) {
dataString += String.fromCharCode(fileData[i]); dataString += String.fromCharCode(fileData[i]);
} }
return dataString; return dataString;
...@@ -820,17 +820,17 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) { ...@@ -820,17 +820,17 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) {
}); });
} }
var IV = '0000000000000000'; let IV = '0000000000000000';
var cipherInData = 'Hks_SM4_Cipher_Test_101010101010101010110_string'; let cipherInData = 'Hks_SM4_Cipher_Test_101010101010101010110_string';
var srcKeyAlias = 'huksCipherSm4SrcKeyAlias'; let srcKeyAlias = 'huksCipherSm4SrcKeyAlias';
var encryptUpdateResult = new Array(); let encryptUpdateResult = new Array();
var handle; let handle;
var updateResult = new Array(); let updateResult = new Array();
var finishOutData; let finishOutData;
async function testSm4Cipher() { async function testSm4Cipher() {
/* 集成生成密钥参数集 & 加密参数集 */ /* 集成生成密钥参数集 & 加密参数集 */
var properties = new Array(); let properties = new Array();
properties[0] = { properties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_SM4, value: huks.HuksKeyAlg.HUKS_ALG_SM4,
...@@ -853,12 +853,12 @@ async function testSm4Cipher() { ...@@ -853,12 +853,12 @@ async function testSm4Cipher() {
tag: huks.HuksTag.HUKS_TAG_PADDING, tag: huks.HuksTag.HUKS_TAG_PADDING,
value: huks.HuksKeyPadding.HUKS_PADDING_NONE, value: huks.HuksKeyPadding.HUKS_PADDING_NONE,
} }
var huksOptions = { let huksOptions = {
properties: properties, properties: properties,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
var propertiesEncrypt = new Array(); let propertiesEncrypt = new Array();
propertiesEncrypt[0] = { propertiesEncrypt[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_SM4, value: huks.HuksKeyAlg.HUKS_ALG_SM4,
...@@ -883,7 +883,7 @@ async function testSm4Cipher() { ...@@ -883,7 +883,7 @@ async function testSm4Cipher() {
tag: huks.HuksTag.HUKS_TAG_IV, tag: huks.HuksTag.HUKS_TAG_IV,
value: StringToUint8Array(IV), value: StringToUint8Array(IV),
} }
var encryptOptions = { let encryptOptions = {
properties: propertiesEncrypt, properties: propertiesEncrypt,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
...@@ -911,7 +911,7 @@ async function testSm4Cipher() { ...@@ -911,7 +911,7 @@ async function testSm4Cipher() {
tag: huks.HuksTag.HUKS_TAG_PURPOSE, tag: huks.HuksTag.HUKS_TAG_PURPOSE,
value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT,
}); });
var decryptOptions = { let decryptOptions = {
properties: propertiesEncrypt, properties: propertiesEncrypt,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
...@@ -967,16 +967,16 @@ struct Index { ...@@ -967,16 +967,16 @@ struct Index {
import huks from '@ohos.security.huks'; import huks from '@ohos.security.huks';
function StringToUint8Array(str) { function StringToUint8Array(str) {
var arr = []; let arr = [];
for (var i = 0, j = str.length; i < j; ++i) { for (let i = 0, j = str.length; i < j; ++i) {
arr.push(str.charCodeAt(i)); arr.push(str.charCodeAt(i));
} }
return new Uint8Array(arr); return new Uint8Array(arr);
} }
function Uint8ArrayToString(fileData) { function Uint8ArrayToString(fileData) {
var dataString = ''; let dataString = '';
for (var i = 0; i < fileData.length; i++) { for (let i = 0; i < fileData.length; i++) {
dataString += String.fromCharCode(fileData[i]); dataString += String.fromCharCode(fileData[i]);
} }
return dataString; return dataString;
...@@ -1124,20 +1124,20 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) { ...@@ -1124,20 +1124,20 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) {
}); });
} }
var AAD = '0000000000000000'; let AAD = '0000000000000000';
var NONCE = '000000000000'; let NONCE = '000000000000';
var AEAD = '0000000000000000'; let AEAD = '0000000000000000';
var cipherInData = 'Hks_AES_Cipher_Test_00000000000000000000000000000000000000000000000000000_string'; let cipherInData = 'Hks_AES_Cipher_Test_00000000000000000000000000000000000000000000000000000_string';
var srcKeyAlias = 'huksCipherSm4SrcKeyAlias'; let srcKeyAlias = 'huksCipherSm4SrcKeyAlias';
var updateResult = new Array(); let updateResult = new Array();
var encryptUpdateResult = new Array(); let encryptUpdateResult = new Array();
var decryptUpdateResult = new Array(); let decryptUpdateResult = new Array();
var handle; let handle;
var finishOutData; let finishOutData;
async function testAesCipher() { async function testAesCipher() {
/* 集成生成密钥参数集 & 加密参数集 */ /* 集成生成密钥参数集 & 加密参数集 */
var properties = new Array(); let properties = new Array();
properties[0] = { properties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_AES, value: huks.HuksKeyAlg.HUKS_ALG_AES,
...@@ -1160,12 +1160,12 @@ async function testAesCipher() { ...@@ -1160,12 +1160,12 @@ async function testAesCipher() {
tag: huks.HuksTag.HUKS_TAG_PADDING, tag: huks.HuksTag.HUKS_TAG_PADDING,
value: huks.HuksKeyPadding.HUKS_PADDING_NONE, value: huks.HuksKeyPadding.HUKS_PADDING_NONE,
} }
var huksOptions = { let huksOptions = {
properties: properties, properties: properties,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
var propertiesEncrypt = new Array(); let propertiesEncrypt = new Array();
propertiesEncrypt[0] = { propertiesEncrypt[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_AES, value: huks.HuksKeyAlg.HUKS_ALG_AES,
...@@ -1202,7 +1202,7 @@ async function testAesCipher() { ...@@ -1202,7 +1202,7 @@ async function testAesCipher() {
tag: huks.HuksTag.HUKS_TAG_AE_TAG, tag: huks.HuksTag.HUKS_TAG_AE_TAG,
value: StringToUint8Array(AEAD), value: StringToUint8Array(AEAD),
} }
var encryptOptions = { let encryptOptions = {
properties: propertiesEncrypt, properties: propertiesEncrypt,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
...@@ -1236,7 +1236,7 @@ async function testAesCipher() { ...@@ -1236,7 +1236,7 @@ async function testAesCipher() {
tag: huks.HuksTag.HUKS_TAG_AE_TAG, tag: huks.HuksTag.HUKS_TAG_AE_TAG,
value: new Uint8Array(encryptUpdateResult.splice(encryptUpdateResult.length - 16,encryptUpdateResult.length)) value: new Uint8Array(encryptUpdateResult.splice(encryptUpdateResult.length - 16,encryptUpdateResult.length))
}); });
var decryptOptions = { let decryptOptions = {
properties: propertiesEncrypt, properties: propertiesEncrypt,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
...@@ -1342,8 +1342,8 @@ Update过程只将inData发送到Core中记录在ctx中,不进行Hash计算, ...@@ -1342,8 +1342,8 @@ Update过程只将inData发送到Core中记录在ctx中,不进行Hash计算,
import huks from '@ohos.security.huks'; import huks from '@ohos.security.huks';
function StringToUint8Array(str) { function StringToUint8Array(str) {
var arr = []; let arr = [];
for (var i = 0, j = str.length; i < j; ++i) { for (let i = 0, j = str.length; i < j; ++i) {
arr.push(str.charCodeAt(i)); arr.push(str.charCodeAt(i));
} }
return new Uint8Array(arr); return new Uint8Array(arr);
...@@ -1569,15 +1569,15 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) { ...@@ -1569,15 +1569,15 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) {
}); });
} }
var signVerifyInData = 'signVerifyInDataForTest'; let signVerifyInData = 'signVerifyInDataForTest';
var generateKeyAlias = 'generateKeyAliasForTest'; let generateKeyAlias = 'generateKeyAliasForTest';
var importKeyAlias = 'importKeyAliasForTest'; let importKeyAlias = 'importKeyAliasForTest';
var handle; let handle;
var exportKey; let exportKey;
var finishOutData; let finishOutData;
/* 集成生成密钥参数集 */ /* 集成生成密钥参数集 */
var generateKeyProperties = new Array(); let generateKeyProperties = new Array();
generateKeyProperties[0] = { generateKeyProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_SM2, value: huks.HuksKeyAlg.HUKS_ALG_SM2,
...@@ -1596,13 +1596,13 @@ generateKeyProperties[3] = { ...@@ -1596,13 +1596,13 @@ generateKeyProperties[3] = {
tag: huks.HuksTag.HUKS_TAG_DIGEST, tag: huks.HuksTag.HUKS_TAG_DIGEST,
value: huks.HuksKeyDigest.HUKS_DIGEST_SM3, value: huks.HuksKeyDigest.HUKS_DIGEST_SM3,
} }
var genrateKeyOptions = { let genrateKeyOptions = {
properties: generateKeyProperties, properties: generateKeyProperties,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
/* 集成签名参数集 */ /* 集成签名参数集 */
var signProperties = new Array(); let signProperties = new Array();
signProperties[0] = { signProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_SM2, value: huks.HuksKeyAlg.HUKS_ALG_SM2,
...@@ -1620,13 +1620,13 @@ signProperties[3] = { ...@@ -1620,13 +1620,13 @@ signProperties[3] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_SM2_KEY_SIZE_256, value: huks.HuksKeySize.HUKS_SM2_KEY_SIZE_256,
} }
var signOptions = { let signOptions = {
properties: signProperties, properties: signProperties,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
/* 集成验签参数集 */ /* 集成验签参数集 */
var verifyProperties = new Array(); let verifyProperties = new Array();
verifyProperties[0] = { verifyProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_SM2, value: huks.HuksKeyAlg.HUKS_ALG_SM2,
...@@ -1643,7 +1643,7 @@ verifyProperties[3] = { ...@@ -1643,7 +1643,7 @@ verifyProperties[3] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_SM2_KEY_SIZE_256, value: huks.HuksKeySize.HUKS_SM2_KEY_SIZE_256,
} }
var verifyOptions = { let verifyOptions = {
properties: verifyProperties, properties: verifyProperties,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
...@@ -1653,8 +1653,8 @@ async function testSm2SignVerify() { ...@@ -1653,8 +1653,8 @@ async function testSm2SignVerify() {
await publicGenKeyFunc(generateKeyAlias, genrateKeyOptions); await publicGenKeyFunc(generateKeyAlias, genrateKeyOptions);
/* 签名 */ /* 签名 */
var signHandle; let signHandle;
var signFinishOutData; let signFinishOutData;
await publicInitFunc(generateKeyAlias, signOptions); await publicInitFunc(generateKeyAlias, signOptions);
signHandle = handle; signHandle = handle;
...@@ -1673,7 +1673,7 @@ async function testSm2SignVerify() { ...@@ -1673,7 +1673,7 @@ async function testSm2SignVerify() {
await publicImportKeyFunc(importKeyAlias, verifyOptions); await publicImportKeyFunc(importKeyAlias, verifyOptions);
/* 验证签名 */ /* 验证签名 */
var verifyHandle; let verifyHandle;
await publicInitFunc(importKeyAlias, verifyOptions); await publicInitFunc(importKeyAlias, verifyOptions);
verifyHandle = handle; verifyHandle = handle;
...@@ -1773,8 +1773,8 @@ HksFinish对paramSet中参数的要求: ...@@ -1773,8 +1773,8 @@ HksFinish对paramSet中参数的要求:
import huks from '@ohos.security.huks'; import huks from '@ohos.security.huks';
function StringToUint8Array(str) { function StringToUint8Array(str) {
var arr = []; let arr = [];
for (var i = 0, j = str.length; i < j; ++i) { for (let i = 0, j = str.length; i < j; ++i) {
arr.push(str.charCodeAt(i)); arr.push(str.charCodeAt(i));
} }
return new Uint8Array(arr); return new Uint8Array(arr);
...@@ -1968,17 +1968,17 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) { ...@@ -1968,17 +1968,17 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) {
}); });
} }
var srcKeyAliasFirst = "AgreeX25519KeyFirstAlias"; let srcKeyAliasFirst = "AgreeX25519KeyFirstAlias";
var srcKeyAliasSecond = "AgreeX25519KeySecondAlias"; let srcKeyAliasSecond = "AgreeX25519KeySecondAlias";
var agreeX25519InData = 'AgreeX25519TestIndata'; let agreeX25519InData = 'AgreeX25519TestIndata';
var handle; let handle;
var exportKey; let exportKey;
var exportKeyFrist; let exportKeyFrist;
var exportKeySecond; let exportKeySecond;
async function testAgree() { async function testAgree() {
/* 集成生成密钥参数集 */ /* 集成生成密钥参数集 */
var properties = new Array(); let properties = new Array();
properties[0] = { properties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_X25519, value: huks.HuksKeyAlg.HUKS_ALG_X25519,
...@@ -2003,7 +2003,7 @@ async function testAgree() { ...@@ -2003,7 +2003,7 @@ async function testAgree() {
tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
value: huks.HuksCipherMode.HUKS_MODE_CBC, value: huks.HuksCipherMode.HUKS_MODE_CBC,
} }
var HuksOptions = { let HuksOptions = {
properties: properties, properties: properties,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
...@@ -2018,7 +2018,7 @@ async function testAgree() { ...@@ -2018,7 +2018,7 @@ async function testAgree() {
exportKeySecond = exportKey; exportKeySecond = exportKey;
/* 集成第一个协商参数集 */ /* 集成第一个协商参数集 */
var finishProperties = new Array(); let finishProperties = new Array();
finishProperties[0] = { finishProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_KEY_STORAGE_FLAG, tag: huks.HuksTag.HUKS_TAG_KEY_STORAGE_FLAG,
value: huks.HuksKeyStorageType.HUKS_STORAGE_TEMP, value: huks.HuksKeyStorageType.HUKS_STORAGE_TEMP,
...@@ -2057,7 +2057,7 @@ async function testAgree() { ...@@ -2057,7 +2057,7 @@ async function testAgree() {
tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
value: huks.HuksCipherMode.HUKS_MODE_ECB, value: huks.HuksCipherMode.HUKS_MODE_ECB,
} }
var finishOptionsFrist = { let finishOptionsFrist = {
properties: finishProperties, properties: finishProperties,
inData: StringToUint8Array(agreeX25519InData) inData: StringToUint8Array(agreeX25519InData)
} }
...@@ -2069,7 +2069,7 @@ async function testAgree() { ...@@ -2069,7 +2069,7 @@ async function testAgree() {
await publicFinishFunc(handle, finishOptionsFrist); await publicFinishFunc(handle, finishOptionsFrist);
/* 集成第二个协商参数集 */ /* 集成第二个协商参数集 */
var finishOptionsSecond = { let finishOptionsSecond = {
properties: finishProperties, properties: finishProperties,
inData: StringToUint8Array(agreeX25519InData) inData: StringToUint8Array(agreeX25519InData)
} }
...@@ -2171,8 +2171,8 @@ HksFinish对paramSet中参数的要求: ...@@ -2171,8 +2171,8 @@ HksFinish对paramSet中参数的要求:
import huks from '@ohos.security.huks'; import huks from '@ohos.security.huks';
function StringToUint8Array(str) { function StringToUint8Array(str) {
var arr = []; let arr = [];
for (var i = 0, j = str.length; i < j; ++i) { for (let i = 0, j = str.length; i < j; ++i) {
arr.push(str.charCodeAt(i)); arr.push(str.charCodeAt(i));
} }
return new Uint8Array(arr); return new Uint8Array(arr);
...@@ -2318,14 +2318,14 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) { ...@@ -2318,14 +2318,14 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) {
}); });
} }
var deriveHkdfInData = "deriveHkdfTestIndata"; let deriveHkdfInData = "deriveHkdfTestIndata";
var srcKeyAlias = "deriveHkdfKeyAlias"; let srcKeyAlias = "deriveHkdfKeyAlias";
var handle; let handle;
var HuksKeyDeriveKeySize = 32; let HuksKeyDeriveKeySize = 32;
async function testDerive() { async function testDerive() {
/* 集成生成密钥参数集 */ /* 集成生成密钥参数集 */
var properties = new Array(); let properties = new Array();
properties[0] = { properties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_AES, value: huks.HuksKeyAlg.HUKS_ALG_AES,
...@@ -2342,7 +2342,7 @@ async function testDerive() { ...@@ -2342,7 +2342,7 @@ async function testDerive() {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128, value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128,
} }
var huksOptions = { let huksOptions = {
properties: properties, properties: properties,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
...@@ -2360,7 +2360,7 @@ async function testDerive() { ...@@ -2360,7 +2360,7 @@ async function testDerive() {
value: HuksKeyDeriveKeySize, value: HuksKeyDeriveKeySize,
}); });
var finishProperties = new Array(); let finishProperties = new Array();
finishProperties[0] = { finishProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_KEY_STORAGE_FLAG, tag: huks.HuksTag.HUKS_TAG_KEY_STORAGE_FLAG,
value: huks.HuksKeyStorageType.HUKS_STORAGE_PERSISTENT, value: huks.HuksKeyStorageType.HUKS_STORAGE_PERSISTENT,
...@@ -2399,7 +2399,7 @@ async function testDerive() { ...@@ -2399,7 +2399,7 @@ async function testDerive() {
tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
value: huks.HuksCipherMode.HUKS_MODE_ECB, value: huks.HuksCipherMode.HUKS_MODE_ECB,
} }
var finishOptions = { let finishOptions = {
properties: finishProperties, properties: finishProperties,
inData: new Uint8Array(new Array()) inData: new Uint8Array(new Array())
} }
...@@ -2488,8 +2488,8 @@ HksInit对paramSet中参数的要求,其他三段式接口对paramSet无要求 ...@@ -2488,8 +2488,8 @@ HksInit对paramSet中参数的要求,其他三段式接口对paramSet无要求
import huks from '@ohos.security.huks'; import huks from '@ohos.security.huks';
function StringToUint8Array(str) { function StringToUint8Array(str) {
var arr = []; let arr = [];
for (var i = 0, j = str.length; i < j; ++i) { for (let i = 0, j = str.length; i < j; ++i) {
arr.push(str.charCodeAt(i)); arr.push(str.charCodeAt(i));
} }
return new Uint8Array(arr); return new Uint8Array(arr);
...@@ -2651,13 +2651,13 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) { ...@@ -2651,13 +2651,13 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) {
}); });
} }
var srcKeyAlias = "sm3KeyAlias"; let srcKeyAlias = "sm3KeyAlias";
var hmacInData = 'sm3TestIndata'; let hmacInData = 'sm3TestIndata';
var handle; let handle;
async function testMac() { async function testMac() {
/* 集成生成密钥参数集 */ /* 集成生成密钥参数集 */
var properties = new Array(); let properties = new Array();
properties[0] = { properties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_SM3, value: huks.HuksKeyAlg.HUKS_ALG_SM3,
...@@ -2674,7 +2674,7 @@ async function testMac() { ...@@ -2674,7 +2674,7 @@ async function testMac() {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256,
} }
var huksOptions = { let huksOptions = {
properties:properties, properties:properties,
inData:new Uint8Array(new Array()) inData:new Uint8Array(new Array())
} }
...@@ -2758,8 +2758,8 @@ RSA512, RSA768, RSA1024, RSA2048, RSA3072, RSA4096, ECC224, ECC256, ECC384, ECC5 ...@@ -2758,8 +2758,8 @@ RSA512, RSA768, RSA1024, RSA2048, RSA3072, RSA4096, ECC224, ECC256, ECC384, ECC5
import huks from '@ohos.security.huks'; import huks from '@ohos.security.huks';
function StringToUint8Array(str) { function StringToUint8Array(str) {
var arr = []; let arr = [];
for (var i = 0, j = str.length; i < j; ++i) { for (let i = 0, j = str.length; i < j; ++i) {
arr.push(str.charCodeAt(i)); arr.push(str.charCodeAt(i));
} }
return new Uint8Array(arr); return new Uint8Array(arr);
...@@ -2858,20 +2858,20 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) { ...@@ -2858,20 +2858,20 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) {
}); });
} }
var securityLevel = StringToUint8Array('sec_level'); let securityLevel = StringToUint8Array('sec_level');
var challenge = StringToUint8Array('challenge_data'); let challenge = StringToUint8Array('challenge_data');
var versionInfo = StringToUint8Array('version_info'); let versionInfo = StringToUint8Array('version_info');
var udid = StringToUint8Array('udid'); let udid = StringToUint8Array('udid');
var serial = StringToUint8Array('serial'); let serial = StringToUint8Array('serial');
var deviceId = StringToUint8Array('device_id'); let deviceId = StringToUint8Array('device_id');
var idAliasString = "id attest"; let idAliasString = "id attest";
async function testAttestId() { async function testAttestId() {
var aliasString = idAliasString; let aliasString = idAliasString;
var aliasUint8 = StringToUint8Array(aliasString); let aliasUint8 = StringToUint8Array(aliasString);
/* 集成生成密钥参数集 & 生成密钥 */ /* 集成生成密钥参数集 & 生成密钥 */
var properties = new Array(); let properties = new Array();
properties[0] = { properties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_RSA value: huks.HuksKeyAlg.HUKS_ALG_RSA
...@@ -2904,13 +2904,13 @@ async function testAttestId() { ...@@ -2904,13 +2904,13 @@ async function testAttestId() {
tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
value: huks.HuksCipherMode.HUKS_MODE_ECB value: huks.HuksCipherMode.HUKS_MODE_ECB
}; };
var options = { let options = {
properties: properties properties: properties
}; };
await publicGenKeyFunc(aliasString, options); await publicGenKeyFunc(aliasString, options);
/* 集成证书参数集 */ /* 集成证书参数集 */
var attestProperties = new Array(); let attestProperties = new Array();
attestProperties[0] = { attestProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO, tag: huks.HuksTag.HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO,
value: securityLevel value: securityLevel
...@@ -2939,7 +2939,7 @@ async function testAttestId() { ...@@ -2939,7 +2939,7 @@ async function testAttestId() {
tag: huks.HuksTag.HUKS_TAG_ATTESTATION_ID_DEVICE, tag: huks.HuksTag.HUKS_TAG_ATTESTATION_ID_DEVICE,
value: deviceId value: deviceId
}; };
var huksOptions = { let huksOptions = {
properties: attestProperties properties: attestProperties
}; };
...@@ -3007,8 +3007,8 @@ RSA512, RSA768, RSA1024, RSA2048, RSA3072, RSA4096, ECC224, ECC256, ECC384, ECC5 ...@@ -3007,8 +3007,8 @@ RSA512, RSA768, RSA1024, RSA2048, RSA3072, RSA4096, ECC224, ECC256, ECC384, ECC5
import huks from '@ohos.security.huks'; import huks from '@ohos.security.huks';
function StringToUint8Array(str) { function StringToUint8Array(str) {
var arr = []; let arr = [];
for (var i = 0, j = str.length; i < j; ++i) { for (let i = 0, j = str.length; i < j; ++i) {
arr.push(str.charCodeAt(i)); arr.push(str.charCodeAt(i));
} }
return new Uint8Array(arr); return new Uint8Array(arr);
...@@ -3107,16 +3107,16 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) { ...@@ -3107,16 +3107,16 @@ function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions) {
}); });
} }
var securityLevel = StringToUint8Array('sec_level'); let securityLevel = StringToUint8Array('sec_level');
var challenge = StringToUint8Array('challenge_data'); let challenge = StringToUint8Array('challenge_data');
var versionInfo = StringToUint8Array('version_info'); let versionInfo = StringToUint8Array('version_info');
var keyAliasString = "key attest"; let keyAliasString = "key attest";
async function testAttestKey() { async function testAttestKey() {
var aliasString = keyAliasString; let aliasString = keyAliasString;
var aliasUint8 = StringToUint8Array(aliasString); let aliasUint8 = StringToUint8Array(aliasString);
var properties = new Array(); let properties = new Array();
properties[0] = { properties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM, tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_RSA value: huks.HuksKeyAlg.HUKS_ALG_RSA
...@@ -3149,13 +3149,13 @@ async function testAttestKey() { ...@@ -3149,13 +3149,13 @@ async function testAttestKey() {
tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
value: huks.HuksCipherMode.HUKS_MODE_ECB value: huks.HuksCipherMode.HUKS_MODE_ECB
}; };
var options = { let options = {
properties: properties properties: properties
}; };
await publicGenKeyFunc(aliasString, options); await publicGenKeyFunc(aliasString, options);
/* 集成证书参数集 */ /* 集成证书参数集 */
var attestProperties = new Array(); let attestProperties = new Array();
attestProperties[0] = { attestProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO, tag: huks.HuksTag.HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO,
value: securityLevel value: securityLevel
...@@ -3172,7 +3172,7 @@ async function testAttestKey() { ...@@ -3172,7 +3172,7 @@ async function testAttestKey() {
tag: huks.HuksTag.HUKS_TAG_ATTESTATION_ID_ALIAS, tag: huks.HuksTag.HUKS_TAG_ATTESTATION_ID_ALIAS,
value: aliasUint8 value: aliasUint8
}; };
var huksOptions = { let huksOptions = {
properties: attestProperties properties: attestProperties
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册