RSA 類別

定義

代表所有演算法實作 RSA 繼承的基底類別。

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

備註

鼓勵開發者針對 RSA 基底類別而非特定派生類別進行程式設計。 衍生類別旨在與底層系統密碼函式庫互通。

建構函式

名稱 Description
RSA()

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

欄位

名稱 Description
KeySizeValue

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

(繼承來源 AsymmetricAlgorithm)
LegalKeySizesValue

指定非對稱演算法所支援的金鑰大小。

(繼承來源 AsymmetricAlgorithm)

屬性

名稱 Description
KeyExchangeAlgorithm

取得此實作 RSA中可用的金鑰交換演算法名稱。

KeyExchangeAlgorithm

當在派生類別中覆寫時,會獲得金鑰交換演算法的名稱。 否則,會拋出一個 NotImplementedException

(繼承來源 AsymmetricAlgorithm)
KeySize

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

(繼承來源 AsymmetricAlgorithm)
LegalKeySizes

取得非對稱演算法所支援的金鑰大小。

(繼承來源 AsymmetricAlgorithm)
SignatureAlgorithm

取得此實作 RSA中可用的簽名演算法名稱。

SignatureAlgorithm

當在派生類別中實作時,會獲得簽名演算法的名稱。 否則,總是拋 NotImplementedException出 。

(繼承來源 AsymmetricAlgorithm)

方法

名稱 Description
Clear()

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

(繼承來源 AsymmetricAlgorithm)
Create()

建立演算法預設實作 RSA 的實例。

Create(Int32)

建立一個新的臨時 RSA 金鑰,且其鍵大小相同。

Create(RSAParameters)

建立一個新的臨時 RSA 金鑰,並包含指定的 RSA 金鑰參數。

Create(String)
已淘汰.

建立指定實作 RSA的實例。

Decrypt(Byte[], RSAEncryptionPadding)

當在派生類別中覆寫時,會使用指定的填充模式解密輸入資料。

Decrypt(ReadOnlySpan<Byte>, RSAEncryptionPadding)

透過指定的填充模式解密輸入資料。

Decrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding)

透過指定的填充模式解密輸入資料。

DecryptValue(Byte[])
已淘汰.

當在派生類別中覆寫時,會使用私鑰解密輸入資料。

Dispose()

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

(繼承來源 AsymmetricAlgorithm)
Dispose(Boolean)

釋放類別使用的 AsymmetricAlgorithm 非管理資源,並可選擇性地釋放受管理資源。

(繼承來源 AsymmetricAlgorithm)
Encrypt(Byte[], RSAEncryptionPadding)

當在派生類別中覆寫時,會使用指定的填充模式加密輸入資料。

Encrypt(ReadOnlySpan<Byte>, RSAEncryptionPadding)

使用指定的填充模式加密輸入資料。

Encrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding)

使用指定的填充模式加密輸入資料。

EncryptValue(Byte[])
已淘汰.

當在派生類別中覆寫時,會使用公鑰加密輸入資料。

Equals(Object)

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

(繼承來源 Object)
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters)

以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前金鑰,並以位元組為基礎的密碼。

(繼承來源 AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters)

以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前金鑰,並以字元為基礎的密碼。

(繼承來源 AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters)

匯出目前的金鑰,格式為 PKCS#8 EncryptedPrivateKeyInfo,並以位元組密碼(PEM 編碼)匯出。

(繼承來源 AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters)

以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前金鑰,並以字元密碼(PEM encoded)匯出。

(繼承來源 AsymmetricAlgorithm)
ExportParameters(Boolean)

當在導出類別中被覆寫時,會匯 RSAParameters出 。

ExportPkcs8PrivateKey()

匯出目前的金鑰,格式為 PKCS#8 PrivateKeyInfo。

(繼承來源 AsymmetricAlgorithm)
ExportPkcs8PrivateKeyPem()

匯出目前的金鑰,格式為 PKCS#8 PrivateKeyInfo,並以 PEM 編碼。

(繼承來源 AsymmetricAlgorithm)
ExportRSAPrivateKey()

匯出目前的金鑰,格式為 PKCS#1 RSAPrivateKey。

ExportRSAPrivateKeyPem()

匯出目前的金鑰,格式為 PKCS#1 RSAPrivateKey 格式,PEM 編碼。

ExportRSAPublicKey()

匯出目前金鑰的公鑰部分,格式為 PKCS#1 RSAPublicKey。

ExportRSAPublicKeyPem()

匯出目前金鑰的公鑰部分,格式為 PKCS#1 RSAPublicKey 格式,PEM 編碼。

ExportSubjectPublicKeyInfo()

匯出目前金鑰中公開金鑰部分,格式為 X.509 SubjectPublicKeyInfo。

