var akey = [0x26,0xAF,0xE2,0x1A,0x0C,0x16,0x73,0x54,0x13,0xFD,0x68,0xDD,0x8F,0xA0,0xB7,0xC1,0x57,0xA6,0x90,0xFF,0xCD,0xB3,0x54,0x61,0x10,0x07,0xD5,0x7E,0xDB,0x1E,0x4C,0xE9]; var aiv = [0x15,0x4C,0xD3,0x55,0xFE,0xA1,0xFF,0x01,0x00,0x34,0xAB,0x22,0x08,0x4F,0x13,0x07]; var keyBv = new Uint8Array(akey); var ivBv = new Uint8Array(aiv); keyWA = CryptoJS.enc.u8array.parse(keyBv); ivWA = CryptoJS.enc.u8array.parse(ivBv); function decryptU8arry(array) { var acontent = array; contentWA = CryptoJS.enc.u8array.parse(acontent); var dcBase64String = contentWA.toString(CryptoJS.enc.Base64); var decrypted = CryptoJS.AES.decrypt(dcBase64String, keyWA, { iv: ivWA,mode:CryptoJS.mode.CFB,padding:CryptoJS.pad.NoPadding}); var bv = CryptoJS.enc.u8array.stringify(decrypted); return bv; } function encryptU8arry(array) { var acontent = array; contentWA = CryptoJS.enc.u8array.parse(acontent); var dcBase64String = contentWA.toString(CryptoJS.enc.Base64); var encrypted = CryptoJS.AES.encrypt(contentWA, keyWA, { iv: ivWA,mode:CryptoJS.mode.CFB,padding:CryptoJS.pad.NoPadding}); var bv = CryptoJS.enc.u8array.stringify(encrypted.ciphertext); return bv; }
|