CipherAlgorithmType CipherAlgorithmType CipherAlgorithmType CipherAlgorithmType Enum

定义

SslStream 类定义可能的密码算法。Defines the possible cipher algorithms for the SslStream class.

public enum class CipherAlgorithmType
public enum CipherAlgorithmType
type CipherAlgorithmType = 
Public Enum CipherAlgorithmType
继承
CipherAlgorithmTypeCipherAlgorithmTypeCipherAlgorithmTypeCipherAlgorithmType

字段

Aes Aes Aes Aes 26129

高级加密标准 (AES) 算法。The Advanced Encryption Standard (AES) algorithm.

Aes128 Aes128 Aes128 Aes128 26126

具有 128 位密钥的高级加密标准 (AES) 算法。The Advanced Encryption Standard (AES) algorithm with a 128 bit key.

Aes192 Aes192 Aes192 Aes192 26127

具有 192 位密钥的高级加密标准 (AES) 算法。The Advanced Encryption Standard (AES) algorithm with a 192 bit key.

Aes256 Aes256 Aes256 Aes256 26128

具有 256 位密钥的高级加密标准 (AES) 算法。The Advanced Encryption Standard (AES) algorithm with a 256 bit key.

Des Des Des Des 26113

数据加密标准 (DES) 算法。The Data Encryption Standard (DES) algorithm.

None None None None 0

未使用加密算法。No encryption algorithm is used.

Null Null Null Null 24576

没有哪种加密是使用的 Null 密码算法。No encryption is used with a Null cipher algorithm.

Rc2 Rc2 Rc2 Rc2 26114

Rivest 代码 2 (RC2) 算法。Rivest's Code 2 (RC2) algorithm.

Rc4 Rc4 Rc4 Rc4 26625

Rivest 代码 4 (RC4) 算法。Rivest's Code 4 (RC4) algorithm.

TripleDes TripleDes TripleDes TripleDes 26115

三重数据加密标准 (3DES) 算法。The Triple Data Encryption Standard (3DES) algorithm.

示例

下面的示例显示的属性SslStreamThe following example displays the properties of an 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;
    }
}

注解

此枚举指定SslStream.CipherAlgorithm属性的有效值。This enumeration specifies valid values for the SslStream.CipherAlgorithm property.

适用于

另请参阅