首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> .NET 網頁程式設計 >> 關於.NET

WCF NetTcpBinding 傳輸安全模式深度解析(一):NetTcpSecurity 核心定義與預設行為

     編輯:關於.NET

NetTcpBinding 內部透過 NetTcpSecurity 類別掌控安全模式與細節。本節剖析其類別結構、建構函式與預設屬性值,為後續實戰奠定理論基礎。

NetTcpBinding 四種建構函式

  • NetTcpBinding() — 預設初始化
  • NetTcpBinding(SecurityMode) — 指定安全模式
  • NetTcpBinding(String) — 從配置名稱初始化
  • NetTcpBinding(SecurityMode, Boolean) — 指定安全模式與是否啟用安全會話

NetTcpSecurity 類別結構(核心成員)

public sealed class NetTcpSecurity {
    internal const SecurityMode DefaultMode = SecurityMode.Transport;
    public NetTcpSecurity();
    public MessageSecurityOverTcp Message { get; set; }
    public SecurityMode Mode { get; set; }
    public TcpTransportSecurity Transport { get; set; }
}

關鍵點:靜態欄位 DefaultMode = SecurityMode.Transport 確認預設即為傳輸安全。

TcpTransportSecurity 詳細屬性與預設值

public sealed class TcpTransportSecurity {
    internal const TcpClientCredentialType DefaultClientCredentialType = TcpClientCredentialType.Windows;
    internal const ProtectionLevel DefaultProtectionLevel = ProtectionLevel.EncryptAndSign;
    
    [DefaultValue(1)] 
    public TcpClientCredentialType ClientCredentialType { get; set; }
    public ExtendedProtectionPolicy ExtendedProtectionPolicy { get; set; }
    [DefaultValue(2)]
    public ProtectionLevel ProtectionLevel { get; set; }
}
屬性預設值說明
ClientCredentialTypeWindows客戶端身分驗證憑證類型
ProtectionLevelEncryptAndSign訊息保護等級:加密並簽名
ExtendedProtectionPolicyNoneTCP 延伸保護策略(防禦認證轉發攻擊)

系列文章導覽

  1. (一)本文:NetTcpSecurity 定義與預設值
  2. (二):預設安全配置實測與 TcpTrace 驗證
  3. (三):ProtectionLevel 控制加密行為
  4. (四):Certificate 憑證驗證完整配置

掌握 NetTcpSecurity → TcpTransportSecurity 這條屬性鏈,即能精準控制 WCF TCP 傳輸的每一項安全細節。


本文部分內容改編自《.NET 安全揭秘》
作者:玄魂
出處:https://www.cnblogs.com/xuanhun/

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved