CipherAlgorithmType Enumeração
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Define os possíveis algoritmos de cifra para a SslStream classe.
public enum class CipherAlgorithmType
public enum CipherAlgorithmType
type CipherAlgorithmType =
Public Enum CipherAlgorithmType
- Herança
Campos
| Name | Valor | Description |
|---|---|---|
| None | 0 | Não é utilizado nenhum algoritmo de encriptação. |
| Null | 24576 | Não é usada encriptação com um algoritmo de cifra nula. |
| Des | 26113 | O algoritmo Data Encryption Standard (DES). |
| Rc2 | 26114 | Algoritmo Code 2 (RC2) de Rivest. |
| TripleDes | 26115 | O algoritmo Triple Data Encryption Standard (3DES). |
| Aes128 | 26126 | O algoritmo Advanced Encryption Standard (AES) com uma chave de 128 bits. |
| Aes192 | 26127 | O algoritmo Advanced Encryption Standard (AES) com uma chave de 192 bits. |
| Aes256 | 26128 | O algoritmo Advanced Encryption Standard (AES) com uma chave de 256 bits. |
| Aes | 26129 | O algoritmo Advanced Encryption Standard (AES). |
| Rc4 | 26625 | Algoritmo Código 4 (RC4) de Rivest. |
Exemplos
O exemplo seguinte apresenta as propriedades de um 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;
}
}
Observações
Esta enumeração especifica valores válidos para a SslStream.CipherAlgorithm propriedade.