Bagikan melalui


MachineKey.Encode(Byte[], MachineKeyProtection) Metode

Definisi

Perhatian

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.

Mengenkripsi data dan/atau menambahkan kode autentikasi pesan berbasis hash (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

Parameter

data
Byte[]

Data untuk dienkripsi.

protectionOption
MachineKeyProtection

Menunjukkan apakah data parameter harus dienkripsi dan/atau di-hash.

Mengembalikan

Nilai terenkripsi, nilai input dengan HMAC ditambahkan, atau hasil mengenkripsi nilai input dengan HMAC ditambahkan.

Atribut

Contoh

Untuk contoh kode, lihat gambaran MachineKey umum kelas.

Keterangan

Untuk informasi tentang algoritma enkripsi dan hashing mana yang ASP.NET gunakan untuk mendekripsi dan memvalidasi data yang diteruskan, lihat Elemen machineKey (Skema Pengaturan ASP.NET).

Berlaku untuk