MachineKey.Encode(Byte[], MachineKeyProtection) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
警告
This method is obsolete and is only provided for compatibility with existing code. It is recommended that new code use the Protect and Unprotect methods instead.
加密資料和 (或) 附加雜湊式訊息驗證碼 (HMAC)。
public:
static System::String ^ Encode(cli::array <System::Byte> ^ data, System::Web::Security::MachineKeyProtection protectionOption);
public static string Encode (byte[] data, System.Web.Security.MachineKeyProtection protectionOption);
[System.Obsolete("This method is obsolete and is only provided for compatibility with existing code. It is recommended that new code use the Protect and Unprotect methods instead.")]
public static string Encode (byte[] data, System.Web.Security.MachineKeyProtection protectionOption);
static member Encode : byte[] * System.Web.Security.MachineKeyProtection -> string
[<System.Obsolete("This method is obsolete and is only provided for compatibility with existing code. It is recommended that new code use the Protect and Unprotect methods instead.")>]
static member Encode : byte[] * System.Web.Security.MachineKeyProtection -> string
Public Shared Function Encode (data As Byte(), protectionOption As MachineKeyProtection) As String
參數
- data
- Byte[]
要加密的資料。
- protectionOption
- MachineKeyProtection
指示 data
參數是否應該加密和 (或) 雜湊處理。
傳回
加密值、已附加 HMAC 的輸入值,或已附加 HMAC 之輸入值的加密結果。
- 屬性
範例
如需程式代碼範例,請參閱 類別概 MachineKey 觀。
備註
如需 ASP.NET 用來解密和驗證傳入之數據的加密和哈希演演算法相關信息,請參閱 machineKey 元素 (ASP.NET 設定架構) 。