From b53d80ce2181f7bb435f456cd0c21f6fda896059 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 20 Dec 2025 22:42:38 +0900 Subject: [PATCH] Improve TLS protocol handling in Download-File Expanded TLS protocol support to include TLS 1.0, 1.1, 1.2, and conditionally TLS 1.3 for better compatibility. Added error handling and warning output if TLS configuration fails. --- postInstall.ps1 | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/postInstall.ps1 b/postInstall.ps1 index ef5c8a3..0aa5aed 100644 --- a/postInstall.ps1 +++ b/postInstall.ps1 @@ -292,16 +292,21 @@ function Download-File { Write-Host "[*] Downloading:" Write-Host " $Url" Write-Host " -> $DestinationPath" - - # Fix TLS 1.2 connectivity issue (Tested in Windows 8.1) - # Enable TLS 1.2 and TLS 1.3 (if available) - avoid deprecated TLS 1.0/1.1 + + # Fix TLS connectivity issues (Tested in Windows 8.1) try { - [Net.ServicePointManager]::SecurityProtocol = ` - [Net.SecurityProtocolType]::Tls12 -bor ` - [Net.SecurityProtocolType]::Tls13 - } catch { - # TLS 1.3 not available, fall back to TLS 1.2 only - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + $protocol = [Net.SecurityProtocolType]::Tls12 -bor ` + [Net.SecurityProtocolType]::Tls11 -bor ` + [Net.SecurityProtocolType]::Tls + + try { + $protocol = $protocol -bor [Enum]::Parse([Net.SecurityProtocolType], 'Tls13') + } catch {} + + [Net.ServicePointManager]::SecurityProtocol = $protocol + } + catch { + Write-Host "[WARN] TLS configuration failed: $($_.Exception.Message)" } # Ensure destination directory exists