NegotiateStream 클래스

정의

클라이언트-서버 통신에서 협상 보안 프로토콜을 사용하여 클라이언트를 인증하고 선택적으로 서버를 인증하는 스트림을 제공합니다.

public ref class NegotiateStream : System::Net::Security::AuthenticatedStream
public class NegotiateStream : System.Net.Security.AuthenticatedStream
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public class NegotiateStream : System.Net.Security.AuthenticatedStream
type NegotiateStream = class
    inherit AuthenticatedStream
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
type NegotiateStream = class
    inherit AuthenticatedStream
Public Class NegotiateStream
Inherits AuthenticatedStream
상속
상속
특성

예제

다음 예제에서는 을 사용하는 클라이언트-서버 연결의 클라이언트 쪽을 NegotiateStream보여 줍니다. 클라이언트가 인증하고 메시지를 비동기적으로 서버에 보냅니다.

#using <System.dll>

using namespace System;
using namespace System::Net;
using namespace System::Net::Security;
using namespace System::Net::Sockets;
using namespace System::Text;

// The following class displays the properties of an authenticatedStream.
public ref class AuthenticatedStreamReporter
{
public:
   static void DisplayProperties( AuthenticatedStream^ stream )
   {
      Console::WriteLine( L"IsAuthenticated: {0}", stream->IsAuthenticated );
      Console::WriteLine( L"IsMutuallyAuthenticated: {0}", stream->IsMutuallyAuthenticated );
      Console::WriteLine( L"IsEncrypted: {0}", stream->IsEncrypted );
      Console::WriteLine( L"IsSigned: {0}", stream->IsSigned );
      Console::WriteLine( L"IsServer: {0}", stream->IsServer );
   }

};


public ref class ASynchronousAuthenticatingTcpClient
{
private:
   static TcpClient^ client = nullptr;

public:
   void Main()
   {
      
      // Establish the remote endpoint for the socket.
      // For this example, use the local machine.
      IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() );
      IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ];
      
      // Client and server use port 11000. 
      IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 );
      
      // Create a TCP/IP socket.
      client = gcnew TcpClient;
      
      // Connect the socket to the remote endpoint.
      client->Connect( remoteEP );
      Console::WriteLine( L"Client connected to {0}.", remoteEP );
      
      // Ensure the client does not close when there is 
      // still data to be sent to the server.
      client->LingerState = (gcnew LingerOption( true,0 ));
      
      // Request authentication.
      NetworkStream^ clientStream = client->GetStream();
      NegotiateStream^ authStream = gcnew NegotiateStream( clientStream,false );
      
      // Pass the NegotiateStream as the AsyncState object 
      // so that it is available to the callback delegate.
      IAsyncResult^ ar = authStream->BeginAuthenticateAsClient( gcnew AsyncCallback( EndAuthenticateCallback ), authStream );
      
      Console::WriteLine( L"Client waiting for authentication..." );
      
      // Wait until the result is available.
      ar->AsyncWaitHandle->WaitOne();
      
      // Display the properties of the authenticated stream.
      AuthenticatedStreamReporter::DisplayProperties( authStream );
      
      // Send a message to the server.
      // Encode the test data into a byte array.
      array<Byte>^message = Encoding::UTF8->GetBytes( L"Hello from the client." );
      ar = authStream->BeginWrite( message, 0, message->Length, gcnew AsyncCallback( EndWriteCallback ), authStream );
      
      ar->AsyncWaitHandle->WaitOne();
      Console::WriteLine( L"Sent {0} bytes.", message->Length );
      
      // Close the client connection.
      authStream->Close();
      Console::WriteLine( L"Client closed." );
   }


   // The following method is called when the authentication completes.
   static void EndAuthenticateCallback( IAsyncResult^ ar )
   {
      Console::WriteLine( L"Client ending authentication..." );
      NegotiateStream^ authStream = dynamic_cast<NegotiateStream^>(ar->AsyncState);
      
      // End the asynchronous operation.
      authStream->EndAuthenticateAsClient( ar );
      
      //         Console.WriteLine("AllowedImpersonation: {0}", authStream.AllowedImpersonation);
   }


   // The following method is called when the write operation completes.
   static void EndWriteCallback( IAsyncResult^ ar )
   {
      Console::WriteLine( L"Client ending write operation..." );
      NegotiateStream^ authStream = dynamic_cast<NegotiateStream^>(ar->AsyncState);
      
      // End the asynchronous operation.
      authStream->EndWrite( ar );
   }

};

void main()
{
   ASynchronousAuthenticatingTcpClient^ aatc = gcnew ASynchronousAuthenticatingTcpClient;
   aatc->Main();
}
using System;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Text;

namespace Examples.NegotiateStreamExample
{
    public class ASynchronousAuthenticatingTcpClient
    {
        static TcpClient client = null;

