我问这个问题是因为当我使用 Azure REST API 时,它需要一个客户端证书。在 C# 中,我可以编写如下代码:
**X509Store certificateStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
certificateStore.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certs = certificateStore.Certificates.Find(X509FindType.FindByThumbprint,
certThumbprint, false);**
if (certs.Count == 0)
{
Console.WriteLine("Couldn't find the certificate with thumbprint:" + certThumbprint);
return;
}
certificateStore.Close();
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(
new Uri("https://management.core.windows.net/" + subscriptionId + "/services/hostedservices"));
request.Method = "POST";
**request.ClientCertificates.Add(certs[0]);**
但是我应该如何在 JS 中提出示例请求?