|
@@ -48,7 +48,7 @@ if "%1"=="verify" goto signorverify
|
|
|
if not "%1"=="" goto failed
|
|
|
|
|
|
:embed
|
|
|
-set publickeyfile=_temp.ispublickey
|
|
|
+set publickeyfile=def02.ispublickey.txt
|
|
|
Files\ISSigTool.exe export-public-key "%publickeyfile%"
|
|
|
if errorlevel 1 goto failed
|
|
|
if not exist "%publickeyfile%" goto failed
|
|
@@ -56,12 +56,6 @@ set targetfile=Components\TrustFunc.AllowedPublicKeys.inc
|
|
|
if not exist "%targetfile%" goto failed
|
|
|
powershell.exe -NoProfile -Command "$filePath = '%targetfile%'; $replacementFilePath = '%publickeyfile%'; $startMarker = 'AllowedPublicKey2Text :='; $endMarker = ';'; try { $content = Get-Content -Raw -Path $filePath; $replacementText = Get-Content -Raw -Path $replacementFilePath; $replacementText = $replacementText -replace \"`r`n\", \"' + #13#10 +`r`n'\"; $replacementText = \"'\" + $replacementText + \"'\"; $replacementText = $replacementText -replace \" \+`r`n''\", \"\"; [string] $pattern = '(?s)' + [regex]::Escape($startMarker) + '.*?' + [regex]::Escape($endMarker); if ($content -match $pattern) { $replacement = $startMarker + \"`r`n\" + $replacementText + $endMarker; $newContent = $content -replace $pattern, $replacement; $utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($false); [System.IO.File]::WriteAllText($filePath, $newContent, $utf8NoBomEncoding); Write-Host \"Embedded public key in $filePath.\"; } else { Write-Host \"Pattern not found in $filePath.\"; exit 1; } } catch { Write-Error (\"Error: $_.Exception.Message\"); exit 1; }"
|
|
|
if errorlevel 1 goto failed
|
|
|
-set targetfile=setup.allowedpublickeys.iss
|
|
|
-if not exist "%targetfile%" goto failed
|
|
|
-powershell.exe -NoProfile -Command "$filePath = '%targetfile%'; $replacementFilePath = '%publickeyfile%'; $startMarker = 'Name: mykey2; '; try { $content = Get-Content -Raw -Path $filePath; $replacementText = Get-Content -Raw -Path $replacementFilePath; $replacementText = $replacementText -replace \"`r`n\", \"; \"; $replacementText = $replacementText.Substring(0, $replacementText.Length - 2); $replacementText = $replacementText -replace 'format issig-public-key; key-id', 'KeyID:'; $replacementText = $replacementText -replace 'public-x', 'PublicX:'; $replacementText = $replacementText -replace 'public-y', 'PublicY:'; [string] $pattern = [regex]::Escape($startMarker) + '.*?$'; if ($content -match $pattern) { $replacement = $startMarker + $replacementText; $newContent = $content -replace $pattern, $replacement; $utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($false); [System.IO.File]::WriteAllText($filePath, $newContent, $utf8NoBomEncoding); Write-Host \"Embedded public key in $filePath.\"; } else { Write-Host \"Pattern not found in $filePath.\"; exit 1; } } catch { Write-Error (\"Error: $_.Exception.Message\"); exit 1; }"
|
|
|
-if errorlevel 1 goto failed
|
|
|
-del "%publickeyfile%"
|
|
|
-if errorlevel 1 goto failed
|
|
|
|
|
|
echo Success!
|
|
|
goto exit
|