        public static void Main(String[] args)
        {
            // Establish the remote endpoint for the socket.
            // For this example, use the local machine.
            IPHostEntry ipHostInfo = Dns.GetHostEntry("localhost");
            IPAddress ipAddress = ipHostInfo.AddressList[0];
            // Client and server use port 11000.
            IPEndPoint remoteEP = new IPEndPoint(ipAddress, 11000);
            // Create a TCP/IP socket.
            client = new TcpClient();
            // Connect the socket to the remote endpoint.
            client.Connect(remoteEP);
            Console.WriteLine("Client connected to {0}.", remoteEP.ToString());
            // Ensure the client does not close when there is
            // still data to be sent to the server.
            client.LingerState = new LingerOption(true, 0);
            // Request authentication.
            NetworkStream clientStream = client.GetStream();
            NegotiateStream authStream = new NegotiateStream(clientStream, false);
            // Pass the NegotiateStream as the AsyncState object
            // so that it is available to the callback delegate.
            Task authenticateTask = authStream
                .AuthenticateAsClientAsync()
                .ContinueWith(task =>
                {
                    Console.WriteLine("Client ending authentication...");
                    Console.WriteLine("ImpersonationLevel: {0}", authStream.ImpersonationLevel);
                });

            Console.WriteLine("Client waiting for authentication...");
            // Wait until the result is available.
            authenticateTask.Wait();
            // Display the properties of the authenticated stream.
            AuthenticatedStreamReporter.DisplayProperties(authStream);
            // Send a message to the server.
            // Encode the test data into a byte array.
            byte[] message = Encoding.UTF8.GetBytes("Hello from the client.");
            Task writeTask = authStream
                .WriteAsync(message, 0, message.Length)
                .ContinueWith(task =>
                {
                    Console.WriteLine("Client ending write operation...");
                });

            writeTask.Wait();
            Console.WriteLine("Sent {0} bytes.", message.Length);
            // Close the client connection.
            authStream.Close();
            Console.WriteLine("Client closed.");
        }
    }

    // The following class displays the properties of an authenticatedStream.
    public class AuthenticatedStreamReporter
    {
        public static void DisplayProperties(AuthenticatedStream stream)
        {
            Console.WriteLine("IsAuthenticated: {0}", stream.IsAuthenticated);
            Console.WriteLine("IsMutuallyAuthenticated: {0}", stream.IsMutuallyAuthenticated);
            Console.WriteLine("IsEncrypted: {0}", stream.IsEncrypted);
            Console.WriteLine("IsSigned: {0}", stream.IsSigned);
            Console.WriteLine("IsServer: {0}", stream.IsServer);
        }
    }
}
Imports System.Text
Imports System.Net.Sockets
Imports System.Net.Security
Imports System.Net

Namespace Examples.NegotiateStreamExample

    Public Class ASynchronousAuthenticatingTcpClient

        Shared client As TcpClient = Nothing

        Public Shared Sub Main(args As String())
            ' Establish the remote endpoint for the socket.
            ' For this example, use the local machine.
            Dim ipHostInfo = Dns.GetHostEntry("localhost")
            Dim ipAddress = ipHostInfo.AddressList(0)

            ' Client and server use port 11000. 
            Dim remoteEP As New IPEndPoint(ipAddress, 11000)

            ' Create a TCP/IP socket.
            client = New TcpClient()

            ' Connect the socket to the remote endpoint.
            client.Connect(remoteEP)
            Console.WriteLine("Client connected to {0}.", remoteEP.ToString())

            ' Ensure the client does not close when there is 
            ' still data to be sent to the server.
            client.LingerState = (New LingerOption(True, 0))

            ' Request authentication.
            Dim clientStream = client.GetStream()
            Dim authStream As New NegotiateStream(clientStream, False)

            ' Pass the NegotiateStream as the AsyncState object 
            ' so that it is available to the callback delegate.
            Dim ar = authStream.BeginAuthenticateAsClient(
                New AsyncCallback(AddressOf EndAuthenticateCallback), authStream)

            Console.WriteLine("Client waiting for authentication...")

            ' Wait until the result is available.
            ar.AsyncWaitHandle.WaitOne()

            ' Display the properties of the authenticated stream.
            AuthenticatedStreamReporter.DisplayProperties(authStream)

            ' Send a message to the server.
            ' Encode the test data into a byte array.
            Dim message = Encoding.UTF8.GetBytes("Hello from the client.")
            ar = authStream.BeginWrite(message, 0, message.Length, 
                New AsyncCallback(AddressOf EndWriteCallback), authStream)
            ar.AsyncWaitHandle.WaitOne()
            Console.WriteLine("Sent {0} bytes.", message.Length)

            ' Close the client connection.
            authStream.Close()
            Console.WriteLine("Client closed.")

        End Sub

        ' The following method is called when the authentication completes.
        Public Shared Sub EndAuthenticateCallback(ar As IAsyncResult)

            Console.WriteLine("Client ending authentication...")
            Dim authStream = CType(ar.AsyncState, NegotiateStream)
            Console.WriteLine("ImpersonationLevel: {0}", authStream.ImpersonationLevel)

            ' End the asynchronous operation.
            authStream.EndAuthenticateAsClient(ar)

        End Sub

        ' The following method is called when the write operation completes.
        Public Shared Sub EndWriteCallback(ar As IAsyncResult)

            Console.WriteLine("Client ending write operation...")
            Dim authStream = CType(ar.AsyncState, NegotiateStream)

            ' End the asynchronous operation.
            authStream.EndWrite(ar)

        End Sub
    End Class

    ' The following class displays the properties of an AuthenticatedStream.
    Public Class AuthenticatedStreamReporter
        Public Shared Sub DisplayProperties(stream As AuthenticatedStream)
            Console.WriteLine("IsAuthenticated: {0}", stream.IsAuthenticated)
            Console.WriteLine("IsMutuallyAuthenticated: {0}", stream.IsMutuallyAuthenticated)
            Console.WriteLine("IsEncrypted: {0}", stream.IsEncrypted)
            Console.WriteLine("IsSigned: {0}", stream.IsSigned)
            Console.WriteLine("IsServer: {0}", stream.IsServer)
        End Sub
    End Class
End Namespace

다음 코드 예제에서는 클라이언트를 인증 하 고 클라이언트에서 보낸 메시지를 읽는 데 사용 NegotiateStream 하는 클라이언트-서버 연결의 서버 쪽을 보여 줍니다.

