Aes 類別

定義

代表所有先進加密標準(AES)實作必須繼承的抽象基底類別。

public ref class Aes abstract : System::Security::Cryptography::SymmetricAlgorithm
public abstract class Aes : System.Security.Cryptography.SymmetricAlgorithm
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public abstract class Aes : System.Security.Cryptography.SymmetricAlgorithm
type Aes = class
    inherit SymmetricAlgorithm
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
type Aes = class
    inherit SymmetricAlgorithm
Public MustInherit Class Aes
Inherits SymmetricAlgorithm
繼承
衍生
屬性

範例

以下範例示範如何利用類別 Aes 加密與解密樣本資料。

using System;
using System.IO;
using System.Security.Cryptography;

namespace Aes_Example
{
    class AesExample
    {
        public static void Main()
        {
            string original = "Here is some data to encrypt!";

            // Create a new instance of the Aes
            // class.  This generates a new key and initialization
            // vector (IV).
            using (Aes myAes = Aes.Create())
            {

                // Encrypt the string to an array of bytes.
                byte[] encrypted = EncryptStringToBytes_Aes(original, myAes.Key, myAes.IV);

                // Decrypt the bytes to a string.
                string roundtrip = DecryptStringFromBytes_Aes(encrypted, myAes.Key, myAes.IV);

                //Display the original data and the decrypted data.
                Console.WriteLine("Original:   {0}", original);
                Console.WriteLine("Round Trip: {0}", roundtrip);
            }
        }
        static byte[] EncryptStringToBytes_Aes(string plainText, byte[] Key, byte[] IV)
        {
            // Check arguments.
            if (plainText == null || plainText.Length <= 0)
                throw new ArgumentNullException("plainText");
            if (Key == null || Key.Length <= 0)
                throw new ArgumentNullException("Key");
            if (IV == null || IV.Length <= 0)
                throw new ArgumentNullException("IV");
            byte[] encrypted;

            // Create an Aes object
            // with the specified key and IV.
            using (Aes aesAlg = Aes.Create())
            {
                aesAlg.Key = Key;
                aesAlg.IV = IV;

                // Create an encryptor to perform the stream transform.
                ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);

                // Create the streams used for encryption.
                using (MemoryStream msEncrypt = new MemoryStream())
                {
                    using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
                    {
                        using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
                        {
                            //Write all data to the stream.
                            swEncrypt.Write(plainText);
                        }
                    }

                    encrypted = msEncrypt.ToArray();
                }
            }

            // Return the encrypted bytes from the memory stream.
            return encrypted;
        }

        static string DecryptStringFromBytes_Aes(byte[] cipherText, byte[] Key, byte[] IV)
        {
            // Check arguments.
            if (cipherText == null || cipherText.Length <= 0)
                throw new ArgumentNullException("cipherText");
            if (Key == null || Key.Length <= 0)
                throw new ArgumentNullException("Key");
            if (IV == null || IV.Length <= 0)
                throw new ArgumentNullException("IV");

            // Declare the string used to hold
            // the decrypted text.
            string plaintext = null;

            // Create an Aes object
            // with the specified key and IV.
            using (Aes aesAlg = Aes.Create())
            {
                aesAlg.Key = Key;
                aesAlg.IV = IV;

                // Create a decryptor to perform the stream transform.
                ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);

                // Create the streams used for decryption.
                using (MemoryStream msDecrypt = new MemoryStream(cipherText))
                {
                    using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
                    {
                        using (StreamReader srDecrypt = new StreamReader(csDecrypt))
                        {

                            // Read the decrypted bytes from the decrypting stream
                            // and place them in a string.
                            plaintext = srDecrypt.ReadToEnd();
                        }
                    }
                }
            }

            return plaintext;
        }
    }
}
Imports System.IO
Imports System.Security.Cryptography



Class AesExample

    Public Shared Sub Main()
        Dim original As String = "Here is some data to encrypt!"

        ' Create a new instance of the Aes
        ' class.  This generates a new key and initialization 
        ' vector (IV).
        Using myAes As Aes = Aes.Create()
            ' Encrypt the string to an array of bytes.
            Dim encrypted As Byte() = EncryptStringToBytes_Aes(original, myAes.Key, myAes.IV)

            ' Decrypt the bytes to a string.
            Dim roundtrip As String = DecryptStringFromBytes_Aes(encrypted, myAes.Key, myAes.IV)

            'Display the original data and the decrypted data.
            Console.WriteLine("Original:   {0}", original)
            Console.WriteLine("Round Trip: {0}", roundtrip)
        End Using
    End Sub

    Shared Function EncryptStringToBytes_Aes(ByVal plainText As String, ByVal Key() As Byte, ByVal IV() As Byte) As Byte()
        ' Check arguments.
        If plainText Is Nothing OrElse plainText.Length <= 0 Then
            Throw New ArgumentNullException("plainText")
        End If
        If Key Is Nothing OrElse Key.Length <= 0 Then
            Throw New ArgumentNullException("Key")
        End If
        If IV Is Nothing OrElse IV.Length <= 0 Then
            Throw New ArgumentNullException("IV")
        End If
        Dim encrypted() As Byte
        
        ' Create an Aes object
        ' with the specified key and IV.
        Using aesAlg As Aes = Aes.Create()

            aesAlg.Key = Key
            aesAlg.IV = IV

            ' Create an encryptor to perform the stream transform.
            Dim encryptor As ICryptoTransform = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV)
            ' Create the streams used for encryption.
            Using msEncrypt As New MemoryStream()
                Using csEncrypt As New CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)
                    Using swEncrypt As New StreamWriter(csEncrypt)
                        'Write all data to the stream.
                        swEncrypt.Write(plainText)
                    End Using
                    encrypted = msEncrypt.ToArray()
                End Using
            End Using
        End Using

        ' Return the encrypted bytes from the memory stream.
        Return encrypted

    End Function 'EncryptStringToBytes_Aes

    Shared Function DecryptStringFromBytes_Aes(ByVal cipherText() As Byte, ByVal Key() As Byte, ByVal IV() As Byte) As String
        ' Check arguments.
        If cipherText Is Nothing OrElse cipherText.Length <= 0 Then
            Throw New ArgumentNullException("cipherText")
        End If
        If Key Is Nothing OrElse Key.Length <= 0 Then
            Throw New ArgumentNullException("Key")
        End If
        If IV Is Nothing OrElse IV.Length <= 0 Then
            Throw New ArgumentNullException("IV")
        End If
        ' Declare the string used to hold
        ' the decrypted text.
        Dim plaintext As String = Nothing

        ' Create an Aes object
        ' with the specified key and IV.
        Using aesAlg As Aes = Aes.Create()
            aesAlg.Key = Key
            aesAlg.IV = IV

            ' Create a decryptor to perform the stream transform.
            Dim decryptor As ICryptoTransform = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV)

            ' Create the streams used for decryption.
            Using msDecrypt As New MemoryStream(cipherText)

                Using csDecrypt As New CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)

                    Using srDecrypt As New StreamReader(csDecrypt)


                        ' Read the decrypted bytes from the decrypting stream
                        ' and place them in a string.
                        plaintext = srDecrypt.ReadToEnd()
                    End Using
                End Using
            End Using
        End Using

        Return plaintext

    End Function 'DecryptStringFromBytes_Aes 
End Class
open System
open System.IO
open System.Security.Cryptography

let encryptStringToBytes_Aes (plainText: string, key : byte[], iv : byte[]) : byte[] =

    // Check arguments.
    if (isNull plainText || plainText.Length <= 0) then nullArg "plainText"
    if (isNull key || key.Length <= 0) then nullArg "key"
    if (isNull iv || iv.Length <= 0) then nullArg "iv"
    
    // Create an Aes object
    // with the specified key and IV.
    use aesAlg = Aes.Create()
    aesAlg.Key <- key
    aesAlg.IV <- iv

    // Create an encryptor to perform the stream transform.
    let encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV)

    // Create the streams used for encryption.
    use msEncrypt = new MemoryStream()
    use csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)
    use swEncrypt = new StreamWriter(csEncrypt)
    
    //Write all data to the stream.
    swEncrypt.Write(plainText)
    swEncrypt.Flush()
    
    // Return the encrypted bytes from the memory stream.
    msEncrypt.ToArray()

