Secure Streams Sample

This sample shows how to use a secure stream to communicate between a client and a server. The sample comprises two client and two server applications. One client-server pair (NegotiateClient and NegotiateServer) uses the Negotiate security protocol for authentication, and the other (SSLClient and SSLServer) uses the Secure Sockets Layer (SSL) for communication.

For information about using the samples, see the following topics:

To build the sample using the command prompt

  1. Open a command prompt and navigate to one of the language-specific subdirectories under the SecureStreams directory. For information about required settings and the SDK command prompt, see How to: Set Sample Settings.

  2. Type msbuild SecureStreams.sln at the command line.

    NoteNote

    Before you build the application, edit NegotiateClient.cs to specify the Service Principal Name (SPN) for your network in order to use Kerberos authentication.

To build the sample using Visual Studio

  1. Open Windows Explorer and navigate to one of the language-specific subdirectories under the SecureStreams directory.

  2. Double-click the icon for the SecureStreams.sln to open the file in Visual Studio.

  3. On the Build menu, click Build Solution.

    The application is built in the default \bin\Debug directory.

To run the Negotiate client-server sample

  1. Navigate to the directory that contains the new executable for NegotiateServer, using the command prompt.

  2. Type NegotiateServer.exe at the command line.

  3. Navigate to the directory that contains the new executable for NegotiateClient, using the command prompt.

  4. Type NegotiateClient.exe at the command line.

    NoteNote

    The sample builds a console application. You must launch and run it from a command prompt to view its output.

To run the SSL client-server sample

  1. Navigate to the directory that contains the new executable for SSLServer, using the command prompt.

  2. Type SSLServer.exe at the command line.

  3. Navigate to the directory that contains the new executable for NegotiateClient, using the command prompt.

  4. Type SSLClient.exe at the command line.

    NoteNote

    The sample builds a console application. You must launch and run it from a command prompt to view its output.

Remarks

For SSL, the server must be able to find an exported certificate file named exportedcertificate.cer. This file must contain a certificate with a public key that is the same as that found in the local certificate store.

See Also

Reference

NegotiateStream
SslStream