#using <System.dll>

using namespace System;
using namespace System::Net;
using namespace System::Net::Security;
using namespace System::Net::Sockets;
using namespace System::Security::Authentication;
using namespace System::Security::Principal;
using namespace System::Text;
using namespace System::IO;
using namespace System::Threading;

// ClientState is the AsyncState object.
private ref class ClientState
{
private:
   AuthenticatedStream^ authStream;
   TcpClient^ client;
   array<Byte>^buffer;
   StringBuilder^ message;
   ManualResetEvent^ waiter;

internal:
   ClientState( AuthenticatedStream^ a, TcpClient^ theClient )
   {
      authStream = a;
      client = theClient;
      message = nullptr;
      buffer = gcnew array<Byte>(2048);
      waiter = gcnew ManualResetEvent( false );
   }

internal:
   property TcpClient^ Client 
   {
      TcpClient^ get()
      {
         return client;
      }
   }

   property AuthenticatedStream^ AuthStream 
   {
      AuthenticatedStream^ get()
      {
         return authStream;
      }
  }

   property array<Byte>^ Buffer 
   {
      array<Byte>^ get()
      {
         return buffer;
      }

   }

   property StringBuilder^ Message 
   {
      StringBuilder^ get()
      {
         if ( message == nullptr )
                  message = gcnew StringBuilder;

         return message;
      }

   }

   property ManualResetEvent^ Waiter 
   {
      ManualResetEvent^ get()
      {
         return waiter;
      }

   }

};

public ref class AsynchronousAuthenticatingTcpListener
{
public:
   int Main()
   {
      
      // Create an IPv4 TCP/IP socket. 
      TcpListener^ listener = gcnew TcpListener( IPAddress::Any,11000 );
      
      // Listen for incoming connections.
      listener->Start();
      while ( true )
      {
         TcpClient^ clientRequest = nullptr;
         
         // Application blocks while waiting for an incoming connection.
         // Type CNTL-C to terminate the server.
         clientRequest = listener->AcceptTcpClient();
         Console::WriteLine( L"Client connected." );
         
         // A client has connected. 
         try
         {
            AuthenticateClient( clientRequest );
         }
         catch ( Exception^ e ) 
         {
            Console::WriteLine( e );
            continue;
         }

      }
   }


   static void AuthenticateClient( TcpClient^ clientRequest )
   {
      NetworkStream^ stream = clientRequest->GetStream();
      
      // Create the NegotiateStream.
      NegotiateStream^ authStream = gcnew NegotiateStream( stream,false );
      
      // Save the current client and NegotiateStream instance 
      // in a ClientState object.
      ClientState^ cState = gcnew ClientState( authStream,clientRequest );
      
      // Listen for the client authentication request.
      authStream->BeginAuthenticateAsServer( gcnew AsyncCallback( EndAuthenticateCallback ), cState );
      
      // Wait until the authentication completes.
      cState->Waiter->WaitOne();
      cState->Waiter->Reset();
      authStream->BeginRead( cState->Buffer, 0, cState->Buffer->Length, gcnew AsyncCallback( EndReadCallback ), cState );
      cState->Waiter->WaitOne();
      
      // Finished with the current client.
      authStream->Close();
      clientRequest->Close();
   }


   // The following method is invoked by the
   // BeginServerAuthenticate callback delegate.
   static void EndAuthenticateCallback( IAsyncResult^ ar )
   {
      
      // Get the saved data.
      ClientState^ cState = dynamic_cast<ClientState^>(ar->AsyncState);
      TcpClient^ clientRequest = cState->Client;
      NegotiateStream^ authStream = dynamic_cast<NegotiateStream^>(cState->AuthStream);
      Console::WriteLine( L"Ending authentication." );
      
      // Any exceptions that occurred during authentication are
      // thrown by the EndServerAuthenticate method.
      try
      {
         
         // This call blocks until the authentication is complete.
         authStream->EndAuthenticateAsServer( ar );
      }
      catch ( AuthenticationException^ e ) 
      {
         Console::WriteLine( e );
         Console::WriteLine( L"Authentication failed - closing connection." );
         cState->Waiter->Set();
         return;
      }
      catch ( Exception^ e ) 
      {
         Console::WriteLine( e );
         Console::WriteLine( L"Closing connection." );
         cState->Waiter->Set();
         return;
      }

      
      // Display properties of the authenticated client.
      IIdentity^ id = authStream->RemoteIdentity;
      Console::WriteLine( L"{0} was authenticated using {1}.", id->Name, id->AuthenticationType );
      cState->Waiter->Set();
   }


   static void EndReadCallback( IAsyncResult^ ar )
   {
      
      // Get the saved data.
      ClientState^ cState = dynamic_cast<ClientState^>(ar->AsyncState);
      TcpClient^ clientRequest = cState->Client;
      NegotiateStream^ authStream = dynamic_cast<NegotiateStream^>(cState->AuthStream);
      
      // Get the buffer that stores the message sent by the client.
      int bytes = -1;
      
      // Read the client message.
      try
      {
         bytes = authStream->EndRead( ar );
         cState->Message->Append( Encoding::UTF8->GetChars( cState->Buffer, 0, bytes ) );
         if ( bytes != 0 )
         {
            authStream->BeginRead( cState->Buffer, 0, cState->Buffer->Length, gcnew AsyncCallback( EndReadCallback ), cState );
            return;
         }
      }
      catch ( Exception^ e ) 
      {
         
         // A real application should do something
         // useful here, such as logging the failure.
         Console::WriteLine( L"Client message exception:" );
         Console::WriteLine( e );
         cState->Waiter->Set();
         return;
      }

      IIdentity^ id = authStream->RemoteIdentity;
      Console::WriteLine( L"{0} says {1}", id->Name, cState->Message );
      cState->Waiter->Set();
   }

};