(繼承來源 AsymmetricAlgorithm)
ExportSubjectPublicKeyInfoPem()

匯出目前金鑰中公開金鑰部分,格式為 X.509 SubjectPublicKeyInfo,PEM 編碼。

(繼承來源 AsymmetricAlgorithm)
FromXmlString(String)

從 XML 字串的金鑰資訊初始化物件 RSA

GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetMaxOutputSize()

取得 RSA 操作能產生的最大位元組數。

GetType()

取得目前實例的 Type

(繼承來源 Object)
HashData(Byte[], Int32, Int32, HashAlgorithmName)

當在派生類別中覆寫時,會利用指定的雜湊演算法計算特定部分位元組陣列的雜湊值。

HashData(Stream, HashAlgorithmName)

當在導出類別中覆寫時,會使用指定的雜湊演算法計算指定二進位串流的雜湊值。

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)

在以位元組密碼解密後,從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公私密金鑰對,替換該物件的金鑰。

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)

當在派生類別中覆寫時,會從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公私鑰對,並以位元組密碼解密,替換該物件的金鑰。

(繼承來源 AsymmetricAlgorithm)
ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32)

在以字元密碼解密後,從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公私鑰對,替換該物件的金鑰。

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32)

當在衍生類別中覆寫時,會在以字元密碼解密後,從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公私鑰對,替換該物件的金鑰。

(繼承來源 AsymmetricAlgorithm)
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)

匯入加密的 RFC 7468 PEM 編碼私鑰,取代此物件的金鑰。

ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

匯入加密的 RFC 7468 PEM 編碼私鑰,取代此物件的金鑰。

ImportFromPem(ReadOnlySpan<Char>)

匯入一個 RFC 7468 PEM 編碼的金鑰,替換此物件的金鑰。

ImportParameters(RSAParameters)

當在導出類別中覆寫時,會匯入指定的 RSAParameters

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

解密後,從 PKCS#8 PrivateKeyInfo 結構匯入公私鑰對,替換此物件的金鑰。

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

當在派生類別中覆寫時,解密後會從 PKCS#8 PrivateKeyInfo 結構匯入公私鑰對,替換該物件的金鑰。

(繼承來源 AsymmetricAlgorithm)
ImportRSAPrivateKey(ReadOnlySpan<Byte>, Int32)

解密後,從 PKCS#1 RSAPrivateKey 結構匯入公私鑰對,替換此物件的金鑰。

ImportRSAPublicKey(ReadOnlySpan<Byte>, Int32)

解密後從 PKCS#1 RSAPublicKey 結構匯入公鑰,替換此物件的金鑰。

ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32)

解密後,從 X.509 SubjectPublicKeyInfo 結構匯入公鑰,替換該物件的金鑰。

ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32)

當在派生類別中覆寫時,解密後會從 X.509 SubjectPublicKeyInfo 結構匯入公開金鑰,替換該物件的金鑰。

(繼承來源 AsymmetricAlgorithm)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
SignData(Byte[], HashAlgorithmName, RSASignaturePadding)

利用指定的雜湊演算法與填充模式計算指定位元組陣列的雜湊值,並對所得雜湊值進行簽名。

SignData(Byte[], Int32, Int32, HashAlgorithmName, RSASignaturePadding)

利用指定的雜湊演算法與填充模式計算指定位元組陣列中某部分的雜湊值,並對所得雜湊值進行簽名。

SignData(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

計算指定資料的雜湊值並簽名。

SignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding)

利用指定演算法計算所提供資料的雜湊值,並以當前金鑰簽署雜湊值,將簽章寫入提供的緩衝區。

SignData(Stream, HashAlgorithmName, RSASignaturePadding)

利用指定的雜湊演算法與填充模式計算指定串流的雜湊值,並對所得雜湊值進行簽名。

SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)

當在派生類別中覆寫時,會利用指定的填充計算指定雜湊值的簽章。

SignHash(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

利用指定的填充計算指定雜湊值的簽章。

SignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding)

用目前的金鑰簽署雜湊值,並將簽章寫入提供的緩衝區。

ToString()

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

(繼承來源 Object)
ToXmlString(Boolean)

建立並回傳包含當前 RSA 物件鍵的 XML 字串。

TryDecrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding, Int32)

嘗試使用指定的填充模式解密輸入資料,並將結果寫入提供的緩衝區。

TryEncrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding, Int32)

嘗試將輸入資料以指定的填充模式加密到提供的緩衝區中。

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32)

嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式將目前金鑰匯出到提供的緩衝區,使用位元組密碼。

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32)

當在衍生類別中覆寫時,會嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式將目前金鑰匯出到提供的緩衝區,並使用位元組密碼。

