I have a small console application that uses a client certificate to make an HttpWebRequest:
X509Certificate Cert = X509Certificate.CreateFromCertFile("JohnDoe.cer");
HttpWebRequest Request = (HttpWebRequest)
WebRequest.Create("https://10.135.12.166:4434");
Request.ClientCertificates.Add(Cert);
Request.UserAgent = "Client Cert Sample";
Request.Method = "GET";
HttpWebResponse Response = (HttpWebResponse) Request.GetResponse();
I will have access to the corresponding .pfx file when I execute this code on my machine, and I believe using something mentioned in this thread I'll be able to install the pfx file on my machine, but I don't want to do this.
Is there any way by which I'll be able to make this request with the pfx certificate somehow attached in the request? I mean, by just replacing JohnDoe.cer with JohnDoe.pfx in the above code, or something of the sort?
Thanks.
EDIT: The entire point of this question is that I want a way to work with the cert without having to instal it on my computer. I can use it in the manner esskar and xaver suggested, but I don't want to install the cert on my machine. If this isn't possible to do, any chance someone can provide an explanation about why we can't do this?