AuthenticatedStream Class

Provides methods for passing credentials across a stream and requesting or performing authentication for client-server applications.

System.Object
  System.MarshalByRefObject
    System.IO.Stream
      System.Net.Security.AuthenticatedStream
        System.Net.Security.NegotiateStream
        System.Net.Security.SslStream

Namespace:  System.Net.Security
Assembly:  System (in System.dll)

public abstract class AuthenticatedStream : Stream

The AuthenticatedStream type exposes the following members.

  NameDescription
Protected methodAuthenticatedStreamInitializes a new instance of the AuthenticatedStream class.
Top

  NameDescription
Public propertyCanReadWhen overridden in a derived class, gets a value indicating whether the current stream supports reading. (Inherited from Stream.)
Public propertyCanSeekWhen overridden in a derived class, gets a value indicating whether the current stream supports seeking. (Inherited from Stream.)
Public propertyCanTimeoutGets a value that determines whether the current stream can time out. (Inherited from Stream.)
Public propertyCanWriteWhen overridden in a derived class, gets a value indicating whether the current stream supports writing. (Inherited from Stream.)
Protected propertyInnerStreamGets the stream used by this AuthenticatedStream for sending and receiving data.
Public propertyIsAuthenticatedGets a Boolean value that indicates whether authentication was successful.
Public propertyIsEncryptedGets a Boolean value that indicates whether data sent using this AuthenticatedStream is encrypted.
Public propertyIsMutuallyAuthenticatedGets a Boolean value that indicates whether both server and client have been authenticated.
Public propertyIsServerGets a Boolean value that indicates whether the local side of the connection was authenticated as the server.
Public propertyIsSignedGets a Boolean value that indicates whether the data sent using this stream is signed.
Public propertyLeaveInnerStreamOpenGets whether the stream used by this AuthenticatedStream for sending and receiving data has been left open.
Public propertyLengthWhen overridden in a derived class, gets the length in bytes of the stream. (Inherited from Stream.)
Public propertyPositionWhen overridden in a derived class, gets or sets the position within the current stream. (Inherited from Stream.)
Public propertyReadTimeoutGets or sets a value, in miliseconds, that determines how long the stream will attempt to read before timing out. (Inherited from Stream.)
Public propertyWriteTimeoutGets or sets a value, in miliseconds, that determines how long the stream will attempt to write before timing out. (Inherited from Stream.)
Top

  NameDescription
Public methodBeginReadBegins an asynchronous read operation. (Inherited from Stream.)
Public methodBeginWriteBegins an asynchronous write operation. (Inherited from Stream.)
Public methodCloseCloses the current stream and releases any resources (such as sockets and file handles) associated with the current stream. (Inherited from Stream.)
Public methodCopyTo(Stream)Reads the bytes from the current stream and writes them to the destination stream. (Inherited from Stream.)
Public methodCopyTo(Stream, Int32)Reads all the bytes from the current stream and writes them to a destination stream, using a specified buffer size. (Inherited from Stream.)
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Protected methodCreateWaitHandle Obsolete. Allocates a WaitHandle object. (Inherited from Stream.)
Public methodDispose()Releases all resources used by the Stream. (Inherited from Stream.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the AuthenticatedStream and optionally releases the managed resources. (Overrides Stream.Dispose(Boolean).)
Public methodEndReadWaits for the pending asynchronous read to complete. (Inherited from Stream.)
Public methodEndWriteEnds an asynchronous write operation. (Inherited from Stream.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFlushWhen overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device. (Inherited from Stream.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Protected methodObjectInvariantInfrastructure. Provides support for a Contract. (Inherited from Stream.)
Public methodReadWhen overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. (Inherited from Stream.)
Public methodReadByteReads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream. (Inherited from Stream.)
Public methodSeekWhen overridden in a derived class, sets the position within the current stream. (Inherited from Stream.)
Public methodSetLengthWhen overridden in a derived class, sets the length of the current stream. (Inherited from Stream.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodWriteWhen overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written. (Inherited from Stream.)
Public methodWriteByteWrites a byte to the current position in the stream and advances the position within the stream by one byte. (Inherited from Stream.)
Top

This abstract class provides methods and properties that are common to authenticated streams.

Authenticated streams can provide authentication, data signing, and encryption services that can help maintain the integrity and confidentiality of data transmitted using the InnerStream.

The security protocol implemented by a class that derives from AuthenticatedStream together with the security protocols supported on the client and server will determine the security features that are available to an application. The NegotiateStream and SslStream classes inherit from AuthenticatedStream and implement the Negotiate and Secure Sockets Layer security protocols, respectively.

Notes to Inheritors

The following members must be overridden in a derived class: IsAuthenticated, IsEncrypted, IsMutuallyAuthenticated, IsServer, and IsSigned.

The following code example demonstrates displaying the properties of an authenticated stream.



    // 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);
    }
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft