mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-22 23:59:46 -05:00
Fixes client initialising for SSLStream and possible crash reason
This commit is contained in:
parent
7361fd801b
commit
8d945f3759
1 changed files with 5 additions and 1 deletions
|
|
@ -1,10 +1,14 @@
|
|||
function New-IcingaSSLStream()
|
||||
{
|
||||
param(
|
||||
[System.Net.Sockets.TcpClient]$Client = @{},
|
||||
[System.Net.Sockets.TcpClient]$Client = $null,
|
||||
[Security.Cryptography.X509Certificates.X509Certificate2]$Certificate = $null
|
||||
);
|
||||
|
||||
if ($null -eq $Client) {
|
||||
return $null;
|
||||
}
|
||||
|
||||
$SSLStream = New-Object System.Net.Security.SslStream($Client.GetStream(), $false)
|
||||
$SSLStream.AuthenticateAsServer($Certificate, $false, [System.Security.Authentication.SslProtocols]::Tls12, $true) | Out-Null;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue