System 2.0.0.0 4.0.0.0 System.Net.Security.AuthenticatedStream

Use the class for authentication and to help secure information transmitted between a client and a server. Using , you can do the following.

Send the client's credentials to the server for Impersonation or Delegation.

Request server authentication.

Encrypt and/or sign data before transmitting it.

Authentication must be performed before transmitting information. Clients request authentication using the synchronous methods, which block until the authentication completes, or the asynchronous methods, which do not block while waiting for the authentication to complete. Servers request authentication using the synchronous or asynchronous methods. The client, and optionally the server, is authenticated using the Negotiate security protocol. On Windows 95/98 systems, Windows NT LAN Manager (NTLM) is the protocol used for authentication. On other platforms the Kerberos protocol is used for authentication if both client and server support it; otherwise NTLM is used. For detailed descriptions of these protocols, see the Platform SDK documentation on MSDN, at msdn.microsoft.com/library/. The class performs the authentication using the Security Support Provider Interface (SSPI).

When authentication succeeds, you must check the and properties to determine what security services will be used by the to help secure your data during transmission. Check the property to determine whether mutual authentication occurred. You can get information about the remote client or server using the property.

If the authentication fails, you will receive an or a . In this case, you can retry the authentication with a different credential.

You send data using the synchronous or asynchronous methods. You receive data using the synchronous or asynchronous methods. If security services such as encryption or signing are enabled, these are automatically applied to your data by the .

The transmits data using a stream that you supply when creating the . When you supply this underlying stream, you have the option to specify whether closing the also closes the underlying stream.

Provides a stream that uses the Negotiate security protocol to authenticate the client, and optionally the server, in client-server communication.

- Constructor
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  To be added.

  Initializes a new instance of the class using the specified .

  A object used by the for sending and receiving data.
- Constructor
  2.0.0.0
  4.0.0.0
  System.MonoTODO

  When you specify true for the parameter, closing the has no effect on the stream; you must explicitly close when you no longer need it.

  Initializes a new instance of the class using the specified and stream closure behavior.

  A object used by the for sending and receiving data.
  true to indicate that closing this has no effect on ; false to indicate that closing this also closes . See the Remarks section for more information.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void

  The authentication uses the client's . No Service Principal Name (SPN) is specified for the server. The impersonation level is , the security level is , and mutual authentication is requested. The class will construct the SPN used for mutual authentication.

  When authentication succeeds, you must check the and properties to determine what security services are used by the . Check the property to determine whether mutual authentication occurred.

  If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential.

  Called by clients to authenticate the client, and optionally the server, in a client-server connection.

- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void `` ``

  The impersonation level is , the security level is , and mutual authentication is requested. The class will construct the SPN used for mutual authentication.

  When authentication succeeds, you must check the and properties to determine what security services are used by the . Check the property to determine whether mutual authentication occurred.

  Called by clients to authenticate the client, and optionally the server, in a client-server connection. The authentication process uses the specified client credential.

  The that is used to establish the identity of the client. The Service Principal Name (SPN) that uniquely identifies the server to authenticate.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void `` `` `` ``

  Use the parameter to request security services for data transmitted using the authenticated stream. For example, to have the data encrypted and signed, specify the value. Successful authentication does not guarantee that the requested has been granted. You must check the and properties to determine what security services are used by the .

  If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential.

  Called by clients to authenticate the client, and optionally the server, in a client-server connection. The authentication process uses the specified credentials and authentication options.

  The that is used to establish the identity of the client. The Service Principal Name (SPN) that uniquely identifies the server to authenticate. One of the values, indicating the security services for the stream. One of the values, indicating how the server can use the client's credentials to access resources.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void

  The authentication uses the server's . No Service Principal Name (SPN) is specified for the server. The impersonation level is , and the security level is .

  When authentication succeeds, you must check the and properties to determine what security services are used by the . Check the property to determine whether mutual authentication occurred.

  This method blocks until the operation completes. To prevent blocking until the operation completes, use one of the method overloads.

  If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential.

  Called by servers to authenticate the client, and optionally the server, in a client-server connection.

- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void `` `` ``

  When authentication succeeds, you must check the and properties to determine what security services are used by the . Check the property to determine whether mutual authentication occurred.

  This method blocks until the operation completes. To prevent blocking until the operation completes, use one of the method overloads.

  If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential.

  Called by servers to authenticate the client, and optionally the server, in a client-server connection. The authentication process uses the specified server credentials and authentication options.

  The that is used to establish the identity of the server. One of the values, indicating the security services for the stream. One of the values, indicating how the server can use the client's credentials to access resources.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.IAsyncResult `` ``

  The authentication uses the client's . No Service Principal Name (SPN) is specified for the server. The impersonation level is , and the security level is . The class will construct the SPN used for mutual authentication.

  This method is asynchronous and does not block while the operation completes. To block until the operation completes, use one of the method overloads.

  The asynchronous authentication operation must be completed by calling the method. Typically, the method is invoked by the delegate. For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview

  If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential.

  Called by clients to begin an asynchronous operation to authenticate the client, and optionally the server, in a client-server connection. This method does not block.

  An object indicating the status of the asynchronous operation.

  An delegate that references the method to invoke when the authentication is complete. A user-defined object containing information about the operation. This object is passed to the delegate when the operation completes.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.IAsyncResult `` `` `` ``

  This method is asynchronous and does not block while the operation completes. To block until the operation completes, use one of the method overloads.

  The asynchronous authentication operation must be completed by calling the method. Typically, the method is invoked by the delegate. For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview

  If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential.

  Called by clients to begin an asynchronous operation to authenticate the client, and optionally the server, in a client-server connection. The authentication process uses the specified credentials. This method does not block.

  An object indicating the status of the asynchronous operation.

  The that is used to establish the identity of the client. The Service Principal Name (SPN) that uniquely identifies the server to authenticate. An delegate that references the method to invoke when the authentication is complete. A user-defined object containing information about the write operation. This object is passed to the delegate when the operation completes.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.IAsyncResult `` `` `` `` `` ``

  Use the parameter to request security services for data transmitted using the authenticated stream. For example, to have the data encrypted and signed, specify the value. Successful authentication does not guarantee that the requested has been granted. You must check the and properties to determine what security services are used by the .

  This method is asynchronous and does not block while the operation completes. To block until the operation completes, use one of the method overloads.

  The asynchronous authentication operation must be completed by calling the method. Typically, the method is invoked by the delegate. For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview

  If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential.

  Called by clients to begin an asynchronous operation to authenticate the client, and optionally the server, in a client-server connection. The authentication process uses the specified credentials and authentication options. This method does not block.

  An object indicating the status of the asynchronous operation.

  The that is used to establish the identity of the client. The Service Principal Name (SPN) that uniquely identifies the server to authenticate. One of the values, indicating the security services for the stream. One of the values, indicating how the server can use the client's credentials to access resources. An delegate that references the method to invoke when the authentication is complete. A user-defined object containing information about the write operation. This object is passed to the delegate when the operation completes.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.IAsyncResult `` ``

  The authentication uses the server's . No Service Principal Name (SPN) is specified for the server. The impersonation level is , the security level is .

  When authentication succeeds, you must check the and properties to determine what security services are used by the . Check the property to determine whether mutual authentication occurred.

  To block until the operation completes, use one of the method overloads.

  If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential.

  Called by servers to begin an asynchronous operation to authenticate the client, and optionally the server, in a client-server connection. This method does not block.

  An object indicating the status of the asynchronous operation.

  An delegate that references the method to invoke when the authentication is complete. A user-defined object containing information about the operation. This object is passed to the delegate when the operation completes.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.IAsyncResult `` `` `` `` ``

  Use the parameter to request security services for data transmitted using the authenticated stream. For example, to have the data encrypted and signed, specify the value. Successful authentication does not guarantee that, the requested has been granted. You must check the and properties to determine what security services are used by the .

  This method is asynchronous and does not block while the operation completes. To block until the operation completes, use one of the method overloads.

  The asynchronous authentication operation must be completed by calling the method. Typically, the method is invoked by the delegate. For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview

  If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential.

  Called by servers to begin an asynchronous operation to authenticate the client, and optionally the server, in a client-server connection. The authentication process uses the specified server credentials and authentication options. This method does not block.

  An object indicating the status of the asynchronous operation.

  The that is used to establish the identity of the client. One of the values, indicating the security services for the stream. One of the values, indicating how the server can use the client's credentials to access resources. An delegate that references the method to invoke when the authentication is complete. A user-defined object containing information about the operation. This object is passed to the delegate when the operation completes.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.IAsyncResult `` `` `` `` ``

  If encryption, signing, or encryption and signing are enabled, the read operation reads the data from the underlying stream, checks the integrity of the data, and decrypts it. If no security services such as data encryption or signing are in use, this method starts an asynchronous read operation on the underlying stream.

  This method is asynchronous and does not block while the operation completes. To block until the operation completes, use the method.

  The asynchronous read operation must be completed by calling the method. Typically, the method is invoked by the delegate. For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview

  The class does not support multiple simultaneous read operations. If you attempt to start a read operation while another read operation is already executing on the same stream, a exception will be thrown.

  You cannot call this method until you have successfully authenticated. To authenticate, call one of the , , , or methods.

  Begins an asynchronous read operation that reads data from the stream and stores it in the specified array.

  An object indicating the status of the asynchronous operation.

  A array that receives the bytes read from the stream. The zero-based location in at which to begin storing the data read from this stream. The maximum number of bytes to read from the stream. An delegate that references the method to invoke when the read operation is complete. A user-defined object containing information about the read operation. This object is passed to the delegate when the operation completes.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.IAsyncResult `` `` `` `` ``

  If encryption, signing, or encryption and signing are enabled, this method reads the data from buffer, encrypts, signs, or encrypts and signs it, and transmits it using the underlying stream. If no security services such as data encryption or signing are in use, this method starts an asynchronous write operation on the underlying stream.

  This method is asynchronous and does not block while the operation completes. To block until the operation completes, use the method.

  The asynchronous read operation must be completed by calling the method. Typically, the method is invoked by the delegate. For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview

  The class does not support multiple simultaneous write operations. If you attempt to start a write operation while another write operation is already executing on the same stream, a exception will be thrown.

  You cannot call this method until you have successfully authenticated. To authenticate, call one of the , , , or methods.

  Begins an asynchronous write operation that writes s from the specified buffer to the stream.

  An object indicating the status of the asynchronous operation.

  A array that supplies the bytes to be written to the stream. The zero-based location in at which to begin reading bytes to be written to the stream. An value that specifies the number of bytes to read from . An delegate that references the method to invoke when the write operation is complete. A user-defined object containing information about the write operation. This object is passed to the delegate when the operation completes.
- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  If successful authentication has occurred, this property returns the value returned by invoking the property on the underlying stream. The underlying stream is specified when you create an instance of the class.

  Gets a value that indicates whether the underlying stream is readable.

- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  You should not attempt to set the position of the object or its underlying stream. The underlying stream is specified when you create an instance of the class.

  Gets a value that indicates whether the underlying stream is seekable.

- Property
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Boolean To be added.

  This property returns the value returned by invoking the property on the underlying stream. The underlying stream is specified when you create an instance of the class.

  Gets a value that indicates whether the underlying stream supports time-outs.

- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  If successful authentication has occurred, this property returns the value returned by invoking the property on the underlying stream. The underlying stream is specified when you create an instance of the class.

  Gets a value that indicates whether the underlying stream is writable.

- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void ``

  This method is called by the public Dispose() method and the method. Dispose() invokes the protected Dispose(Boolean) method with the parameter set to true. invokes Dispose with set to false.

  When the parameter is true, this method releases all resources held by any managed objects that this references. This method invokes the Dispose() method of each referenced object.

  Releases the unmanaged resources used by the and optionally releases the managed resources.

  true to release both managed and unmanaged resources; false to release only unmanaged resources.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void ``

  If the operation has not completed, this method blocks until it does. When the authentication succeeds, you must check the and properties to determine what security services are used by the . Check the property to determine whether mutual authentication occurred.

  If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential.

  To perform this operation synchronously, use one of the method.

  Ends a pending asynchronous client authentication operation that was started with a call to .

  An instance returned by a call to .
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void ``

  If the operation has not completed, this method blocks until it does.

  When authentication succeeds, you must check the and properties to determine what security services are used by the . Check the property to determine whether mutual authentication occurred.

  If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential.

  To perform this operation synchronously, use the method.

  Ends a pending asynchronous client authentication operation that was started with a call to .

  An instance returned by a call to .
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Int32 ``

  If the operation has not completed, this method blocks until it does.

  To perform this operation synchronously, use the method.

  You cannot call this method until you have successfully authenticated. To authenticate, call one of the , , , or methods.

  Ends an asynchronous read operation that was started with a call to .

  A value that specifies the number of bytes read from the underlying stream.

  An instance returned by a call to
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void ``

  If the operation has not completed, this method blocks until it does.

  You cannot call this method until you have successfully authenticated. To authenticate, call one of the , , , or methods.

  To perform this operation synchronously, use the method.

  Ends an asynchronous write operation that was started with a call to .

  An instance returned by a call to
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void

  This method invokes on the underlying stream.

  Causes any buffered data to be written to the underlying device.

