HashAlgorithmType 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
MAC(메시지 인증 코드)를 생성하는 데 사용되는 알고리즘을 지정합니다.
public enum class HashAlgorithmType
public enum HashAlgorithmType
type HashAlgorithmType =
Public Enum 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 값을 지정합니다.