Exemplo n.º 1
0
        private string SendRequest(SIMCommon.Requests.Base request)
        {
            string serialized = JsonConvert.SerializeObject(request);
            string response   = TcpClient.Send(this.Address.ToString(), serialized);

            if (response == SIMCommon.Constants.SIMServerInvalidRequestResponse)
            {
                throw new InvalidResponseException();
            }

            return(response);
        }
Exemplo n.º 2
0
        private string SendEncryptedRequest(SIMCommon.Requests.Base request)
        {
            string encryptedRequestData = this.EncryptRequest(JsonConvert.SerializeObject(request));
            var    encryptedRequest     = JsonConvert.SerializeObject(new SIMCommon.Requests.Encrypted(this.PGPClient.EncryptedSessionKey, encryptedRequestData));
            string response             = TcpClient.Send(this.Address.ToString(), encryptedRequest);
            var    encryptedResponse    = JsonConvert.DeserializeObject <SIMCommon.Responses.Encrypted>(response);
            string decrypted            = this.PGPClient.Decrypt(encryptedResponse.EncryptedResponse, encryptedResponse.EncryptedSessionKey);

            if (decrypted == SIMCommon.Constants.SIMServerInvalidRequestResponse)
            {
                throw new InvalidResponseException();
            }

            return(decrypted);
        }
Exemplo n.º 3
0
 private string RequestHandler(IPAddress address, SIMCommon.Requests.Base request)
 {
     return(SIMCommon.Constants.SIMServerInvalidRequestResponse);
 }