Skip to content

Commit 609c0f2

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

File tree

1 file changed

+105
-20
lines changed

1 file changed

+105
-20
lines changed

.github/workflows/build-test.yml

Lines changed: 105 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -223,30 +223,115 @@ jobs:
223223
224224
echo "Certificate thumbprint configured: $THUMBPRINT"
225225
226-
- name: Diagnose cert store after SimplySign login (Windows)
226+
- name: Diagnose SimplySign / Certum availability (Windows)
227227
if: matrix.platform == 'windows'
228228
shell: pwsh
229229
run: |
230-
Start-Sleep -Seconds 60 # Wait for cert store to update
231-
Write-Host "=== WHOAMI ==="
232-
whoami
230+
$ErrorActionPreference = "Continue"
231+
Start-Sleep -Seconds 60
233232
234-
Write-Host "=== LIST CurrentUser\\My ==="
235-
certutil -user -store My
236-
237-
Write-Host "=== LIST LocalMachine\\My ==="
238-
certutil -store My
239-
240-
Write-Host "=== FILTER BY THUMBPRINT (if provided) ==="
241-
$tp = "${{ secrets.CERTUM_CERTIFICATE_SHA1 }}".Replace(" ", "").ToUpper()
242-
if ($tp) {
243-
$hit = Get-ChildItem Cert:\CurrentUser\My | Where-Object { $_.Thumbprint -eq $tp }
244-
if ($hit) {
245-
$hit | Format-List Subject, Thumbprint, NotAfter, HasPrivateKey
246-
} else {
247-
Write-Host "NOT FOUND in CurrentUser\\My: $tp"
248-
}
249-
}
233+
$tp = "${{ secrets.CERTUM_CERTIFICATE_SHA1 }}".Replace(" ", "").ToUpper()
234+
Write-Host "=== WHOAMI / SESSION ==="
235+
whoami
236+
qwinsta
237+
Write-Host "Thumbprint to find: $tp"
238+
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() }
255+
}
256+
if ($candidates.Count -gt 0) {
257+
$candidates | ForEach-Object {
258+
Write-Host "`n--- certutil -csp `"$_`" ---"
259+
certutil -csp "$_" | Out-Host
260+
}
261+
} 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+
}
304+
}
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 ==="
322+
certutil -user -store My | Out-Host
323+
Write-Host "`n=== certutil -store My ==="
324+
certutil -store My | Out-Host
325+
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+
}
250335
251336
- name: Build the app
252337
if: matrix.platform == 'windows' || matrix.platform == 'linux'

0 commit comments

Comments
 (0)