에서 클라이언트 인증서와 TCP 클라이언트 연결을 만드는 방법이 잘 작동나는 SSL 연결을 설정할 수있는 코드를 다음과 같이 파워 쉘
$cert = dir cert:\CurrentUser\My | where {$_.Subject -like "*Alice*"}
$computerName = "google.com"
$port = "443"
$socket = New-Object Net.Sockets.TcpClient($computerName, $port)
$stream = $socket.GetStream()
$sslStream = New-Object System.Net.Security.SslStream $stream,$false
$sslStream.AuthenticateAsClient($computerName)
$sslStream
. 하지만 이제 인증을위한 클라이언트 인증서를 추가하지 않아도됩니다. 난 그냥
$sslStream.BeginAuthenticateAsClient($computerName,$cert,"SslProtocols",$false,"Foo" ,"Bar")
와
$sslStream.AuthenticateAsClient($computerName)
을 대체 할 필요가 있다고 생각하지만 난 인수를 잘 얻을 운이 없었다. Sombody가 Assync 호출을 해결할 수 있습니까 ?-) 아마이 C# 코드가 필요합니까?!?
인수는 다음과 같습니다
System.IAsyncResult BeginAuthenticateAsClient(
string targetHost,
System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates,
System.Security.Authentication.SslProtocols enabledSslProtocols,
bool checkCertificateRevocation,
System.AsyncCallback asyncCallback,
System.Object asyncState)
은 무엇 내가 마지막으로 달성하고자하는 것은 나열하고 나중에 클라이언트가 연결되어있는 암호 군 지정하는 것입니다. (내가 알고있는 Wireshark를 사용할 수있다 ;-))
(!) 참고 : 나는 내 TestClient을에이 활성화 System.Net.Security.SslStream는 .NET의 FW 4에 의존 할 수 읽었습니다 가 : 등록 번호가 마이크로 소프트 \ .netframework/V의 OnlyUseLatestCLR \ HKLM의 \ 소프트웨어를 추가/t REG_DWORD/d 1 – icnivad