title: Microsoft.XMLHTTP using SSL client certificate (or an already authenticated session)
body: <p>I am connecting to a server via a proxy that requires a client certificate to authenticate. I can easily launch a browser from my script, utilizing an ssh tunnel already established in a browser. When I attempt to open a connection using <code>Microsoft.XMLHTTP</code>, I receive an error</p>
  
  <blockquote>
    <p>Security certificate required to access this resource is invalid.</p>
  </blockquote>
  
  <p>I am looking for one of two solutions:</p>
  
  <ol>
  <li>utilize a session that is already (manually) established in a browser</li>
  <li>send the client certificate (and PIN) via the script.</li>
  </ol>
  
  <p>The logic that I'm currently using for this function is very simple:</p>
  
  <pre><code>Dim xHttp: Set xHttp = CreateObject("Microsoft.XMLHTTP")
  Dim bStrm: Set bStrm = CreateObject("Adodb.Stream")
  xHttp.Open "GET", "https://localhost:63619/ap_detail.xml?id=3502", False
  xHttp.Send
  
  With bStrm
      .Type = 1 '//binary
      .Open
      .Write xHttp.responseBody
      .SaveToFile "C:\xml\3502.xml", 2 '//overwrite
  End With
  </code></pre>