- Property
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Security.Principal.TokenImpersonationLevel To be added.

  You must successfully authenticate before calling this method. Clients specify the impersonation level when they request authentication by calling one of the or methods. If you authenticate without specifying a , is used.

  Gets a value that indicates how the server can use the client's credentials.

- Property
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Boolean To be added.

  Clients authenticate by calling the or methods. Servers authenticate by calling the or methods.

  Gets a value that indicates whether authentication was successful.

- Property
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Boolean To be added.

  Encryption helps to protect the privacy of the data; namely, it helps to ensure that while data is in transit it cannot be deciphered by third parties.

  Gets a value that indicates whether this uses data encryption.

- Property
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Boolean To be added.

  Mutual authentication is specified by the client when the client wants the server to provide credentials for authentication. By default, clients request mutual authentication.

  The Negotiate protocol selects either NTLM or Kerberos depending on the security protocols supported by the client and server. NTLM does not support mutual authentication.

  Gets a value that indicates whether both the server and the client have been authenticated.

- Property
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Boolean To be added.

  If authentication failed or did not occur, this property returns false.

  To authenticate as the server, call the or methods.

  Gets a value that indicates whether the local side of the connection used by this was authenticated as the server.

- Property
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Boolean To be added.

  Data signing helps to protect the integrity of the data; namely, it helps the recipient determine whether the data has been tampered with while in transit.

  Gets a value that indicates whether the data sent using this stream is signed.

- Property
  2.0.0.0
  4.0.0.0
  System.Int64 To be added.

  This property returns the value returned by invoking the property on the underlying stream. If the underlying stream is not seekable, this property will typically throw an exception. The run-time type of the underlying stream determines the run-time type of the exception that is thrown.

  Gets the length of the underlying stream.

- Property
  2.0.0.0
  4.0.0.0
  System.Int64 To be added.

  This property returns the value returned by invoking the property on the underlying stream. If the underlying stream is not seekable, this property will typically throw an exception. The run-time type of the underlying stream determines the run-time type of the exception that is thrown.

  Gets or sets the current position in the underlying stream.

- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Int32 `` `` ``

  The method reads a maximum of bytes from the current stream and stores them in beginning at .

  You cannot call this method until you have successfully authenticated. To authenticate, call one of the , , , or methods.

  To perform this operation asynchronously, use the method.

  Reads data from this stream and stores it in the specified array.

  A value that specifies the number of bytes read from the underlying stream. When there is no more data to be read, returns 0.

  A array that receives the bytes read from the stream. A containing the zero-based location in at which to begin storing the data read from this stream. A containing the maximum number of bytes to read from the stream.
- Property
  2.0.0.0
  4.0.0.0
  System.Int32 To be added.

  This property returns the value returned by invoking the property on the underlying stream. When you set this property, the value on the underlying stream is set to the specified value.

  If the underlying stream is a , is in milliseconds and is set to by default so that read operations do not time out.

  Gets or sets the amount of time a read operation blocks waiting for data.

- Property
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Security.Principal.IIdentity To be added.

  When accessed by the client, this property returns a containing the Service Principal Name (SPN) of the server and the authentication protocol used. When accessed by the server, this property returns a that describes the client. If the is not available, client information is returned to the server in a .

  Gets information about the identity of the remote party sharing this authenticated stream.

- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Int64 `` ``

  Do not call this method. It is inherited, but is not supported by .

  Throws .

  Always throws a .

  This value is ignored. This value is ignored.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void `` To be added.

  Sets the length of the underlying stream.

  An value that specifies the length of the stream.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void `` `` ``

  If encryption, signing, or encryption and signing are enabled, this method reads the data from buffer, encrypts, signs, or encrypts and signs it, and transmits it using the underlying stream. If no security services such as data encryption or signing are in use, this method invokes on the underlying stream.

  This method blocks while the write operation completes. To prevent blocking while the operation completes, use the method.

  You cannot call this method until you have successfully authenticated. To authenticate, call one of the , , , or methods.

  The class does not support multiple simultaneous write operations. If you attempt to start a write operation while another write operation is already executing on the same stream, a exception will be thrown.

  Write the specified number of s to the underlying stream using the specified buffer and offset.

  A array that supplies the bytes written to the stream. An containing the zero-based location in at which to begin reading bytes to be written to the stream. A containing the number of bytes to read from .
- Property
  2.0.0.0
  4.0.0.0
  System.Int32 To be added.

  This property returns the value returned by invoking the property on the underlying stream. For set operations, the specified value sets the value on the underlying stream.

  If the underlying stream is a , is in milliseconds and is set to by default so that write operations do not time out.

  Gets or sets the amount of time a write operation blocks waiting for data.