void main()
{
   AsynchronousAuthenticatingTcpListener^ aatl = gcnew AsynchronousAuthenticatingTcpListener;
   aatl->Main();
}

using System;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Security.Principal;
using System.Text;
using System.IO;
using System.Threading;

namespace Examples.NegotiateStreamExample
{
    public class AsynchronousAuthenticatingTcpListener
    {
        public static void Main()
        {
            // Create an IPv4 TCP/IP socket.
            TcpListener listener = new TcpListener(IPAddress.Any, 11000);
            // Listen for incoming connections.
            listener.Start();
            while (true)
            {
                TcpClient clientRequest;
                // Application blocks while waiting for an incoming connection.
                // Type CNTL-C to terminate the server.
                clientRequest = listener.AcceptTcpClient();
                Console.WriteLine("Client connected.");
                // A client has connected.
                try
                {
                    AuthenticateClient(clientRequest);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }

        public static void AuthenticateClient(TcpClient clientRequest)
        {
            NetworkStream stream = clientRequest.GetStream();
            // Create the NegotiateStream.
            NegotiateStream authStream = new NegotiateStream(stream, false);
            // Save the current client and NegotiateStream instance
            // in a ClientState object.
            ClientState cState = new ClientState(authStream, clientRequest);
            // Listen for the client authentication request.
            Task authTask = authStream
                .AuthenticateAsServerAsync()
                .ContinueWith(task => { EndAuthenticateCallback(cState); });

            // Any exceptions that occurred during authentication are
            // thrown by the EndAuthenticateAsServer method.
            try
            {
                // This call blocks until the authentication is complete.
                authTask.Wait();
            }
            catch (AuthenticationException e)
            {
                Console.WriteLine(e);
                Console.WriteLine("Authentication failed - closing connection.");
                return;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Console.WriteLine("Closing connection.");
                return;
            }

            Task<int> readTask = authStream
                .ReadAsync(cState.Buffer, 0, cState.Buffer.Length);

            readTask
                .ContinueWith((task) => { EndReadCallback(cState, task.Result); })
                .Wait();
            // Finished with the current client.
            authStream.Close();
            clientRequest.Close();
        }

        private static void EndAuthenticateCallback(ClientState cState)
        {
            // Get the saved data.
            NegotiateStream authStream = (NegotiateStream)cState.AuthenticatedStream;
            Console.WriteLine("Ending authentication.");

            // Display properties of the authenticated client.
            IIdentity id = authStream.RemoteIdentity;
            Console.WriteLine("{0} was authenticated using {1}.",
                id.Name,
                id.AuthenticationType
            );
        }

        private static void EndReadCallback(ClientState cState, int bytes)
        {
            NegotiateStream authStream = (NegotiateStream)cState.AuthenticatedStream;
            // Read the client message.
            try
            {
                cState.Message.Append(Encoding.UTF8.GetChars(cState.Buffer, 0, bytes));
                if (bytes != 0)
                {
                    Task<int> readTask = authStream.ReadAsync(cState.Buffer, 0, cState.Buffer.Length);
                    readTask
                        .ContinueWith(task => { EndReadCallback(cState, task.Result); })
                        .Wait();

                    return;
                }
            }
            catch (Exception e)
            {
                // A real application should do something
                // useful here, such as logging the failure.
                Console.WriteLine("Client message exception:");
                Console.WriteLine(e);
                return;
            }
            IIdentity id = authStream.RemoteIdentity;
            Console.WriteLine("{0} says {1}", id.Name, cState.Message.ToString());
        }
    }
    // ClientState is the AsyncState object.
    internal class ClientState
    {
        private StringBuilder _message = null;

        internal ClientState(AuthenticatedStream a, TcpClient theClient)
        {
            AuthenticatedStream = a;
            Client = theClient;
        }
        internal TcpClient Client { get; }

        internal AuthenticatedStream AuthenticatedStream { get; }

        internal byte[] Buffer { get; } = new byte[2048];

        internal StringBuilder Message
        {
            get { return _message ??= new StringBuilder(); }
        }
    }
}

설명

인증에 클래스를 NegotiateStream 사용하고 클라이언트와 서버 간에 전송되는 정보를 보호합니다. 를 사용하여 NegotiateStream다음을 수행할 수 있습니다.

  • 가장 또는 위임을 위해 클라이언트의 자격 증명을 서버로 보냅니다.

  • 서버 인증을 요청합니다.

