Example #1
0
        /// <summary>
        /// Encrypts the packet then send it to the client.
        /// </summary>
        /// <param name="input">The byte array to be sent.</param>
        public void SendPacket(byte[] input)
        {
            var cryptData = input;
            var sendData  = new byte[cryptData.Length + 4];
            var header    = Type == SessionType.SERVER_TO_CLIENT
                ? SIV.GetHeaderToClient(cryptData.Length)
                : SIV.GetHeaderToServer(cryptData.Length);

            MapleCustomEncryption.Encrypt(cryptData);
            SIV.Crypt(cryptData);

            Buffer.BlockCopy(header, 0, sendData, 0, 4);
            Buffer.BlockCopy(cryptData, 0, sendData, 4, cryptData.Length);
            SendRawPacket(sendData);
        }
Example #2
0
        /// <summary>
        /// Encrypts the packet then send it to the client.
        /// </summary>
        /// <param name="packet">The PacketWrtier object to be sent.</param>

        /// <summary>
        /// Encrypts the packet then send it to the client.
        /// </summary>
        /// <param name="input">The byte array to be sent.</param>
        public void SendPacket(byte[] input)
        {
            if (!Connected || !_socket.Connected)
            {
                return;
            }
            byte[] cryptData = input;
            byte[] sendData  = new byte[cryptData.Length + 4];
            byte[] header    = _type == SessionType.SERVER_TO_CLIENT ? _SIV.getHeaderToClient(cryptData.Length) : _SIV.getHeaderToServer(cryptData.Length);

            SIV.Encrypt(cryptData);

            System.Buffer.BlockCopy(header, 0, sendData, 0, 4);
            System.Buffer.BlockCopy(cryptData, 0, sendData, 4, cryptData.Length);
            SendRawPacket(sendData);
        }
Example #3
0
        /// <summary>
        /// Encrypts the packet then send it to the client.
        /// </summary>
        /// <param name="input">The byte array to be sent.</param>
        public void SendPacket(byte[] input)
        {
            if (!Connected || !Socket.Connected)
            {
                return;
            }
            var cryptData = input;
            var sendData  = new byte[cryptData.Length + 4];
            var header    = Type == SessionType.SERVER_TO_CLIENT ? SIV.getHeaderToClient(cryptData.Length) : SIV.getHeaderToServer(cryptData.Length);

            // SIV.Encrypt(cryptData);
            SIV.Transform(cryptData);

            System.Buffer.BlockCopy(header, 0, sendData, 0, 4);
            System.Buffer.BlockCopy(cryptData, 0, sendData, 4, cryptData.Length);

            SendRawPacket(sendData);
        }