共用方式為


SslStream.IsEncrypted 屬性

定義

取得 Boolean 值,指示這個 SslStream 是否使用資料加密。

public:
 virtual property bool IsEncrypted { bool get(); };
public override bool IsEncrypted { get; }
member this.IsEncrypted : bool
Public Overrides ReadOnly Property IsEncrypted As Boolean

屬性值

如果資料在透過網路傳輸之前加密,並在到達遠端端點時解密,則為 true,否則為 false

範例

下列程式代碼範例示範如何顯示這個屬性的值。

static void DisplaySecurityServices( SslStream^ stream )
{
   Console::WriteLine( L"Is authenticated: {0} as server? {1}", stream->IsAuthenticated, stream->IsServer );
   Console::WriteLine( L"IsSigned: {0}", stream->IsSigned );
   Console::WriteLine( L"Is Encrypted: {0}", stream->IsEncrypted );
   Console::WriteLine( L"Is mutually authenticated: {0}", stream->IsMutuallyAuthenticated );
}
static void DisplaySecurityServices(SslStream stream)
{
   Console.WriteLine("Is authenticated: {0} as server? {1}", stream.IsAuthenticated, stream.IsServer);
   Console.WriteLine("IsSigned: {0}", stream.IsSigned);
   Console.WriteLine("Is Encrypted: {0}", stream.IsEncrypted);
   Console.WriteLine("Is mutually authenticated: {0}", stream.IsMutuallyAuthenticated);
}
Private Shared Sub DisplaySecurityServices(stream As SslStream)
    Console.WriteLine("Is authenticated: {0} as server? {1}", stream.IsAuthenticated, stream.IsServer)
    Console.WriteLine("IsSigned: {0}", stream.IsSigned)
    Console.WriteLine("Is Encrypted: {0}", stream.IsEncrypted)
    Console.WriteLine("Is mutually authenticated: {0}", stream.IsMutuallyAuthenticated)
End Sub

備註

加密有助於保護數據的隱私權,也就是有助於確保數據在傳輸中時,無法由第三方解密。

適用於