美文网首页
cocos creator使用crypto-js解密微信小游戏用

cocos creator使用crypto-js解密微信小游戏用

作者: 正向反馈 | 来源:发表于2020-03-05 18:39 被阅读0次

static decrypt_user_info(session_key: string, encryptedData: string, iv: string): WxDecryptedUserInfo {
       let CryptoJS = (window as any).CryptoJS
        var dencryptedData = CryptoJS.enc.Base64.parse(encryptedData)
        var dkey = CryptoJS.enc.Base64.parse(session_key);
        var div = CryptoJS.enc.Base64.parse(iv);
        let o = CryptoJS.AES.decrypt({ ciphertext: dencryptedData }, dkey, { iv: div })
        let jsonstr = CryptoJS.enc.Utf8.stringify(o)
        logd('用户数据解密 ', o, jsonstr)
        return JSON.parse(jsonstr)
    }

相关文章

网友评论

      本文标题:cocos creator使用crypto-js解密微信小游戏用

      本文链接:https://www.haomeiwen.com/subject/vhlcrhtx.html