Hi everyone,

I need to post some data to a https server. I already have used QNetworkAccessManager class for this purpose. But now I need to add a client certificate and establish a trust connection before I can post any data to the https server. I have already done it in C#.net whose code is as follows:- (Following code is in .net, not in Qt)

Qt Code:
  1. X509Certificate cert = X509Certificate.CreateFromCertFile("Path to my .cer file"); //****** name of cer file is "ServerTrial.cer" ******//
  2. Uri authURL = new Uri("https://myServer/post");
  3. HttpWebRequest authRequest = (HttpWebRequest)WebRequest.Create(authURL); //****** Here i add the server url ******//
  4. authRequest.ClientCertificates.Add(cert); //****** Here i add the client certificate ******//
  5. authRequest.Method = "POST"; //****** Here i specify the method which is "POST" ******//
  6.  
  7. byte[] postBytes = "Data to be posted";
  8. authRequest.ContentLength = postBytes.Length;
  9. Stream requestStream = authRequest.GetRequestStream();
  10. // now send it
  11. requestStream.Write(postBytes, 0, postBytes.Length); //****** Here I post the data to the Server ******//
  12. requestStream.Close();
  13.  
  14. // grab the response
  15. HttpWebResponse response = (HttpWebResponse)authRequest.GetResponse();
  16. StreamReader responseStream = new StreamReader(response.GetResponseStream());
  17. string responseStr = responseStream.ReadToEnd();
To copy to clipboard, switch view to plain text mode 

How do i achieve it's equivalent in Qt? Will i need any external library for achieving the above?

-With regards,
sattu