다음을 통해 공유


HashAlgorithmType 열거형

정의

주의

KeyExchangeAlgorithm, KeyExchangeStrength, CipherAlgorithm, CipherStrength, HashAlgorithm and HashStrength properties of SslStream are obsolete. Use NegotiatedCipherSuite instead.

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

public enum class HashAlgorithmType
public enum HashAlgorithmType
[System.Obsolete("KeyExchangeAlgorithm, KeyExchangeStrength, CipherAlgorithm, CipherStrength, HashAlgorithm and HashStrength properties of SslStream are obsolete. Use NegotiatedCipherSuite instead.", DiagnosticId="SYSLIB0058", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public enum HashAlgorithmType
type HashAlgorithmType = 
[<System.Obsolete("KeyExchangeAlgorithm, KeyExchangeStrength, CipherAlgorithm, CipherStrength, HashAlgorithm and HashStrength properties of SslStream are obsolete. Use NegotiatedCipherSuite instead.", DiagnosticId="SYSLIB0058", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type HashAlgorithmType = 
Public Enum HashAlgorithmType
상속
HashAlgorithmType
특성

필드

Name Description
None 0

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

Md5 32771

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

MD5와의 충돌 문제로 인해 MICROSOFT는 SHA-256을 권장합니다.

Sha1 32772

SHA1(보안 해시 알고리즘)입니다.

SHA-1의 충돌 문제로 인해 Microsoft는 SHA-256을 권장합니다.

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 값을 지정합니다.

적용 대상

추가 정보