簡體   English   中英

IIS Express 使用“虛構的”SSL 證書

[英]IIS Express using "imaginary" SSL certificate

我已經為此奮斗了幾個星期。 我已經用盡了我的 Google-fu,需要你的幫助。

我想刪除 IIS Express 默認使用的證書(即將過期)並使用我“修復”IIS Express 時創建的證書。

IIS Express 使用的 SSL 證書我在 PC 上的任何地方都找不到。 目前它沒有使用它在修復過程中創建的證書。 它使用了一些我在計算機上找不到的隨機證書。

我已經通過 mmc 管理單元 100 次,運行 dos 和 powershell 命令,搜索我的注冊表,搜索文件系統,我什至瀏覽了 100k 行進程監視器,試圖找到它從哪里提取證書。 我在任何地方都找不到它正在使用的證書。

Windows 10。這是一個帶有相關本地主機條目的證書轉儲:

Location   : CurrentUser

Name : Root

Subject      : CN=localhost
Issuer       : CN=localhost
Thumbprint   : 7019C23346CD99CDE8ED35F2A712410F3E5A03DB
FriendlyName : ASP.NET Core HTTPS development certificate
NotBefore    : 2/28/2020 8:26:43 AM
NotAfter     : 2/27/2021 8:26:43 AM
Extensions   : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid, System.Security.Cryptography.Oid, 
               System.Security.Cryptography.Oid...}

Subject      : CN=localhost
Issuer       : CN=localhost
Thumbprint   : 4671C5C7DC49E26F318C30911B4494D2511E665E
FriendlyName : IIS Express Development Certificate
NotBefore    : 2/28/2020 8:26:16 AM
NotAfter     : 2/27/2025 6:00:00 PM
Extensions   : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid, System.Security.Cryptography.Oid}

Name: My

Subject      : CN=localhost
Issuer       : CN=localhost
Thumbprint   : 7019C23346CD99CDE8ED35F2A712410F3E5A03DB
FriendlyName : ASP.NET Core HTTPS development certificate
NotBefore    : 2/28/2020 8:26:43 AM
NotAfter     : 2/27/2021 8:26:43 AM
Extensions   : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid, System.Security.Cryptography.Oid, 
               System.Security.Cryptography.Oid...}

Subject      : CN=localhost
Issuer       : CN=localhost
Thumbprint   : 4671C5C7DC49E26F318C30911B4494D2511E665E
FriendlyName : IIS Express Development Certificate
NotBefore    : 2/28/2020 8:26:16 AM
NotAfter     : 2/27/2025 6:00:00 PM
Extensions   : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid, System.Security.Cryptography.Oid}

這是提供給 Chrome 的證書:

Serial number: 00e7573e7ee6f8a315
Signature algorithm: sha256RSA
Issuer: localhost
Subject: localhost
1.3.6.1.4.1.311.84.1.1: ASP.NET Core HTTPS development certificate
Thumbprint: f3b46e7bd1d6a66d150948342ffe00ebb42f33ac

誰有想法? 如果您需要任何其他信息,請告訴我。

Kestrel 嘗試為項目找到“默認”證書。 該證書未存儲在計算機的密鑰庫中。 它作為 .pfx 文件存儲在文件系統上。 路徑是 %appData%\\ASP.NET\\https。

我通過閱讀 Kestrel 源代碼 KestrelConfigurationLoader.TryGetCertificatePath() 發現了這一點:

    var hostingEnvironment = Options.ApplicationServices.GetRequiredService<IHostEnvironment>();
    var appName = hostingEnvironment.ApplicationName;

    // This will go away when we implement
    // https://github.com/aspnet/Hosting/issues/1294
    var appData = Environment.GetEnvironmentVariable("APPDATA");
    var home = Environment.GetEnvironmentVariable("HOME");
    var basePath = appData != null ? Path.Combine(appData, "ASP.NET", "https") : null;
    basePath = basePath ?? (home != null ? Path.Combine(home, ".aspnet", "https") : null);
    path = basePath != null ? Path.Combine(basePath, $"{appName}.pfx") : null;
    return path != null;

我刪除了文件夾中的密鑰,它解決了我的問題。 快樂的時光!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM