Skip to content

Commit b8154d5

Browse files
update to CN used with cert store
1 parent 3106c0a commit b8154d5

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/windows-cert-store-test.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,16 @@ jobs:
517517
518518
Write-Host "Client cert in store: $($importedCert.Subject)"
519519
Write-Host "Client cert thumbprint: $($importedCert.Thumbprint)"
520-
Add-Content -Path $env:GITHUB_ENV -Value "CLIENT_CERT_SUBJECT=$($importedCert.Subject)"
520+
# Extract CN from the subject for use as a cert store search string.
521+
# The full X.500 DN contains commas which break command-line argument
522+
# parsing, but CertFindCertificateInStore does substring matching so
523+
# the CN alone is sufficient.
524+
$cn = $importedCert.Subject
525+
if ($cn -match 'CN=([^,]+)') {
526+
$cn = $matches[1].Trim()
527+
}
528+
Write-Host "Client cert CN for store lookup: '$cn'"
529+
Add-Content -Path $env:GITHUB_ENV -Value "CLIENT_CERT_SUBJECT=$cn"
521530
} else {
522531
# For file/x509: create a placeholder cert (not used, but keeps env var consistent)
523532
$clientCert = New-SelfSignedCertificate `

0 commit comments

Comments
 (0)