Exportar (0) Imprimir
Expandir todo

ExchangeAlgorithmType (Enumeración)

Actualización: noviembre 2007

Especifica el algoritmo utilizado para crear claves compartidas por el cliente y el servidor.

Espacio de nombres:  System.Security.Authentication
Ensamblado:  System (en System.dll)

public enum ExchangeAlgorithmType
public enum ExchangeAlgorithmType
public enum ExchangeAlgorithmType

Nombre de miembroDescripción
NoneNo se utiliza ningún algoritmo de intercambio de claves.
RsaSignAlgoritmo de firma de clave pública RSA.
RsaKeyXAlgoritmo de intercambio de clave pública RSA.
DiffieHellmanAlgoritmo de intercambio de clave efímera Diffie Hellman.

Esta enumeración especifica los valores válidos para la propiedad SslStream.KeyExchangeAlgorithm.

En el siguiente ejemplo se muestran las propiedades de SslStream.

static void AuthenticateCallback(IAsyncResult ar)
{
    SslStream stream = (SslStream) ar.AsyncState;
    try 
    {
        stream.EndAuthenticateAsClient(ar);
        Console.WriteLine("Authentication succeeded.");
        Console.WriteLine("Cipher: {0} strength {1}", stream.CipherAlgorithm, 
            stream.CipherStrength);
        Console.WriteLine("Hash: {0} strength {1}", 
            stream.HashAlgorithm, stream.HashStrength);
        Console.WriteLine("Key exchange: {0} strength {1}", 
            stream.KeyExchangeAlgorithm, stream.KeyExchangeStrength);
        Console.WriteLine("Protocol: {0}", stream.SslProtocol);
        // Encode a test message into a byte array.
        // Signal the end of the message using the "<EOF>".
        byte[] message = Encoding.UTF8.GetBytes("Hello from the client.<EOF>");
        // Asynchronously send a message to the server.
        stream.BeginWrite(message, 0, message.Length, 
            new AsyncCallback(WriteCallback),
            stream);
    }
    catch (Exception authenticationException)
    {
        e = authenticationException;
        complete = true;
        return;
    }
}


static void AuthenticateCallback(IAsyncResult ar) throws System.Exception
{
    SslStream stream = (SslStream)(ar.get_AsyncState());
    try {
        stream.EndAuthenticateAsClient(ar);
        Console.WriteLine("Authentication succeeded.");
        Console.WriteLine("Cipher: {0} strength {1}", 
            stream.get_CipherAlgorithm(), 
            System.Convert.ToString(stream.get_CipherStrength()));
        Console.WriteLine("Hash: {0} strength {1}", 
            stream.get_HashAlgorithm(), 
            System.Convert.ToString(stream.get_HashStrength()));
        Console.WriteLine("Key exchange: {0} strength {1}", 
            stream.get_KeyExchangeAlgorithm(), 
            System.Convert.ToString(stream.get_KeyExchangeStrength()));
        Console.WriteLine("Protocol: {0}", stream.get_SslProtocol());
        // Encode a test message into a byte array.
        // Signal the end of the message using the "<EOF>".
        ubyte message[] = Encoding.get_UTF8().GetBytes(
            "Hello from the client.<EOF>");
        // Asynchronously send a message to the server.
        stream.BeginWrite(message, 0, message.get_Length(), 
            new AsyncCallback(WriteCallback), stream);
    }
    catch (System.Exception authenticationException) {
        e = (Exception)authenticationException;
        complete = true;
        return;
    }
} //AuthenticateCallback


Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

.NET Framework

Compatible con: 3.5, 3.0, 2.0

Adiciones de comunidad

AGREGAR
Mostrar:
© 2014 Microsoft