let decryptStringFromBytes_Aes (cipherText : byte[], key : byte[], iv : byte[]) : string =

    // Check arguments.
    if (isNull cipherText || cipherText.Length <= 0) then nullArg "cipherText"
    if (isNull key || key.Length <= 0) then nullArg "key"
    if (isNull iv || iv.Length <= 0) then nullArg "iv"

    // Create an Aes object
    // with the specified key and IV.
    use aesAlg = Aes.Create()
    aesAlg.Key <- key
    aesAlg.IV <- iv

    // Create a decryptor to perform the stream transform.
    let decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV)

    // Create the streams used for decryption.
    use msDecrypt = new MemoryStream(cipherText)
    use csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)
    use srDecrypt = new StreamReader(csDecrypt)

    // Read the decrypted bytes from the decrypting stream
    // and return the resulting string.
    srDecrypt.ReadToEnd()

[<EntryPoint>]
let main argv = 

    let original = "Here is some data to encrypt!"

    // Create a new instance of the Aes
    // class.  This generates a new key and initialization 
    // vector (IV).
    use myAes = Aes.Create()

    // Encrypt the string to an array of bytes.
    let encrypted = encryptStringToBytes_Aes(original, myAes.Key, myAes.IV)

    // Decrypt the bytes to a string.
    let roundtrip = decryptStringFromBytes_Aes(encrypted, myAes.Key, myAes.IV)

    //Display the original data and the decrypted data.
    Console.WriteLine("Original:   {0}", original)
    Console.WriteLine("Round Trip: {0}", roundtrip)
    0

建構函式

名稱 Description
Aes()

初始化 Aes 類別的新執行個體。

欄位

名稱 Description
BlockSizeValue

代表密碼運算的區塊大小(位元)。

(繼承來源 SymmetricAlgorithm)
FeedbackSizeValue

代表密碼運算的反饋大小(位元)。

(繼承來源 SymmetricAlgorithm)
IVValue

代表對稱演算法的初始化向量(IV)。

(繼承來源 SymmetricAlgorithm)
KeySizeValue

代表對稱演算法所使用的秘密金鑰的大小(以位元為單位)。

(繼承來源 SymmetricAlgorithm)
KeyValue

代表對稱演算法的祕密金鑰。

(繼承來源 SymmetricAlgorithm)
LegalBlockSizesValue

指定對稱演算法所支援的區塊大小(位元)。

(繼承來源 SymmetricAlgorithm)
LegalKeySizesValue

指定對稱演算法所支援的金鑰大小(位元)。

(繼承來源 SymmetricAlgorithm)
ModeValue

代表對稱演算法中使用的密碼模式。

(繼承來源 SymmetricAlgorithm)
PaddingValue

代表對稱演算法中使用的填充模式。

(繼承來源 SymmetricAlgorithm)

屬性

名稱 Description
BlockSize

取得或設定密碼運算的區塊大小(位元)。

(繼承來源 SymmetricAlgorithm)
FeedbackSize

取得或設定密碼反饋(CFB)與輸出反饋(OFB)密碼模式的反饋大小(位元)。

(繼承來源 SymmetricAlgorithm)
IV

取得或設定對稱演算法的初始化向量(IV)。

(繼承來源 SymmetricAlgorithm)
Key

取得或設定對稱演算法的祕密金鑰。

(繼承來源 SymmetricAlgorithm)
KeySize

取得或設定對稱演算法所使用的秘密金鑰的大小(以位元為單位)。

(繼承來源 SymmetricAlgorithm)
LegalBlockSizes

取得對稱演算法所支援的區塊大小(位元)。

LegalBlockSizes

取得對稱演算法所支援的區塊大小(位元)。

(繼承來源 SymmetricAlgorithm)
LegalKeySizes

取得對稱演算法所支援的金鑰大小(位元)。

LegalKeySizes

取得對稱演算法所支援的金鑰大小(位元)。

(繼承來源 SymmetricAlgorithm)
Mode

取得或設定對稱演算法的運作模式。

(繼承來源 SymmetricAlgorithm)
Padding

取得或設定對稱演算法中使用的填充模式。

(繼承來源 SymmetricAlgorithm)

方法

名稱 Description
Clear()

釋放 SymmetricAlgorithm 類別所使用的所有資源。

(繼承來源 SymmetricAlgorithm)
Create()

建立一個用於執行對稱演算法的密碼物件。

Create(String)
已淘汰.

建立一個密碼物件,指定用於執行對稱演算法的 AES 實作方式。

CreateDecryptor()

建立一個對稱解密物件,其目前 Key 屬性與初始化向量IV()。

(繼承來源 SymmetricAlgorithm)
CreateDecryptor(Byte[], Byte[])

當在導出類別中覆寫時,會產生具有指定 Key 性質和初始化向量(IV)的對稱解密物件。

(繼承來源 SymmetricAlgorithm)
CreateEncryptor()

建立一個對稱加密物件,其目前 Key 屬性為 ,初始化向量為 (IV)。

(繼承來源 SymmetricAlgorithm)
CreateEncryptor(Byte[], Byte[])

當在派生類別中覆寫時,會產生具有指定 Key 屬性和初始化向量(IV)的對稱加密物件。

(繼承來源 SymmetricAlgorithm)
DecryptCbc(Byte[], Byte[], PaddingMode)

透過指定的填充模式(CBC)解密資料。

(繼承來源 SymmetricAlgorithm)
DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode)

透過指定的填充模式(CBC)解密資料。

(繼承來源 SymmetricAlgorithm)
DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)

將資料解密到指定的緩衝區,使用 CBC 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
DecryptCfb(Byte[], Byte[], PaddingMode, Int32)

透過CFB模式解密資料,並依照指定的填充模式和回饋大小進行解密。

(繼承來源 SymmetricAlgorithm)
DecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode, Int32)

透過CFB模式解密資料,並依照指定的填充模式和回饋大小進行解密。

(繼承來源 SymmetricAlgorithm)
DecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

將資料解密到指定的緩衝區,使用CFB模式,並使用指定的填充模式和回饋大小。

(繼承來源 SymmetricAlgorithm)
DecryptEcb(Byte[], PaddingMode)

透過ECB模式及指定的填充模式解密資料。

(繼承來源 SymmetricAlgorithm)
DecryptEcb(ReadOnlySpan<Byte>, PaddingMode)

透過ECB模式及指定的填充模式解密資料。

(繼承來源 SymmetricAlgorithm)
DecryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)

將資料解密到指定的緩衝區,使用 ECB 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
DecryptKeyWrapPadded(Byte[])

解封使用 IETF RFC 5649 AES 金鑰包裝帶填充演算法所包裝的密鑰。

DecryptKeyWrapPadded(ReadOnlySpan<Byte>, Span<Byte>)

解封使用 IETF RFC 5649 AES 金鑰包裝帶填充演算法所包裝的密鑰。

DecryptKeyWrapPadded(ReadOnlySpan<Byte>)

解封使用 IETF RFC 5649 AES 金鑰包裝帶填充演算法所包裝的密鑰。

DecryptKeyWrapPaddedCore(ReadOnlySpan<Byte>, Span<Byte>)

解封使用 IETF RFC 5649 AES 金鑰包裝帶填充演算法所包裝的密鑰。

Dispose()

釋放目前類別實例 SymmetricAlgorithm 所使用的所有資源。

(繼承來源 SymmetricAlgorithm)
Dispose(Boolean)

釋放 未管理的資源, SymmetricAlgorithm 並可選擇性地釋放受管理資源。

(繼承來源 SymmetricAlgorithm)
EncryptCbc(Byte[], Byte[], PaddingMode)

以 CBC 模式並指定填充模式加密資料。

(繼承來源 SymmetricAlgorithm)
EncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode)

以 CBC 模式並指定填充模式加密資料。

(繼承來源 SymmetricAlgorithm)
EncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)

將資料加密到指定的緩衝區,使用 CBC 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
EncryptCfb(Byte[], Byte[], PaddingMode, Int32)

使用CFB模式加密資料,並配合指定的填充模式與回饋大小。

(繼承來源 SymmetricAlgorithm)
EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode, Int32)

使用CFB模式加密資料,並配合指定的填充模式與回饋大小。

(繼承來源 SymmetricAlgorithm)
EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

將資料加密到指定的緩衝區,使用 CFB 模式,並符合指定的填充模式與反饋大小。

(繼承來源 SymmetricAlgorithm)
EncryptEcb(Byte[], PaddingMode)

以ECB模式加密資料,並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
EncryptEcb(ReadOnlySpan<Byte>, PaddingMode)

以ECB模式加密資料,並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
EncryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)

將資料加密到指定的緩衝區,使用 ECB 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
EncryptKeyWrapPadded(Byte[])

使用 IETF RFC 5649 AES 金鑰包裝演算法(含填充)包裝金鑰。

EncryptKeyWrapPadded(ReadOnlySpan<Byte>, Span<Byte>)

