Fix installer scripts: private key export, encoding, description

- Fix PrivateKey null error by using GetRSAPrivateKey() instead of
  .PrivateKey which is null for certs created with -Signer
- Replace all Unicode characters (umlauts, arrows, emojis) with
  ASCII-safe alternatives so output renders correctly on any
  Windows console regardless of codepage
- Add explanation in setup why Starface URL is needed (CA import)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 09:59:24 +02:00
parent c303461330
commit 60b44788fd
3 changed files with 90 additions and 78 deletions
+12 -12
View File
@@ -4,8 +4,8 @@
Importiert das SSL-Zertifikat einer Starface-Anlage in den Windows-Zertifikatspeicher.
.DESCRIPTION
Verbindet sich per SSL/TLS zur angegebenen Starface-Anlage, extrahiert das
Zertifikat und importiert es als vertrauenswürdig. Danach kann das Outlook
Add-in die Starface REST-API über HTTPS erreichen.
Zertifikat und importiert es als vertrauenswuerdig. Danach kann das Outlook
Add-in die Starface REST-API ueber HTTPS erreichen.
.EXAMPLE
.\import-cert.ps1 -StarfaceHost 192.168.1.100
.EXAMPLE
@@ -27,7 +27,7 @@ Write-Host " Starface-Zertifikat importieren" -ForegroundColor Cyan
Write-Host "============================================================" -ForegroundColor Cyan
Write-Host ""
Write-Host " Verbinde mit ${StarfaceHost}:${Port} ..." -ForegroundColor Green
Write-Host " [OK] Verbinde mit ${StarfaceHost}:${Port} ..." -ForegroundColor Green
try {
$tcpClient = New-Object System.Net.Sockets.TcpClient
@@ -35,7 +35,7 @@ try {
$sslStream = New-Object System.Net.Security.SslStream(
$tcpClient.GetStream(),
$false,
{ $true } # Alle Zertifikate akzeptieren für den Abruf
{ $true } # Alle Zertifikate akzeptieren fuer den Abruf
)
$sslStream.AuthenticateAsClient($StarfaceHost)
@@ -46,13 +46,13 @@ try {
$tcpClient.Close()
Write-Host " Zertifikat erhalten:" -ForegroundColor Green
Write-Host " Subject: $($x509Cert.Subject)" -ForegroundColor White
Write-Host " Subject: $($x509Cert.Subject)" -ForegroundColor White
Write-Host " Aussteller: $($x509Cert.Issuer)" -ForegroundColor White
Write-Host " Gültig bis: $($x509Cert.NotAfter)" -ForegroundColor White
Write-Host " Gueltig bis: $($x509Cert.NotAfter)" -ForegroundColor White
Write-Host " Thumbprint: $($x509Cert.Thumbprint)" -ForegroundColor White
Write-Host ""
# Prüfen ob bereits vorhanden
# Pruefen ob bereits vorhanden
$rootStore = New-Object System.Security.Cryptography.X509Certificates.X509Store(
[System.Security.Cryptography.X509Certificates.StoreName]::Root,
[System.Security.Cryptography.X509Certificates.StoreLocation]::LocalMachine
@@ -62,19 +62,19 @@ try {
$rootStore.Close()
if ($existing) {
Write-Host " Zertifikat ist bereits als vertrauenswürdig gespeichert." -ForegroundColor Yellow
Write-Host " Zertifikat ist bereits als vertrauenswuerdig gespeichert." -ForegroundColor Yellow
} else {
$rootStore.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite)
$rootStore.Add($x509Cert)
$rootStore.Close()
Write-Host " Zertifikat erfolgreich als vertrauenswürdig importiert!" -ForegroundColor Green
Write-Host " [OK] Zertifikat erfolgreich als vertrauenswuerdig importiert!" -ForegroundColor Green
}
} catch {
Write-Host " Fehler: $_" -ForegroundColor Red
Write-Host " [X] Fehler: $_" -ForegroundColor Red
Write-Host ""
Write-Host " Mögliche Ursachen:" -ForegroundColor Yellow
Write-Host " - Starface nicht erreichbar (IP/Hostname prüfen)" -ForegroundColor Yellow
Write-Host " Moegliche Ursachen:" -ForegroundColor Yellow
Write-Host " - Starface nicht erreichbar (IP/Hostname pruefen)" -ForegroundColor Yellow
Write-Host " - Falscher Port (Standard: 443)" -ForegroundColor Yellow
Write-Host " - Firewall blockiert die Verbindung" -ForegroundColor Yellow
exit 1