Skip to content

Instantly share code, notes, and snippets.

View sachinsu's full-sized avatar

Sachin Sunkle sachinsu

View GitHub Profile
@sachinsu
sachinsu / sslhandshake.cs
Created May 24, 2018 04:21
Mutual SSL Handshake in C# using HTTPWebRequest and TLS1.2
private static void FromFile()
{
// You have to use certificate.p12 or certificate.pfx that contains private key. These extensions represent PKCS#12 standard. There can also be whole certificate chain included in these files
var certificatefilePath = "CertificateFile.pfx";
var certpwd = "password";
var URL = "Host_URL";
X509Certificate cert = new X509Certificate(certificatefilePath,certpwd);
var webrequest = WebRequest.Create(URL) as HttpWebRequest;