使用 IETF RFC 5649 AES 金鑰包裝演算法(含填充)包裝金鑰,並將結果寫入指定的緩衝區。

EncryptKeyWrapPadded(ReadOnlySpan<Byte>)

使用 IETF RFC 5649 AES 金鑰包裝演算法(含填充)包裝金鑰。

EncryptKeyWrapPaddedCore(ReadOnlySpan<Byte>, Span<Byte>)

使用 IETF RFC 5649 AES 金鑰包裝演算法(含填充)包裝金鑰,並將結果寫入指定的緩衝區。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GenerateIV()

當在導出類別中覆寫時,會產生一個隨機初始化向量(IV)作為演算法的使用。

(繼承來源 SymmetricAlgorithm)
GenerateKey()

當在導出類別中覆寫時,會產生一個隨機鍵(Key)用於該演算法。

(繼承來源 SymmetricAlgorithm)
GetCiphertextLengthCbc(Int32, PaddingMode)

取得密文在特定填充模式下的長度,以及在 CBC 模式下的明文長度。

(繼承來源 SymmetricAlgorithm)
GetCiphertextLengthCfb(Int32, PaddingMode, Int32)

取得密文在特定填充模式下的長度,以及在 CFB 模式下的明文長度。

(繼承來源 SymmetricAlgorithm)
GetCiphertextLengthEcb(Int32, PaddingMode)

取得密文在特定填充模式下的長度,以及在 ECB 模式下的明文長度。

(繼承來源 SymmetricAlgorithm)
GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetKeyWrapPaddedLength(Int32)

計算IETF RFC 5649 AES金鑰包裝與填充演算法中,針對指定明文長度的輸出長度。

GetType()

取得目前實例的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
SetKey(ReadOnlySpan<Byte>)

設定此實例的金鑰。

(繼承來源 SymmetricAlgorithm)
SetKeyCore(ReadOnlySpan<Byte>)

設定此實例的金鑰。

(繼承來源 SymmetricAlgorithm)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)
TryDecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode)

嘗試將資料解密到指定的緩衝區,使用 CBC 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

當在派生類別中被覆寫時,會嘗試將資料解密到指定的緩衝區,使用 CBC 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
TryDecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode, Int32)

嘗試將資料解密到指定的緩衝區,使用指定的填充模式與反饋大小的 CFB 模式。

(繼承來源 SymmetricAlgorithm)
TryDecryptCfbCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32, Int32)

當在派生類別中覆寫時,嘗試將資料解密到指定的緩衝區,使用指定的填充模式與反饋大小的 CFB 模式。

(繼承來源 SymmetricAlgorithm)
TryDecryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

嘗試將資料解密到指定的緩衝區,使用 ECB 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
TryDecryptEcbCore(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

當在派生類別中覆寫時,會嘗試將資料解密到指定的緩衝區,使用 ECB 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
TryDecryptKeyWrapPadded(ReadOnlySpan<Byte>, Span<Byte>, Int32)

嘗試解封使用 IETF RFC 5649 AES 金鑰包裝與填充演算法所包裝的金鑰。

TryEncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode)

嘗試將資料加密到指定的緩衝區,使用 CBC 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
TryEncryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

當在派生類別中覆寫時,會嘗試將資料加密到指定的緩衝區,使用 CBC 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
TryEncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode, Int32)

嘗試將資料加密到指定的緩衝區,使用指定的填充模式與反饋大小的 CFB 模式。

(繼承來源 SymmetricAlgorithm)
TryEncryptCfbCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32, Int32)

當在派生類別中覆寫時,嘗試將資料加密到指定的緩衝區,使用 CFB 模式,並搭配指定的填充模式和反饋大小。

(繼承來源 SymmetricAlgorithm)
TryEncryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

嘗試將資料加密到指定的緩衝區,使用 ECB 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
TryEncryptEcbCore(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

當在派生類別中覆寫時,會嘗試將資料加密到指定的緩衝區,使用 ECB 模式並搭配指定的填充模式。

(繼承來源 SymmetricAlgorithm)
ValidKeySize(Int32)

判斷指定金鑰大小是否適用於目前演算法。

(繼承來源 SymmetricAlgorithm)

明確介面實作

名稱 Description
IDisposable.Dispose()

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

釋放 未管理的資源, SymmetricAlgorithm 並可選擇性地釋放受管理資源。

(繼承來源 SymmetricAlgorithm)

適用於