CipherAlgorithmType 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为 SslStream 类定义可能的密码算法。
public enum class CipherAlgorithmType
public enum CipherAlgorithmType
type CipherAlgorithmType =
Public Enum CipherAlgorithmType
- 继承
字段
Aes | 26129 | 高级加密标准 (AES) 算法。 |
Aes128 | 26126 | 具有 128 位密钥的高级加密标准 (AES) 算法。 |
Aes192 | 26127 | 具有 192 位密钥的高级加密标准 (AES) 算法。 |
Aes256 | 26128 | 具有 256 位密钥的高级加密标准 (AES) 算法。 |
Des | 26113 | 数据加密标准 (DES) 算法。 |
None | 0 | 未使用加密算法。 |
Null | 24576 | 没有哪种加密是使用的 Null 密码算法。 |
Rc2 | 26114 | Rivest 代码 2 (RC2) 算法。 |
Rc4 | 26625 | Rivest 代码 4 (RC4) 算法。 |
TripleDes | 26115 | 三重数据加密标准 (3DES) 算法。 |
示例
以下示例显示一个 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 。