public async Task <UniversalServerPacket> WaitForResultAsync() { UniversalServerPacket serverPacket = null; await Task.Run(() => { byte[] data = new byte[Client.Client.ReceiveBufferSize]; int receivedDataLength = Client.Client.Receive(data); serverPacket = JsonConvert.DeserializeObject <UniversalServerPacket> (Encoding.ASCII.GetString(data, 0, receivedDataLength)); if (serverPacket.Encrypted) { serverPacket.Message = Encryption.Decrypt(serverPacket.Message, Encryption.GetClientPrivateKey()); } }); return(serverPacket); }
public int DecryptInt(ByteArray itemToDecrypt) { return(BitConverter.ToInt32(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0)); }
public string DecryptString(ByteArray strTodecrypt) { return(BitConverter.ToString(ClientRSA.Decrypt(strTodecrypt.Bytes, false))); }
public double DecryptDouble(ByteArray itemToDecrypt) { return(BitConverter.ToDouble(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0)); }
public float DecryptFloat(ByteArray itemToDecrypt) { return(BitConverter.ToSingle(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0)); }
public bool DecryptBool(ByteArray itemToDecrypt) { return(BitConverter.ToBoolean(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0)); }
public long DecryptLong(ByteArray itemToDecrypt) { return(BitConverter.ToInt64(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0)); }