fix: сравнение SSLCertificateSHA1Hash — байты реестра vs hex thumbprint
Реестр отдаёт byte[]; TermService принимал cert, но проверка Persisted ложно падала. Добавлены ConvertTo-RdpRepairThumbprintHex и самотесты на форматы DAK-PC. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -135,6 +135,23 @@ Assert-Test 'Registry path constants well-formed' {
|
||||
if ($script:RdpRepairRdpTcpKey -notmatch 'RDP-Tcp$') { throw 'bad rdp tcp key' }
|
||||
}
|
||||
|
||||
Assert-Test 'ConvertTo-RdpRepairThumbprintHex from decimal byte string' {
|
||||
$hex = ConvertTo-RdpRepairThumbprintHex -HashValue '20 77 141 24 197 69 45 187 141 61 233 254 108 97 230 158 36 151 225 169'
|
||||
if ($hex -ne '144D8D18C5452DBB8D3DE9FE6C61E69E2497E1A9') { throw "got $hex" }
|
||||
}
|
||||
|
||||
Assert-Test 'ConvertTo-RdpRepairThumbprintHex from byte array' {
|
||||
$bytes = [byte[]](0x14, 0x4D, 0x8D, 0x18, 0xC5, 0x45, 0x2D, 0xBB, 0x8D, 0x3D, 0xE9, 0xFE, 0x6C, 0x61, 0xE6, 0x9E, 0x24, 0x97, 0xE1, 0xA9)
|
||||
$hex = ConvertTo-RdpRepairThumbprintHex -HashValue $bytes
|
||||
if ($hex -ne '144D8D18C5452DBB8D3DE9FE6C61E69E2497E1A9') { throw "got $hex" }
|
||||
}
|
||||
|
||||
Assert-Test 'ConvertTo-RdpRepairThumbprintHex hex equals byte forms' {
|
||||
$fromHex = ConvertTo-RdpRepairThumbprintHex -HashValue '144D8D18C5452DBB8D3DE9FE6C61E69E2497E1A9'
|
||||
$fromBytes = ConvertTo-RdpRepairThumbprintHex -HashValue ([byte[]](20, 77, 141, 24, 197, 69, 45, 187, 141, 61, 233, 254, 108, 97, 230, 158, 36, 151, 225, 169))
|
||||
if ($fromHex -ne $fromBytes) { throw 'format mismatch' }
|
||||
}
|
||||
|
||||
Assert-Test 'Export-RdpRepairDiagnosticReport writes file' {
|
||||
if (-not (Test-RdpRepairIsAdministrator)) {
|
||||
Write-Host ' (skip report write - not admin)' -ForegroundColor DarkYellow
|
||||
|
||||
Reference in New Issue
Block a user