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 使用哪些加密與雜湊演算法來解密與驗證傳入資料,請參見 機器鍵元素(ASP.NET 設定結構)。