RSA 類別

定義

表示基底類別,RSA 演算法的所有實作都會從它衍生。

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

備註

建議開發人員針對 RSA 基類進行程式設計,而不是任何特定的衍生類別。 衍生類別適用于與基礎系統密碼編譯程式庫的 Interop。

建構函式

RSA()

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

欄位

KeySizeValue

表示非對稱演算法使用的金鑰模數大小,以位元為單位。

(繼承來源 AsymmetricAlgorithm)
LegalKeySizesValue

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

(繼承來源 AsymmetricAlgorithm)

屬性

KeyExchangeAlgorithm

取得可透過這個 RSA 實作所提供之金鑰交換演算法的名稱。

KeyExchangeAlgorithm

在衍生類別中覆寫時,取得金鑰交換演算法的名稱。 否則,擲回 NotImplementedException

(繼承來源 AsymmetricAlgorithm)
KeySize

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

(繼承來源 AsymmetricAlgorithm)
LegalKeySizes

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

(繼承來源 AsymmetricAlgorithm)
SignatureAlgorithm

取得可透過這個 RSA 實作所提供之簽章演算法的名稱。

SignatureAlgorithm

在衍生類別中實作時,取得簽章演算法的名稱。 否則,一律擲回 NotImplementedException

(繼承來源 AsymmetricAlgorithm)

方法

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 類別所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

(繼承來源 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)

使用 Char 型密碼以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前金鑰。

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

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

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

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

(繼承來源 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 物件。

FromXmlString(String)

在衍生類別中覆寫時,從 XML 字串重新建構 AsymmetricAlgorithm 物件。 否則,擲回 NotImplementedException

(繼承來源 AsymmetricAlgorithm)
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)

使用 Char 型密碼解密之後,從 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<Byte>)

在衍生類別中覆寫時,匯入 RFC 7468 PEM 編碼的加密金鑰,並取代這個物件的金鑰。

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

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

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

在衍生類別中覆寫時,匯入 RFC 7468 PEM 編碼的加密金鑰,並取代這個物件的金鑰。

(繼承來源 AsymmetricAlgorithm)
ImportFromPem(ReadOnlySpan<Char>)

匯入 RFC 7468 PEM 編碼的金鑰,並取代這個物件的金鑰。

ImportFromPem(ReadOnlySpan<Char>)

在衍生類別中覆寫時,匯入 RFC 7468文字編碼的金鑰,並取代這個物件的金鑰。

(繼承來源 AsymmetricAlgorithm)
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)

建立並傳回 XML 字串,其中包含目前 RSA 物件的金鑰。

ToXmlString(Boolean)

在衍生類別中覆寫時,建立並傳回目前 AsymmetricAlgorithm 物件的 XML 字串表示。 否則,擲回 NotImplementedException

(繼承來源 AsymmetricAlgorithm)
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)

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

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

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

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

嘗試使用以位元組為基礎的密碼 PEM 編碼,以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前的金鑰。

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

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

(繼承來源 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)

使用指定的雜湊演算法和填補,並和提供的雜湊值比較,來為簽章判斷雜湊值,藉此驗證數位簽章是否有效。

明確介面實作

IDisposable.Dispose()

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

如需這個成員的說明,請參閱 Dispose()

(繼承來源 AsymmetricAlgorithm)

適用於

另請參閱