HashAlgorithmType 열거형

정의

메시지 인증 코드(MAC) 생성에 사용되는 알고리즘을 지정합니다.

public enum class HashAlgorithmType
public enum HashAlgorithmType
type HashAlgorithmType = 
Public Enum HashAlgorithmType
상속
HashAlgorithmType

필드

Md5 32771

MD5(메시지 다이제스트 5) 해시 알고리즘입니다.

MD5 관련 충돌 문제로 인해 SHA256을 사용하는 것이 좋습니다.

None 0

해시 알고리즘이 사용되지 않습니다.

Sha1 32772

SHA1(Secure Hash Algorithm)입니다.

SHA1 관련 충돌 문제로 인해 SHA256을 사용하는 것이 좋습니다.

Sha256 32780

256비트 다이제스트를 사용하는 SHA-2(Secure Hashing Algorithm 2)입니다.

Sha384 32781

384비트 다이제스트를 사용하는 SHA-2(Secure Hashing Algorithm 2)입니다.

Sha512 32782

512비트 다이제스트를 사용하는 SHA-2(Secure Hashing Algorithm 2)입니다.

예제

다음 예제에서는 인증이 성공한 후 의 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.HashAlgorithm 속성입니다.

적용 대상

추가 정보