  • 데이터를 전송하기 전에 암호화 및/또는 서명합니다.

정보를 전송하기 전에 인증을 수행해야 합니다. 클라이언트는 인증이 완료될 때까지 차단하는 동기 AuthenticateAsClient 메서드 또는 인증이 완료될 때까지 기다리는 동안 차단되지 않는 비동 BeginAuthenticateAsClient 기 메서드를 사용하여 인증을 요청합니다. 서버는 동기 또는 비동 AuthenticateAsServer 기 메서드를 사용하여 인증을 BeginAuthenticateAsServer 요청합니다. 클라이언트 및 선택적으로 서버는 Negotiate 보안 프로토콜을 사용하여 인증됩니다. Kerberos 프로토콜은 클라이언트와 서버가 모두 지원하는 경우 인증에 사용됩니다. 그렇지 않으면 NTLM이 사용됩니다. 클래스는 NegotiateStream SSPI(보안 지원 공급자 인터페이스)를 사용하여 인증을 수행합니다.

인증에 성공하면 전송 중에 데이터를 보호하는 데 사용할 NegotiateStream 보안 서비스를 확인하기 위해 속성과 IsSigned 속성을 확인해야 IsEncrypted 합니다. IsMutuallyAuthenticated 속성을 확인하여 상호 인증이 발생했는지 여부를 확인합니다. 속성을 사용하여 RemoteIdentity 원격 클라이언트 또는 서버에 대한 정보를 가져올 수 있습니다.

인증에 실패 AuthenticationException InvalidCredentialException하면 . 이 경우 다른 자격 증명을 사용하여 인증을 다시 시도할 수 있습니다.

동기 또는 비 BeginWriteWrite 기 또는 WriteAsync 메서드를 사용하여 데이터를 보냅니다. 동기 또는 비 ReadAsyncRead 기 또는 BeginRead 메서드를 사용하여 데이터를 받습니다. 암호화 또는 서명과 같은 보안 서비스를 사용하도록 설정하면 해당 서비스가 데이터에 NegotiateStream자동으로 적용됩니다.

NegotiateStream 만들 때 제공하는 스트림을 사용하여 데이터를 전송합니다 NegotiateStream. 이 기본 스트림을 제공할 때 기본 스트림을 닫을 때도 기본 스트림을 NegotiateStream 닫을지 여부를 지정하는 옵션이 있습니다.

생성자

NegotiateStream(Stream)

지정된 NegotiateStream를 사용하여 Stream 클래스의 새 인스턴스를 초기화합니다.

NegotiateStream(Stream, Boolean)

지정된 NegotiateStream과 스트림 닫기 동작을 사용해서 Stream 클래스의 새 인스턴스를 초기화합니다.

속성

CanRead

기본 스트림을 읽을 수 있는지를 나타내는 Boolean 값을 가져옵니다.

CanSeek

기본 스트림을 검색할 수 있는지를 나타내는 Boolean 값을 가져옵니다.

CanTimeout

기본 스트림에 제한 시간을 설정할 수 있는지를 나타내는 Boolean 값을 가져옵니다.

CanWrite

기본 스트림이 쓰기 가능한지를 나타내는 Boolean 값을 가져옵니다.

ImpersonationLevel

서버에서 클라이언트의 자격 증명을 사용하는 방법을 나타내는 값을 가져옵니다.

InnerStream

AuthenticatedStream에서 데이터를 보내고 받는 데 사용하는 스트림을 가져옵니다.

(다음에서 상속됨 AuthenticatedStream)
IsAuthenticated

인증이 성공했는지를 나타내는 Boolean 값을 가져옵니다.

IsEncrypted

NegotiateStream에서 데이터 암호화를 사용하는지 여부를 나타내는 Boolean 값을 가져옵니다.

IsMutuallyAuthenticated

서버와 클라이언트 모두 인증되었는지 여부를 나타내는 Boolean 값을 가져옵니다.

IsServer

NegotiateStream에서 사용하는 연결의 로컬측이 서버로 인증되었는지 여부를 나타내는 Boolean 값을 가져옵니다.

IsSigned

이 스트림을 사용하여 보내는 데이터에 서명할지를 나타내는 Boolean 값을 가져옵니다.

LeaveInnerStreamOpen

AuthenticatedStream에서 데이터를 보내고 받는 데 사용하는 스트림이 계속 열려 있는지 여부를 가져옵니다.

(다음에서 상속됨 AuthenticatedStream)
Length

기본 스트림의 길이를 가져옵니다.

Position

기본 스트림 내의 현재 위치를 가져오거나 설정합니다.

ReadTimeout

읽기 작업에서 데이터 대기를 차단하는 시간을 가져오거나 설정합니다.

RemoteIdentity

인증된 이 스트림을 공유하는 원격 대상의 ID 정보를 가져옵니다.

WriteTimeout

쓰기 작업에서 데이터 대기를 차단하는 시간을 가져오거나 설정합니다.

메서드

AuthenticateAsClient()

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하기 위해 클라이언트에서 호출합니다.

AuthenticateAsClient(NetworkCredential, ChannelBinding, String)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하기 위해 클라이언트에서 호출합니다. 인증 프로세스에는 지정된 클라이언트 자격 증명과 채널 바인딩이 사용됩니다.

AuthenticateAsClient(NetworkCredential, ChannelBinding, String, ProtectionLevel, TokenImpersonationLevel)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하기 위해 클라이언트에서 호출합니다. 인증 프로세스에는 지정된 자격 증명, 인증 옵션 및 채널 바인딩이 사용됩니다.

AuthenticateAsClient(NetworkCredential, String)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하기 위해 클라이언트에서 호출합니다. 인증 프로세스에는 지정된 클라이언트 자격 증명이 사용됩니다.

AuthenticateAsClient(NetworkCredential, String, ProtectionLevel, TokenImpersonationLevel)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하기 위해 클라이언트에서 호출합니다. 인증 프로세스는 지정된 자격 증명과 인증 옵션을 사용합니다.

AuthenticateAsClientAsync()

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업으로 클라이언트에 의해 호출됩니다.

AuthenticateAsClientAsync(NetworkCredential, ChannelBinding, String)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업으로 클라이언트에 의해 호출됩니다. 인증 프로세스에는 지정된 클라이언트 자격 증명과 채널 바인딩이 사용됩니다.

AuthenticateAsClientAsync(NetworkCredential, ChannelBinding, String, ProtectionLevel, TokenImpersonationLevel)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업으로 클라이언트에 의해 호출됩니다. 인증 프로세스에는 지정된 자격 증명, 인증 옵션 및 채널 바인딩이 사용됩니다.

AuthenticateAsClientAsync(NetworkCredential, String)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업으로 클라이언트에 의해 호출됩니다. 인증 프로세스에는 지정된 클라이언트 자격 증명이 사용됩니다.

AuthenticateAsClientAsync(NetworkCredential, String, ProtectionLevel, TokenImpersonationLevel)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업으로 클라이언트에 의해 호출됩니다. 인증 프로세스는 지정된 자격 증명과 인증 옵션을 사용합니다.

AuthenticateAsServer()

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하기 위해 서버에서 호출합니다.

AuthenticateAsServer(ExtendedProtectionPolicy)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하기 위해 서버에서 호출합니다. 인증 프로세스에는 지정된 확장 보호 정책이 사용됩니다.

AuthenticateAsServer(NetworkCredential, ExtendedProtectionPolicy, ProtectionLevel, TokenImpersonationLevel)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하기 위해 서버에서 호출합니다. 인증 프로세스는 지정된 서버 자격 증명, 인증 옵션 및 확장 보호 정책을 사용합니다.

AuthenticateAsServer(NetworkCredential, ProtectionLevel, TokenImpersonationLevel)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하기 위해 서버에서 호출합니다. 인증 프로세스는 지정된 서버 자격 증명과 인증 옵션을 사용합니다.

AuthenticateAsServerAsync()

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업으로 서버에서 호출합니다.

AuthenticateAsServerAsync(ExtendedProtectionPolicy)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업으로 서버에서 호출합니다. 인증 프로세스에는 지정된 확장 보호 정책이 사용됩니다.

AuthenticateAsServerAsync(NetworkCredential, ExtendedProtectionPolicy, ProtectionLevel, TokenImpersonationLevel)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업으로 서버에서 호출합니다. 인증 프로세스는 지정된 서버 자격 증명, 인증 옵션 및 확장 보호 정책을 사용합니다.

AuthenticateAsServerAsync(NetworkCredential, ProtectionLevel, TokenImpersonationLevel)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업으로 서버에서 호출합니다. 인증 프로세스는 지정된 서버 자격 증명과 인증 옵션을 사용합니다.

BeginAuthenticateAsClient(AsyncCallback, Object)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업을 시작하기 위해 클라이언트에서 호출합니다. 이 메서드는 차단되지 않습니다.

BeginAuthenticateAsClient(NetworkCredential, ChannelBinding, String, AsyncCallback, Object)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업을 시작하기 위해 클라이언트에서 호출합니다. 인증 프로세스는 지정된 자격 증명과 채널 바인딩을 사용합니다. 이 메서드는 차단되지 않습니다.

BeginAuthenticateAsClient(NetworkCredential, ChannelBinding, String, ProtectionLevel, TokenImpersonationLevel, AsyncCallback, Object)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업을 시작하기 위해 클라이언트에서 호출합니다. 인증 프로세스는 지정된 자격 증명, 인증 옵션 및 채널 바인딩이 사용합니다. 이 메서드는 차단되지 않습니다.

BeginAuthenticateAsClient(NetworkCredential, String, AsyncCallback, Object)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업을 시작하기 위해 클라이언트에서 호출합니다. 인증 프로세스는 지정된 자격 증명을 사용합니다. 이 메서드는 차단되지 않습니다.

BeginAuthenticateAsClient(NetworkCredential, String, ProtectionLevel, TokenImpersonationLevel, AsyncCallback, Object)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업을 시작하기 위해 클라이언트에서 호출합니다. 인증 프로세스는 지정된 자격 증명과 인증 옵션을 사용합니다. 이 메서드는 차단되지 않습니다.

BeginAuthenticateAsServer(AsyncCallback, Object)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업을 시작하기 위해 서버에서 호출합니다. 이 메서드는 차단되지 않습니다.

BeginAuthenticateAsServer(ExtendedProtectionPolicy, AsyncCallback, Object)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업을 시작하기 위해 서버에서 호출합니다. 인증 프로세스에는 지정된 확장 보호 정책이 사용됩니다. 이 메서드는 차단되지 않습니다.

BeginAuthenticateAsServer(NetworkCredential, ExtendedProtectionPolicy, ProtectionLevel, TokenImpersonationLevel, AsyncCallback, Object)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업을 시작하기 위해 서버에서 호출합니다. 인증 프로세스는 지정된 서버 자격 증명, 인증 옵션 및 확장 보호 정책을 사용합니다. 이 메서드는 차단되지 않습니다.

BeginAuthenticateAsServer(NetworkCredential, ProtectionLevel, TokenImpersonationLevel, AsyncCallback, Object)

클라이언트-서버 연결에서 클라이언트를 인증하고 선택적으로 서버를 인증하는 비동기 작업을 시작하기 위해 서버에서 호출합니다. 인증 프로세스는 지정된 서버 자격 증명과 인증 옵션을 사용합니다. 이 메서드는 차단되지 않습니다.

BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)

스트림에서 데이터를 읽어 지정된 배열에 저장하는 비동기 읽기 작업을 시작합니다.

BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)

