title: HTTPRequest.SetClientCertificate
body: <p>Heads up - I'm new to crypto topic.
  Due to technical constraints I'm bound to Excel and VBA.</p>
  <p>I need to make a HTTP call over TLS1.2.
  I just can't find the correct form to pass my certificate as a string to the httpSender.SetClientCertificatestring method.</p>
  <p>Any help appreciated.</p>
  <p>p.s - the certificate is stored in a certificate store, not in registry.</p>
  <p>This is my code:</p>
  <pre><code>Public Sub restApiCallV2()
  
  ' taken from: https://markohoven.com/2020/03/06/msxml2-serverxmlhttp-and-tls1-2/
  
  Dim httpSender As Object
  Dim strUrl As String
  Dim blnAsync As Boolean
  Dim strResponse As String
  Dim jsonResponse As Object
  
  strUrl = &quot;https://jsonplaceholder.typicode.com/todos/2&quot;
  blnAsync = True
  
  On Error GoTo eh
  Set httpSender = New WinHttp.WinHttpRequest
  
  'force TLS 1.2
  httpSender.Option(WinHttpRequestOption_SecureProtocols) = SecureProtocol_TLS1_2
  httpSender.Option(WinHttpRequestOption_EnableRedirects) = True
  
  
  call httpSender.SetClientCertificate(&quot;my certificate string here&quot;)
  httpSender.Open &quot;GET&quot;, strUrl, False
  httpSender.setRequestHeader &quot;User-Agent&quot;, &quot;My App V1.0&quot;
  httpSender.setRequestHeader &quot;Content-type&quot;, &quot;application/json&quot;
  
  Debug.Print (&quot;Calling...&quot;)
  
  httpSender.send (&quot;&quot;) ' if get call, uses the URL in the open command
  Failure = (httpSender.Status &lt;&gt; 200)
  If Not Failure Then
      strResponse = httpSender.responseText
  Else
      Call Err.Raise(5000, &quot;start_here.restApiCallV2&quot;, &quot;Failure: received status : &quot; &amp; XMLServer.Status)
  End If
  
  
  Debug.Print (strResponse)
  
  Debug.Print (&quot;Completed!&quot;)
  Exit Sub
  eh:
      Debug.Print (&quot;Error!&quot;)
      Debug.Print (&quot;Number: &quot; &amp; Err.Number &amp; &quot;, Source: &quot; &amp; Err.Source &amp; &quot;, Description: &quot; &amp; Err.Description)
  
  End Sub
  </code></pre>