HashAlgorithmType 列挙型
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
メッセージ認証コード (MAC) の生成に使用するアルゴリズムを指定します。
public enum class HashAlgorithmType
public enum HashAlgorithmType
type HashAlgorithmType =
Public Enum HashAlgorithmType
- 継承
フィールド
| 名前 | 値 | 説明 |
|---|---|---|
| None | 0 | ハッシュ アルゴリズムは使用されません。 |
| Md5 | 32771 | メッセージ ダイジェスト 5 (MD5) ハッシュ アルゴリズム。 MD5 の衝突の問題のため、Microsoft では SHA-256 をお勧めします。 |
| Sha1 | 32772 | セキュリティで保護されたハッシュ アルゴリズム (SHA1)。 SHA-1 の競合の問題のため、Microsoft では SHA-256 をお勧めします。 |
| Sha256 | 32780 | 256 ビット ダイジェストを使用するセキュア ハッシュ アルゴリズム 2 (SHA-2)。 |
| Sha384 | 32781 | 384 ビット ダイジェストを使用したセキュア ハッシュ アルゴリズム 2 (SHA-2)。 |
| Sha512 | 32782 | 512 ビット ダイジェストを使用するセキュア ハッシュ アルゴリズム 2 (SHA-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 プロパティの有効な値を指定します。