비동기 읽기 작업을 시작합니다. 대신 ReadAsync(Byte[], Int32, Int32)를 사용하세요.

(다음에서 상속됨 Stream)
BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)

지정된 버퍼에서 스트림에 Byte를 쓰는 비동기 쓰기 작업을 시작합니다.

BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)

비동기 쓰기 작업을 시작합니다. 대신 WriteAsync(Byte[], Int32, Int32)를 사용하세요.

(다음에서 상속됨 Stream)
Close()

현재 스트림을 닫고 현재 스트림과 관련된 소켓과 파일 핸들 등의 리소스를 모두 해제합니다. 이 메서드를 호출하는 대신 스트림이 올바르게 삭제되었는지 확인합니다.

(다음에서 상속됨 Stream)
CopyTo(Stream)

현재 스트림에서 바이트를 읽어서 다른 스트림에 해당 바이트를 씁니다. 두 스트림 위치는 복사된 바이트 수만큼 고급입니다.

(다음에서 상속됨 Stream)
CopyTo(Stream, Int32)

현재 스트림에서 바이트를 읽어서 지정된 버퍼 크기로 다른 스트림에 씁니다. 두 스트림 위치는 복사된 바이트 수만큼 고급입니다.

(다음에서 상속됨 Stream)
CopyToAsync(Stream)

