Esempio n. 1
0
    public static AntiEncryptResult TssSdkEncrypt(int cmd_id, byte[] src, uint src_len, ref byte[] tar, ref uint tar_len)
    {
        AntiEncryptResult result  = AntiEncryptResult.ANTI_NOT_NEED_ENCRYPT;
        GCHandle          handle  = GCHandle.Alloc(src, GCHandleType.Pinned);
        GCHandle          handle2 = GCHandle.Alloc(tar, GCHandleType.Pinned);

        if (handle.IsAllocated && handle2.IsAllocated)
        {
            EncryptPkgInfo info = new EncryptPkgInfo {
                cmd_id_           = cmd_id,
                game_pkg_         = handle.AddrOfPinnedObject(),
                game_pkg_len_     = src_len,
                encrpty_data_     = handle2.AddrOfPinnedObject(),
                encrypt_data_len_ = tar_len
            };
            result  = tss_sdk_encryptpacket(info);
            tar_len = info.encrypt_data_len_;
        }
        if (handle.IsAllocated)
        {
            handle.Free();
        }
        if (handle2.IsAllocated)
        {
            handle2.Free();
        }
        return(result);
    }
Esempio n. 2
0
    public static AntiEncryptResult TssSdkEncrypt(/*[in]*/ int cmd_id, /*[in]*/ byte[] src, /*[in]*/ uint src_len,
                                                  /*[out]*/ ref byte[] tar, /*[out]*/ ref uint tar_len)
    {
        AntiEncryptResult ret        = AntiEncryptResult.ANTI_NOT_NEED_ENCRYPT;
        GCHandle          src_handle = GCHandle.Alloc(src, GCHandleType.Pinned);
        GCHandle          tar_handle = GCHandle.Alloc(tar, GCHandleType.Pinned);

        if (src_handle.IsAllocated && tar_handle.IsAllocated)
        {
            EncryptPkgInfo info = new EncryptPkgInfo();
            info.cmd_id_           = cmd_id;
            info.game_pkg_         = src_handle.AddrOfPinnedObject();
            info.game_pkg_len_     = src_len;
            info.encrpty_data_     = tar_handle.AddrOfPinnedObject();
            info.encrypt_data_len_ = tar_len;
            ret     = tss_sdk_encryptpacket(info);
            tar_len = info.encrypt_data_len_;
        }
        if (src_handle.IsAllocated)
        {
            src_handle.Free();
        }
        if (tar_handle.IsAllocated)
        {
            tar_handle.Free();
        }
        return(ret);
    }
Esempio n. 3
0
File: TssSdk.cs Progetto: fengqk/Art
	public static AntiEncryptResult TssSdkEncrypt(/*[in]*/int cmd_id, /*[in]*/byte[] src, /*[in]*/uint src_len,
		/*[out]*/ref byte[] tar, /*[out]*/ref uint tar_len) 
	{
		AntiEncryptResult ret = AntiEncryptResult.ANTI_NOT_NEED_ENCRYPT;
		GCHandle src_handle = GCHandle.Alloc(src, GCHandleType.Pinned);
		GCHandle tar_handle = GCHandle.Alloc(tar, GCHandleType.Pinned);
		if (src_handle.IsAllocated && tar_handle.IsAllocated) 
		{
			EncryptPkgInfo info = new EncryptPkgInfo();
			info.cmd_id_ = cmd_id;
			info.game_pkg_ = src_handle.AddrOfPinnedObject();
			info.game_pkg_len_ = src_len;
			info.encrpty_data_ = tar_handle.AddrOfPinnedObject();
			info.encrypt_data_len_ = tar_len;
			ret = tss_sdk_encryptpacket(info);
			tar_len = info.encrypt_data_len_;
		}
		if (src_handle.IsAllocated) src_handle.Free();
		if (tar_handle.IsAllocated) tar_handle.Free();
		return ret;
	}
Esempio n. 4
0
File: TssSdk.cs Progetto: fengqk/Art
	private static extern AntiEncryptResult tss_sdk_encryptpacket(EncryptPkgInfo info);
Esempio n. 5
0
 private static extern AntiEncryptResult tss_sdk_encryptpacket(EncryptPkgInfo info);
Esempio n. 6
0
 private static AntiEncryptResult tss_sdk_encryptpacket(EncryptPkgInfo info)
 {
     return(AntiEncryptResult.ANTI_ENCRYPT_OK);
 }