Skip to content

Commit 3051d7b

Browse files
committed
ci: check cert
1 parent 609c0f2 commit 3051d7b

File tree

1 file changed

+37
-92
lines changed

1 file changed

+37
-92
lines changed

.github/workflows/build-test.yml

Lines changed: 37 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -228,110 +228,55 @@ jobs:
228228
shell: pwsh
229229
run: |
230230
$ErrorActionPreference = "Continue"
231-
Start-Sleep -Seconds 60
232-
231+
Start-Sleep -Seconds 30
233232
$tp = "${{ secrets.CERTUM_CERTIFICATE_SHA1 }}".Replace(" ", "").ToUpper()
234233
Write-Host "=== WHOAMI / SESSION ==="
235234
whoami
236235
qwinsta
237236
Write-Host "Thumbprint to find: $tp"
238237
239-
Write-Host "`n=== SimplySign processes (if any) ==="
240-
Get-Process | Where-Object { $_.ProcessName -match "simply|certum|sign|scard|smart" } | Select-Object ProcessName,Id,StartTime | Format-Table -Auto
241-
242-
Write-Host "`n=== Services (smart card / cryptsvc) ==="
243-
Get-Service CryptSvc, SCardSvr -ErrorAction SilentlyContinue | Format-Table -Auto
244-
# 可选:看看有没有 SimplySign/Certum 相关服务
245-
Get-Service | Where-Object { $_.Name -match "simply|certum" -or $_.DisplayName -match "Simply|Certum" } | Format-Table -Auto
246-
247-
Write-Host "`n=== CSP/KSP list (certutil -csplist) ==="
248-
certutil -csplist | Out-Host
249-
250-
Write-Host "`n=== Try dump CSP details (filter by keywords) ==="
251-
$cspList = (certutil -csplist) 2>$null
252-
$candidates = @()
253-
foreach ($line in $cspList) {
254-
if ($line -match "Certum|Simply|Asseco|Unizeto|KSP|CSP") { $candidates += $line.Trim() }
238+
Write-Host "`n=== SimplySign processes ==="
239+
Get-Process -ErrorAction SilentlyContinue |
240+
Where-Object { $_.ProcessName -match "SimplySign|Certum" } |
241+
Select-Object ProcessName,Id,StartTime | Format-Table -Auto
242+
243+
Write-Host "`n=== Services (safe) ==="
244+
Get-Service -Name CryptSvc,SCardSvr -ErrorAction SilentlyContinue | Format-Table -Auto
245+
cmd /c "sc query type= service state= all | findstr /I simply certum asseco unizeto" | Out-Host
246+
$logDir = "$env:RUNNER_TEMP\certum-diagnose"
247+
New-Item -ItemType Directory -Force -Path $logDir | Out-Null
248+
Write-Host "`n=== certutil -csplist (timeout 45s, write to file) ==="
249+
$p = Start-Process -FilePath "cmd.exe" -ArgumentList "/c certutil -csplist > `"$logDir\csplist.txt`" 2>&1" -PassThru
250+
if (-not $p.WaitForExit(45000)) {
251+
Write-Host "certutil -csplist timed out, killing..."
252+
$p.Kill()
255253
}
256-
if ($candidates.Count -gt 0) {
257-
$candidates | ForEach-Object {
258-
Write-Host "`n--- certutil -csp `"$_`" ---"
259-
certutil -csp "$_" | Out-Host
260-
}
254+
if (Test-Path "$logDir\csplist.txt") {
255+
Write-Host "=== csplist keyword lines ==="
256+
Get-Content "$logDir\csplist.txt" | Select-String -Pattern "Certum|Simply|Asseco|Unizeto|KSP|CSP" |
257+
ForEach-Object { $_.Line } | Out-Host
261258
} else {
262-
Write-Host "No obvious Certum/SimplySign provider strings found in csplist output."
263-
}
264-
265-
Write-Host "`n=== Key containers (certutil -key) ==="
266-
certutil -key | Out-Host
267-
268-
function List-Stores($root) {
269-
Write-Host "`n=== Enumerating stores under $root ==="
270-
$stores = Get-ChildItem "Cert:\$root" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty PSChildName
271-
foreach ($s in $stores) {
272-
Write-Host "`n-- Store: Cert:\$root\$s --"
273-
try {
274-
$items = Get-ChildItem "Cert:\$root\$s" -ErrorAction Stop
275-
if ($items.Count -eq 0) {
276-
Write-Host "(empty)"
277-
} else {
278-
$items | Select-Object Subject, Thumbprint, NotAfter, HasPrivateKey | Format-Table -Auto
279-
}
280-
} catch {
281-
Write-Host "Failed to read Cert:\$root\$s : $($_.Exception.Message)"
282-
}
283-
}
284-
}
285-
286-
function Find-Thumbprint($root, $tp) {
287-
Write-Host "`n=== Searching thumbprint in $root (recursive) ==="
288-
try {
289-
$hit = Get-ChildItem "Cert:\$root" -Recurse -ErrorAction Stop | Where-Object { $_.Thumbprint -eq $tp }
290-
if ($hit) {
291-
$hit | ForEach-Object {
292-
Write-Host "FOUND: $($_.PSParentPath)"
293-
$_ | Format-List Subject, Thumbprint, NotAfter, HasPrivateKey, EnhancedKeyUsageList
294-
}
295-
return $true
296-
} else {
297-
Write-Host "NOT FOUND anywhere under Cert:\$root"
298-
return $false
299-
}
300-
} catch {
301-
Write-Host "Recursive search failed under Cert:\$root : $($_.Exception.Message)"
302-
return $false
303-
}
259+
Write-Host "csplist.txt not found"
304260
}
305-
306-
# 1) 全列出所有 store(CurrentUser & LocalMachine)
307-
List-Stores "CurrentUser"
308-
List-Stores "LocalMachine"
309-
310-
# 2) 全局按 thumbprint 搜索
311-
$foundCU = $false
312-
$foundLM = $false
313-
if ($tp) {
314-
$foundCU = Find-Thumbprint "CurrentUser" $tp
315-
$foundLM = Find-Thumbprint "LocalMachine" $tp
316-
} else {
317-
Write-Host "No thumbprint provided."
318-
}
319-
320-
# 3) 同时输出 certutil 的 store 列表(有时比 PSProvider 更直观)
321-
Write-Host "`n=== certutil -user -store My ==="
261+
Write-Host "`n=== certutil -key (write to file) ==="
262+
cmd /c "certutil -key > `"$logDir\key.txt`" 2>&1"
263+
Write-Host "=== key keyword lines ==="
264+
Get-Content "$logDir\key.txt" -ErrorAction SilentlyContinue |
265+
Select-String -Pattern "Certum|Simply|Asseco|Unizeto|\{[0-9A-F-]+\}" |
266+
ForEach-Object { $_.Line } | Out-Host
267+
Write-Host "`n=== LIST CurrentUser\\My ==="
322268
certutil -user -store My | Out-Host
323-
Write-Host "`n=== certutil -store My ==="
269+
Write-Host "`n=== LIST LocalMachine\\My ==="
324270
certutil -store My | Out-Host
271+
Write-Host "`n=== Search thumbprint in ALL stores (CurrentUser) ==="
272+
Get-ChildItem Cert:\CurrentUser -Recurse -ErrorAction SilentlyContinue |
273+
Where-Object { $_.Thumbprint -eq $tp } |
274+
ForEach-Object { "FOUND in: $($_.PSParentPath) Subject=$($_.Subject)" } | Out-Host
275+
Write-Host "`n=== Search thumbprint in ALL stores (LocalMachine) ==="
276+
Get-ChildItem Cert:\LocalMachine -Recurse -ErrorAction SilentlyContinue |
277+
Where-Object { $_.Thumbprint -eq $tp } |
278+
ForEach-Object { "FOUND in: $($_.PSParentPath) Subject=$($_.Subject)" } | Out-Host
325279
326-
Write-Host "`n=== Summary ==="
327-
if ($tp -and ($foundCU -or $foundLM)) {
328-
Write-Host "✅ Cert object FOUND in Windows cert stores."
329-
Write-Host "Next: ensure Tauri/signtool uses the correct store (CurrentUser vs LocalMachine)."
330-
} else {
331-
Write-Host "❌ Cert object NOT found in any Windows cert store."
332-
Write-Host "Next: rely on CSP/KSP signing (signCommand) OR import public .cer into CurrentUser\\My."
333-
Write-Host "Also verify SimplySign login is in same user session (runneradmin) and not a service/SYSTEM context."
334-
}
335280
336281
- name: Build the app
337282
if: matrix.platform == 'windows' || matrix.platform == 'linux'

0 commit comments

Comments
 (0)