현재 스트림에서 모든 바이트를 비동기적으로 읽어 다른 스트림에 씁니다. 두 스트림 위치는 복사된 바이트 수만큼 고급입니다.

(다음에서 상속됨 Stream)
CopyToAsync(Stream, CancellationToken)

현재 스트림에서 바이트를 비동기적으로 읽어 지정된 취소 토큰을 사용하여 다른 스트림에 씁니다. 두 스트림 위치는 복사된 바이트 수만큼 고급입니다.

(다음에서 상속됨 Stream)
CopyToAsync(Stream, Int32)

현재 스트림에서 바이트를 비동기적으로 읽어 지정된 버퍼 크기로 다른 스트림에 씁니다. 두 스트림 위치는 복사된 바이트 수만큼 고급입니다.

(다음에서 상속됨 Stream)
CopyToAsync(Stream, Int32, CancellationToken)

현재 스트림에서 바이트를 비동기적으로 읽어 지정된 버퍼 크기 및 취소 토큰을 사용하여 다른 스트림에 씁니다. 두 스트림 위치는 복사된 바이트 수만큼 고급입니다.

(다음에서 상속됨 Stream)
CreateObjRef(Type)

원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
CreateWaitHandle()
사용되지 않습니다.
사용되지 않습니다.
사용되지 않습니다.

WaitHandle 개체를 할당합니다.

(다음에서 상속됨 Stream)
Dispose()

Stream에서 사용하는 모든 리소스를 해제합니다.

(다음에서 상속됨 Stream)
Dispose(Boolean)

NegotiateStream에서 사용하는 관리되지 않는 리소스를 해제하고, 관리되는 리소스를 선택적으로 해제할 수 있습니다.

Dispose(Boolean)

AuthenticatedStream에서 사용하는 관리되지 않는 리소스를 해제하고, 관리되는 리소스를 선택적으로 해제할 수 있습니다.

(다음에서 상속됨 AuthenticatedStream)
DisposeAsync()

NegotiateStream에서 사용하는 비관리형 리소스와 관리형 리소스를 비동기적으로 해제합니다.

DisposeAsync()

AuthenticatedStream에서 사용하는 비관리형 리소스와 관리형 리소스를 비동기적으로 해제합니다.

(다음에서 상속됨 AuthenticatedStream)
EndAuthenticateAsClient(IAsyncResult)

BeginAuthenticateAsClient를 호출하여 시작한 보류 상태의 비동기 클라이언트 인증 작업을 끝냅니다.

EndAuthenticateAsServer(IAsyncResult)

BeginAuthenticateAsServer를 호출하여 시작한 보류 상태의 비동기 클라이언트 인증 작업을 끝냅니다.

EndRead(IAsyncResult)

BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)를 호출하여 시작한 비동기 읽기 작업을 끝냅니다.

EndRead(IAsyncResult)

보류 중인 비동기 읽기가 완료되기를 기다립니다. 대신 ReadAsync(Byte[], Int32, Int32)를 사용하세요.

(다음에서 상속됨 Stream)
EndWrite(IAsyncResult)

BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)를 호출하여 시작한 비동기 쓰기 작업을 끝냅니다.

EndWrite(IAsyncResult)

비동기 쓰기 작업을 끝냅니다. 대신 WriteAsync(Byte[], Int32, Int32)를 사용하세요.

(다음에서 상속됨 Stream)
Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
Flush()

버퍼링된 모든 데이터를 기본 디바이스에 씁니다.

FlushAsync()

이 스트림에 대한 모든 버퍼를 비동기적으로 지우고 버퍼링된 모든 데이터가 내부 디바이스에 비동기적으로 쓰여지도록 합니다.

(다음에서 상속됨 Stream)
FlushAsync(CancellationToken)

버퍼링된 모든 데이터를 기본 디바이스에 비동기적으로 씁니다.

FlushAsync(CancellationToken)

이 스트림에 대해 모든 버퍼를 비동기적으로 지우고 버퍼링된 데이터가 내부 디바이스에 쓰여지도록 하고 취소 요청을 모니터링합니다.

(다음에서 상속됨 Stream)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetLifetimeService()
사용되지 않습니다.

이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다.

(다음에서 상속됨 MarshalByRefObject)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
InitializeLifetimeService()
사용되지 않습니다.

이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.

(다음에서 상속됨 MarshalByRefObject)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
MemberwiseClone(Boolean)

현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
ObjectInvariant()
사용되지 않습니다.

Contract에 대한 지원을 제공합니다.

(다음에서 상속됨 Stream)
Read(Byte[], Int32, Int32)