(繼承來源 AsymmetricAlgorithm)
TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32)

嘗試將目前的 PKCS#8 EncryptedPrivateKeyInfo 格式金鑰匯出到提供的緩衝區,使用字元密碼。

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32)

當在衍生類別中覆寫時,會嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式的當前金鑰匯出到提供的緩衝區,並使用字元密碼。

(繼承來源 AsymmetricAlgorithm)
TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters, Span<Char>, Int32)

嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前金鑰,並以位元組密碼(PEM 編碼)匯出。

(繼承來源 AsymmetricAlgorithm)
TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters, Span<Char>, Int32)

以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前金鑰,並以字元密碼(PEM encoded)匯出。

(繼承來源 AsymmetricAlgorithm)
TryExportPkcs8PrivateKey(Span<Byte>, Int32)

嘗試將目前的 PKCS#8 PrivateKeyInfo 格式匯出至提供的緩衝區。

TryExportPkcs8PrivateKey(Span<Byte>, Int32)

當在衍生類別中覆寫時,會嘗試將目前的 PKCS#8 PrivateKeyInfo 格式匯出到提供的緩衝區。

(繼承來源 AsymmetricAlgorithm)
TryExportPkcs8PrivateKeyPem(Span<Char>, Int32)

嘗試將目前以 PEM 編碼的 PKCS#8 PrivateKeyInfo 格式匯出至提供的緩衝區。

(繼承來源 AsymmetricAlgorithm)
TryExportRSAPrivateKey(Span<Byte>, Int32)

嘗試將目前的 PKCS#1 RSAPrivateKey 格式匯出至提供的緩衝區。

TryExportRSAPrivateKeyPem(Span<Char>, Int32)

嘗試將目前的金鑰以 PEM 編碼的 PKCS#1 RSAPrivateKey 格式匯出到提供的緩衝區。

TryExportRSAPublicKey(Span<Byte>, Int32)

嘗試將目前的 PKCS#1 RSAPublicKey 格式匯出至提供的緩衝區。

TryExportRSAPublicKeyPem(Span<Char>, Int32)

嘗試將目前的金鑰以 PEM 編碼的 PKCS#1 RSAPublicKey 格式匯出到提供的緩衝區。

TryExportSubjectPublicKeyInfo(Span<Byte>, Int32)

嘗試將目前的 X.509 SubjectPublicKeyInfo 格式匯出至提供的緩衝區。

TryExportSubjectPublicKeyInfo(Span<Byte>, Int32)

當在衍生類別中覆寫時,會嘗試將目前的金鑰以 X.509 SubjectPublicKeyInfo 格式匯出到提供的緩衝區。

(繼承來源 AsymmetricAlgorithm)
TryExportSubjectPublicKeyInfoPem(Span<Char>, Int32)

嘗試將目前的 PEM 編碼 X.509 SubjectPublicKeyInfo 格式匯出至提供的緩衝區。

(繼承來源 AsymmetricAlgorithm)
TryHashData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, Int32)

嘗試利用指定演算法計算所提供資料的雜湊值,並將結果寫入所提供的緩衝區。

TrySignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32)

嘗試用指定的演算法雜湊所提供的資料,並以當前金鑰簽署雜湊,將簽章寫入提供的緩衝區。

TrySignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32)

嘗試用目前的金鑰簽署雜湊值,並將簽章寫入提供的緩衝區。

VerifyData(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

透過使用指定的雜湊演算法與填充計算指定資料的雜湊值,並與所提供的簽章比較,驗證數位簽章的有效性。

VerifyData(Byte[], Int32, Int32, Byte[], HashAlgorithmName, RSASignaturePadding)

透過使用指定的雜湊演算法與填充計算位元組陣列部分資料的雜湊值,並與所提供的簽章比較,驗證數位簽章的有效性。

VerifyData(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

透過使用指定的雜湊演算法與填充計算指定資料的雜湊值,並與所提供的簽章比較,驗證數位簽章的有效性。

VerifyData(Stream, Byte[], HashAlgorithmName, RSASignaturePadding)

透過使用指定的雜湊演算法與填充計算指定串流的雜湊值,並與所提供的簽章比較,驗證數位簽章的有效性。

VerifyHash(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

透過使用指定的雜湊演算法與填充,確定簽章中的雜湊值,並與提供的雜湊值比較,驗證數位簽章的有效性。

VerifyHash(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

透過使用指定的雜湊演算法與填充,確定簽章中的雜湊值,並與提供的雜湊值比較,驗證數位簽章的有效性。

明確介面實作

名稱 Description
IDisposable.Dispose()

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

關於此成員的描述,請參見 Dispose()

(繼承來源 AsymmetricAlgorithm)

適用於

另請參閱