示例#1
0
    public static TssSdk.AntiDecryptResult TssSdkDecrypt(byte[] src, uint src_len, ref byte[] tar, ref uint tar_len)
    {
        TssSdk.AntiDecryptResult result = TssSdk.AntiDecryptResult.ANTI_DECRYPT_FAIL;
        GCHandle gCHandle  = GCHandle.Alloc(src, GCHandleType.Pinned);
        GCHandle gCHandle2 = GCHandle.Alloc(tar, GCHandleType.Pinned);

        if (gCHandle.IsAllocated && gCHandle2.IsAllocated)
        {
            TssSdk.DecryptPkgInfo decryptPkgInfo = new TssSdk.DecryptPkgInfo();
            decryptPkgInfo.encrypt_data_    = gCHandle.AddrOfPinnedObject();
            decryptPkgInfo.encrypt_data_len = src_len;
            decryptPkgInfo.game_pkg_        = gCHandle2.AddrOfPinnedObject();
            decryptPkgInfo.game_pkg_len_    = tar_len;
            result  = TssSdk.tss_sdk_decryptpacket(decryptPkgInfo);
            tar_len = decryptPkgInfo.game_pkg_len_;
        }
        if (gCHandle.IsAllocated)
        {
            gCHandle.Free();
        }
        if (gCHandle2.IsAllocated)
        {
            gCHandle2.Free();
        }
        return(result);
    }