이 스트림에서 데이터를 읽어 지정된 배열에 저장합니다.

Read(Span<Byte>)

파생 클래스에서 재정의되면 현재 스트림에서 바이트의 시퀀스를 읽고, 읽은 바이트 수만큼 스트림 내에서 앞으로 이동합니다.

(다음에서 상속됨 Stream)
ReadAsync(Byte[], Int32, Int32)

현재 스트림에서 바이트 시퀀스를 읽고 읽은 바이트 수만큼 스트림에서 위치를 비동기적으로 앞으로 이동합니다.

(다음에서 상속됨 Stream)
ReadAsync(Byte[], Int32, Int32, CancellationToken)

이 스트림에서 비동기적으로 데이터를 읽어 지정된 배열에 저장합니다.

ReadAsync(Byte[], Int32, Int32, CancellationToken)

현재 스트림에서 바이트의 시퀀스를 비동기적으로 읽고 읽은 바이트 수만큼 스트림 내에서 앞으로 이동하며 취소 요청을 모니터링합니다.

(다음에서 상속됨 Stream)
ReadAsync(Memory<Byte>, CancellationToken)

NegotiateStream에서 비동기적으로 데이터를 읽고 비동기 작업으로 바이트 메모리 범위에 저장합니다.

ReadAsync(Memory<Byte>, CancellationToken)

현재 스트림에서 바이트의 시퀀스를 비동기적으로 읽고 읽은 바이트 수만큼 스트림 내에서 앞으로 이동하며 취소 요청을 모니터링합니다.

(다음에서 상속됨 Stream)
ReadAtLeast(Span<Byte>, Int32, Boolean)

현재 스트림에서 최소 바이트 수를 읽고 읽은 바이트 수만큼 스트림 내의 위치를 이동합니다.

(다음에서 상속됨 Stream)
ReadAtLeastAsync(Memory<Byte>, Int32, Boolean, CancellationToken)

현재 스트림에서 최소 바이트 수를 비동기적으로 읽고, 읽은 바이트 수만큼 스트림 내의 위치를 이동하고, 취소 요청을 모니터링합니다.

(다음에서 상속됨 Stream)
ReadByte()

스트림에서 바이트를 읽고 스트림 내 위치를 한 바이트씩 앞으로 이동하거나 스트림 끝일 경우 -1을 반환합니다.

(다음에서 상속됨 Stream)
ReadExactly(Byte[], Int32, Int32)

count 현재 스트림에서 바이트 수를 읽고 스트림 내의 위치를 이동합니다.

(다음에서 상속됨 Stream)
ReadExactly(Span<Byte>)

현재 스트림에서 바이트를 읽고 스트림이 채워질 때까지 스트림 내의 buffer 위치를 이동합니다.

(다음에서 상속됨 Stream)
ReadExactlyAsync(Byte[], Int32, Int32, CancellationToken)

현재 스트림에서 바이트 수를 비동기적으로 읽고 count , 스트림 내의 위치를 발전시키고, 취소 요청을 모니터링합니다.

(다음에서 상속됨 Stream)
ReadExactlyAsync(Memory<Byte>, CancellationToken)

현재 스트림에서 바이트를 비동기적으로 읽고, 스트림이 채워질 때까지 buffer 스트림 내의 위치를 이동하고, 취소 요청을 모니터링합니다.

(다음에서 상속됨 Stream)
Seek(Int64, SeekOrigin)

NotSupportedException을 버립니다.

SetLength(Int64)

기본 스트림의 길이를 설정합니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
Write(Byte[], Int32, Int32)

지정된 버퍼와 오프셋을 사용하여 지정된 수의 Byte를 기본 스트림에 씁니다.

Write(ReadOnlySpan<Byte>)

파생 클래스를 재정의될 때 현재 스트림에 바이트의 시퀀스를 쓰고 쓰여진 바이트 수만큼 이 스트림 내에서 앞으로 이동합니다.

(다음에서 상속됨 Stream)
WriteAsync(Byte[], Int32, Int32)

현재 스트림에 바이트 시퀀스를 비동기적으로 쓰고 쓴 바이트 수만큼 이 스트림에서 현재 위치를 앞으로 이동합니다.

(다음에서 상속됨 Stream)
WriteAsync(Byte[], Int32, Int32, CancellationToken)

지정된 수의 Byte를 기본 스트림에 비동기적으로 씁니다.

WriteAsync(Byte[], Int32, Int32, CancellationToken)

바이트의 시퀀스를 현재 스트림에 비동기적으로 쓰고 쓰여진 바이트 수만큼 이 스트림 내의 현재 위치를 앞으로 이동한 후 취소 요청을 모니터링합니다.

(다음에서 상속됨 Stream)
WriteAsync(ReadOnlyMemory<Byte>, CancellationToken)

지정된 수의 Byte를 기본 스트림에 비동기적으로 씁니다.

WriteAsync(ReadOnlyMemory<Byte>, CancellationToken)

바이트의 시퀀스를 현재 스트림에 비동기적으로 쓰고 쓰여진 바이트 수만큼 이 스트림 내의 현재 위치를 앞으로 이동한 후 취소 요청을 모니터링합니다.

(다음에서 상속됨 Stream)
WriteByte(Byte)

스트림의 현재 위치에 바이트를 쓰고 스트림 내 위치를 1바이트씩 앞으로 이동합니다.

(다음에서 상속됨 Stream)

확장 메서드

ConfigureAwait(IAsyncDisposable, Boolean)

비동기 일회용에서 반환되는 작업을 대기하는 방법을 구성합니다.

적용 대상

추가 정보