fiddler证书过期,执行Reset All Certificates 页面卡死解决方案

批量删除证书

在powershell 里面执行

复制代码
<#
彻底删除 Fiddler 证书(删完立刻查不到)
#>

$IssuerFilter = "DO_NOT_TRUST_FiddlerRoot"
$logPath = ".\CertClean-Ultimate.log"

# 所有证书库(关键:加上 LocalMachine)
$stores = @(
    "Cert:\CurrentUser\My",
    "Cert:\CurrentUser\Root",
    "Cert:\LocalMachine\My",
    "Cert:\LocalMachine\Root"
)

$now = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Add-Content $logPath "`n============================================="
Add-Content $logPath "执行时间: $now"
Add-Content $logPath "颁发者: $IssuerFilter"
Add-Content $logPath "============================================="

function Log($msg) {
    Write-Host $msg
    Add-Content $logPath $msg
}

# 1. 关 Fiddler、浏览器
Log "`n[1/6] 关闭 Fiddler/浏览器..."
Get-Process fiddler,chrome,msedge,firefox -EA SilentlyContinue | Stop-Process -Force

# 2. 停 CryptSvc 清系统证书缓存(非常关键)
Log "`n[2/6] 停止 Cryptographic Services 清缓存..."
net stop cryptsvc 2>&1 | Out-Null

# 3. 删证书(全库、不碰私钥)
foreach ($store in $stores) {
    Log "`n扫描:$store"
    $certs = Get-ChildItem $store -Recurse -EA SilentlyContinue |
        Where-Object { $_.Issuer -match $IssuerFilter }

    if (-not $certs) {
        Log "→ 无匹配证书"
        continue
    }

    Log "→ 找到 $($certs.Count) 张,删除..."
    foreach ($cert in $certs) {
        Log "指纹: $($cert.Thumbprint)"
        try {
            Remove-Item $cert.PSPath -Force -EA Stop
            Log "✅ 已删除"
        } catch {
            Log "❌ 失败: $_"
        }
    }
}

# 4. 清 RSA 私钥残留
Log "`n[4/6] 清理 RSA 私钥目录..."
Remove-Item "$env:APPDATA\Microsoft\Crypto\RSA\*" -Force -Recurse -EA SilentlyContinue
Remove-Item "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\*" -Force -Recurse -EA SilentlyContinue

# 5. 重启 CryptSvc
Log "`n[5/6] 重启 Cryptographic Services..."
net start cryptsvc 2>&1 | Out-Null

# 6. 验证(全库查)
Log "`n[6/6] 验证残留..."
$allGood = $true
foreach ($store in $stores) {
    $check = Get-ChildItem $store -Recurse -EA SilentlyContinue |
        Where-Object { $_.Issuer -match $IssuerFilter }
    if ($check) {
        Log "❌ $store 残留 $($check.Count) 张"
        $allGood = $false
    }
}

if ($allGood) {
    Log "`n✅ 全部删除干净,查询不到!"
}

Log "`n============================================="
Log "完成!建议重启电脑。"
相关推荐
ynchyong1 天前
Python 字符组合生成器:product 与 permutations 的实战对比
python·工具·字符串生产
小贺儿开发5 天前
Unity 局域网遥控幻灯片展示工具 1.0
unity·网络通信·工具·ppt·控制·网页·互动
fpcc8 天前
工具使用—git diff命令分析说明
git·工具
小庞在加油9 天前
WinDbg实战:QT/跨平台项目死锁与无响应问题排查指南
开发语言·qt·windbg·工具
越千年11 天前
A 股行情插件开源了,还带老板模式
开源·工具
深念Y11 天前
订阅管理及节点过滤实践(技术笔记)
linux·网络·arm·优化·日志·工具·soc
fpcc11 天前
工具使用—git add命令分析说明
git·工具
a11229982114 天前
GEO工具选型指南:对照2026新标准看落地能力
ai·工具
JackieDYH15 天前
Git 与 GitHub 新电脑配置指南(从零开始)
git·github·工具·使用教程
小徐不徐说20 天前
VS 2022 Visual Assist 破解
c++·visualstudio·工具·插件