Add compression estimates, transparent image output and full format selection
This commit is contained in:
1 parent
65cebb31ca
commit
2b897267d1
22 files changed
+220
-30
No files matched your search
@@ -6,6 +6,7 @@ param(
|
||||
[string]$SdkBin
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
. (Join-Path $PSScriptRoot 'hash-file.ps1')
|
||||
$projectRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
|
||||
if (-not $IdentityFile) { $IdentityFile = Join-Path $projectRoot $(if ($Channel -eq 'Store') { 'store\identity.store.json' } else { 'store\identity.dev.json' }) }
|
||||
$identity = Get-Content -LiteralPath $IdentityFile -Raw | ConvertFrom-Json
|
||||
@@ -70,6 +71,9 @@ $packLog = Join-Path $projectRoot "build\makeappx-$Channel.log"
|
||||
if ($LASTEXITCODE -ne 0) { throw 'MakeAppx-Validierung fehlgeschlagen.' }
|
||||
$certificatePath = $null
|
||||
if ($SignDevelopment) {
|
||||
# Load Windows modules explicitly when the parent shell supplies a different PSModulePath.
|
||||
Import-Module (Join-Path $PSHOME 'Modules\Microsoft.PowerShell.Security\Microsoft.PowerShell.Security.psd1') -ErrorAction Stop
|
||||
Import-Module (Join-Path $env:WINDIR 'System32\WindowsPowerShell\v1.0\Modules\PKI\PKI.psd1') -ErrorAction Stop
|
||||
$certificate = Get-ChildItem Cert:\CurrentUser\My | Where-Object { $_.Subject -eq $identity.Publisher -and $_.FriendlyName -eq 'FileBow local development' -and $_.HasPrivateKey -and $_.NotAfter -gt (Get-Date).AddDays(7) } | Select-Object -First 1
|
||||
if (-not $certificate) {
|
||||
$certificate = New-SelfSignedCertificate -Type Custom -Subject $identity.Publisher -FriendlyName 'FileBow local development' -CertStoreLocation Cert:\CurrentUser\My -KeyUsage DigitalSignature -KeyExportPolicy NonExportable -TextExtension @('2.5.29.37={text}1.3.6.1.5.5.7.3.3','2.5.29.19={text}') -NotAfter (Get-Date).AddYears(1)
|
||||
@@ -79,6 +83,6 @@ if ($SignDevelopment) {
|
||||
$certificatePath = Join-Path $outputDir 'FileBow-Development.cer'
|
||||
Export-Certificate -Cert $certificate -FilePath $certificatePath -Force | Out-Null
|
||||
}
|
||||
$record = @{ Channel=$Channel; Package=$package; Stage=$stage; Identity=$identity; Signed=[bool]$SignDevelopment; Certificate=$certificatePath; SHA256=(Get-FileHash $package -Algorithm SHA256).Hash; BuiltAt=(Get-Date).ToUniversalTime().ToString('o') }
|
||||
$record = @{ Channel=$Channel; Package=$package; Stage=$stage; Identity=$identity; Signed=[bool]$SignDevelopment; Certificate=$certificatePath; SHA256=(Get-FileBowSha256 $package); BuiltAt=(Get-Date).ToUniversalTime().ToString('o') }
|
||||
$record | ConvertTo-Json -Depth 5 | Set-Content (Join-Path $outputDir "build-$Channel.json") -Encoding utf8
|
||||
Write-Output $package
|
||||
@@ -1,12 +1,13 @@
|
||||
[CmdletBinding()]param()
|
||||
[CmdletBinding()]param()
|
||||
$ErrorActionPreference='Stop'
|
||||
. (Join-Path $PSScriptRoot 'hash-file.ps1')
|
||||
$root=[IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
|
||||
$download=Join-Path $root 'build\downloads\ffmpeg-lgpl.zip'
|
||||
$url='https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2026-10-25-13-00/ffmpeg-n9.0.2-36-g6882969ce9-win64-lgpl-shared-9.0.zip'
|
||||
$expected='72E3FBAF17F8D5162C3010F9E58872FCB93BA2B03731FD0FFF1CA9AABB616EA6'
|
||||
New-Item -ItemType Directory -Force (Split-Path $download) | Out-Null
|
||||
if (-not (Test-Path $download)) { Invoke-WebRequest $url -OutFile $download }
|
||||
if ((Get-FileHash $download -Algorithm SHA256).Hash -ne $expected) { throw 'FFmpeg-Prüfsumme stimmt nicht überein.' }
|
||||
if ((Get-FileBowSha256 $download) -ne $expected) { throw 'FFmpeg-Prüfsumme stimmt nicht überein.' }
|
||||
$unpack=Join-Path $root 'build\downloads\ffmpeg'
|
||||
Expand-Archive $download $unpack -Force
|
||||
$source=Join-Path $unpack 'ffmpeg-n9.0.2-36-g6882969ce9-win64-lgpl-shared-9.0'
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
function Get-FileBowSha256([string]$Path) {
|
||||
$stream = [IO.File]::OpenRead([IO.Path]::GetFullPath($Path))
|
||||
$algorithm = [Security.Cryptography.SHA256]::Create()
|
||||
try { return [BitConverter]::ToString($algorithm.ComputeHash($stream)).Replace('-', '') }
|
||||
finally { $algorithm.Dispose(); $stream.Dispose() }
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
# Run explicitly in an elevated PowerShell. Trusts only the FileBow development certificate.
|
||||
[CmdletBinding()]param()
|
||||
$ErrorActionPreference='Stop'
|
||||
. (Join-Path $PSScriptRoot 'hash-file.ps1')
|
||||
$root=[IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
|
||||
$record=Get-Content (Join-Path $root 'out\msix\build-Development.json') -Raw | ConvertFrom-Json
|
||||
if (-not $record.Signed) { throw 'Zuerst build-msix.ps1 -SignDevelopment ausführen.' }
|
||||
if ((Get-FileHash $record.Package -Algorithm SHA256).Hash -ne $record.SHA256) { throw 'Paket-Prüfsumme stimmt nicht überein.' }
|
||||
if ((Get-FileBowSha256 $record.Package) -ne $record.SHA256) { throw 'Paket-Prüfsumme stimmt nicht überein.' }
|
||||
$cert=[Security.Cryptography.X509Certificates.X509Certificate2]::new($record.Certificate)
|
||||
if ($cert.Subject -ne 'CN=FileBow Development') { throw 'Unerwartetes Zertifikat.' }
|
||||
Import-Certificate -FilePath $record.Certificate -CertStoreLocation Cert:\LocalMachine\TrustedPeople | Out-Null
|
||||
|
||||
+17
-2
@@ -1,5 +1,6 @@
|
||||
"""Verify every uncompressed 64 KiB payload hash in an MSIX block map."""
|
||||
import base64
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
@@ -7,7 +8,12 @@ import sys
|
||||
import zipfile
|
||||
from xml.etree import ElementTree as ET
|
||||
from urllib.parse import unquote
|
||||
package=Path(sys.argv[1]);count=0
|
||||
parser=argparse.ArgumentParser()
|
||||
parser.add_argument('package',type=Path)
|
||||
parser.add_argument('--allow-unsigned',action='store_true')
|
||||
parser.add_argument('--identity',type=Path)
|
||||
args=parser.parse_args()
|
||||
package=args.package;count=0
|
||||
with zipfile.ZipFile(package) as archive:
|
||||
names={unquote(name):name for name in archive.namelist()}
|
||||
tree=ET.fromstring(archive.read('AppxBlockMap.xml'))
|
||||
@@ -25,6 +31,15 @@ with zipfile.ZipFile(package) as archive:
|
||||
assert not payload.read(1),name
|
||||
assert size==int(file.attrib['Size']),name
|
||||
count+=1
|
||||
assert 'AppxSignature.p7x' in archive.namelist(),'Development package is unsigned'
|
||||
signed='AppxSignature.p7x' in archive.namelist()
|
||||
assert args.allow_unsigned or signed,'Package is unsigned; use --allow-unsigned for Store packages'
|
||||
manifest=ET.fromstring(archive.read('AppxManifest.xml'))
|
||||
namespace={'m':'http://schemas.microsoft.com/appx/manifest/foundation/windows10'}
|
||||
identity=manifest.find('m:Identity',namespace).attrib
|
||||
if args.identity:
|
||||
expected=json.loads(args.identity.read_text(encoding='utf-8-sig'))
|
||||
for key in ['Name','Publisher','Version']: assert identity[key]==expected[key],f'Identity mismatch: {key}'
|
||||
assert manifest.find('m:Properties/m:PublisherDisplayName',namespace).text==expected['PublisherDisplayName']
|
||||
print(json.dumps({'package':str(package),'payloads':count,'blockHashesValid':True,
|
||||
'signaturePresent':signed,'identity':identity,
|
||||
'sha256':hashlib.sha256(package.read_bytes()).hexdigest()},indent=2))
|
||||
Reference in new issue
Block a user