SslStream.CipherAlgorithm 属性

定义

获取一个值,该值确定此 SslStream 使用的批量加密算法。

public:
 virtual property System::Security::Authentication::CipherAlgorithmType CipherAlgorithm { System::Security::Authentication::CipherAlgorithmType get(); };
public virtual System.Security.Authentication.CipherAlgorithmType CipherAlgorithm { get; }
member this.CipherAlgorithm : System.Security.Authentication.CipherAlgorithmType
Public Overridable ReadOnly Property CipherAlgorithm As CipherAlgorithmType

属性值

一个 值,该值标识此 SslStream使用的批量加密算法。

例外

CipherAlgorithm 属性是在身份验证过程未完成时访问的或者身份验证过程失败。

示例

下面的代码示例显示指定流的加密设置。

static void DisplaySecurityLevel( SslStream^ stream )
{
   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 );
}
static void DisplaySecurityLevel(SslStream stream)
{
   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);
}
Private Shared Sub DisplaySecurityLevel(stream As SslStream)
    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)
End Sub

注解

使用枚举值Null构造SslStream实例时,NoEncryption属性需要 CipherAlgorithm 值。

Windows Server 2003 和 Windows XP 不支持 Null 值。 因此, Null 即使值用于构造 SslStream 实例,属性 EncryptionPolicy 也将为 None。 该值 Null 仅在 Windows Vista 及更高版本上返回。

适用于