【问题标题】:Read Azure default wildcard certificate from ASP.NET Core从 ASP.NET Core 读取 Azure 默认通配符证书
【发布时间】:2017-09-08 16:45:47
【问题描述】:

我正在 Azure 应用服务中建立一个暂存环境。它位于免费套餐下,您无法上传自定义 SSL 证书。为了测试我的 ASP.NET Core 应用程序设置,特别是如果它可以正确地从商店加载证书,我想尝试一下,而不必满足受信任证书的所有要求(更改层、获取域、获取证书, ...)。

我知道 Let's Encrypt,但这仍然会迫使我切换层以便将证书添加到 Azure 应用服务。另外,我不确定您是否可以为域some-site.azurewebsites.net 创建证书(我在某处读过一些反对使用与azurewebsites.net 相关的任何内容作为自定义证书的内容),所以也许无论如何这也需要一个自定义域。

我想知道是否有办法从应用程序代码访问 MS 为*.azurewebsites.net 拥有的默认通配符证书。因此,例如获取 MS Azure 证书指纹,将其存储在 WEBSITE_LOAD_CERTIFICATES 应用程序设置中,然后像完成 here in chapter 3. Access from app" 一样从存储中加载它。

X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
certStore.Open(OpenFlags.ReadOnly);

X509Certificate2Collection certCollection = certStore.Certificates.Find(
   X509FindType.FindByThumbprint,
   "insert-here-thumbprint-of-azure-default-cert",
   false);

// Get the first cert with the thumbprint
if (certCollection.Count > 0)
{
  X509Certificate2 cert = certCollection[0];
  // Use certificate
  Console.WriteLine(cert.FriendlyName);
}

certStore.Close();

这可行吗?助教。

【问题讨论】:

    标签: azure asp.net-core ssl-certificate


    【解决方案1】:

    显然,another SO thread 有答案。它的要点是:

    您将无法在 WebApp 中以编程方式访问此证书,因为此证书并未真正安装在 Azure WebApp 上。

    不确定这是否应该作为重复关闭。

    【讨论】:

      猜你喜欢
      • 2016-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-15
      • 2020-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多