MachineKey 類別

定義

提供將資料進行加密或雜湊 (或兩者都進行) 的方法,採用 ASP.NET 表單驗證和檢視狀態所使用的相同演算法和金鑰值。Provides a way to encrypt or hash data (or both) by using the same algorithms and key values that are used for ASP.NET forms authentication and view state.

public ref class MachineKey abstract sealed
public static class MachineKey
type MachineKey = class
Public Class MachineKey
繼承
MachineKey

備註

MachineKey類別提供的方法會公開 ASP.NET 提供的雜湊和加密邏輯。The MachineKey class provides methods that expose the hashing and encryption logic that ASP.NET provides. 如需 ASP.NET 所使用的加密和雜湊演算法,以及其搭配使用的索引鍵值的詳細資訊,請參閱 MachineKey 元素 (ASP.NET 設定架構) For information about which encryption and hashing algorithms ASP.NET uses, and the key values that it uses with them, see machineKey Element (ASP.NET Settings Schema).

警告

MachineKeyApi 只能在 ASP.NET 應用程式中使用。The MachineKey APIs should only be used in an ASP.NET app. 未定義 ASP.NET 應用程式內容外 MachineKey Api 的行為Behavior of the MachineKey APIs outside the context of an ASP.NET application is undefined

方法

Decode(String, MachineKeyProtection)
已過時。

解碼和 (或) 驗證已加密或隨附雜湊式訊息驗證碼 (HMAC) 的資料。Decodes and/or validates data that has been encrypted or provided with a hash-based message authentication code (HMAC).

Encode(Byte[], MachineKeyProtection)
已過時。

加密資料和 (或) 附加雜湊式訊息驗證碼 (HMAC)。Encrypts data and/or appends a hash-based message authentication code (HMAC).

Protect(Byte[], String[])

藉由加密或簽署的方式保護資料。Protects the specified data by encrypting or signing it.

Unprotect(Byte[], String[])

取消保護指定的資料,此資料受 Protect(Byte[], String[]) 方法保護。Unprotects the specified data, which was protected by the Protect(Byte[], String[]) method.

適用於