CipherAlgorithmType Wyliczenie

Definicja

Definiuje możliwe algorytmy szyfrowania dla SslStream klasy .

public enum class CipherAlgorithmType
public enum CipherAlgorithmType
type CipherAlgorithmType = 
Public Enum CipherAlgorithmType
Dziedziczenie
CipherAlgorithmType

Pola

Aes 26129

Algorytm AES (Advanced Encryption Standard).

Aes128 26126

Algorytm Advanced Encryption Standard (AES) z 128-bitowym kluczem.

Aes192 26127

Algorytm Advanced Encryption Standard (AES) z 192-bitowym kluczem.

Aes256 26128

Algorytm Advanced Encryption Standard (AES) z 256-bitowym kluczem.

Des 26113

Algorytm szyfrowania danych w warstwie Standardowa (DES).

None 0

Nie jest używany żaden algorytm szyfrowania.

Null 24576

Żadne szyfrowanie nie jest używane z algorytmem szyfrowania null.

Rc2 26114

Algorytm kodu 2 (RC2) języka Rivest.

Rc4 26625

Algorytm Code 4 (RC4) firmy Rivest.

TripleDes 26115

Algorytm Triple Data Encryption Standard (3DES).

Przykłady

W poniższym przykładzie są wyświetlane właściwości obiektu SslStream.

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

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

Uwagi

Wyliczenie określa prawidłowe wartości właściwości SslStream.CipherAlgorithm .

Dotyczy

Zobacz też