RSACng 類別

定義

提供 RSA 演算法的新一代密碼編譯 (CNG) 實作。

public ref class RSACng sealed : System::Security::Cryptography::RSA
public sealed class RSACng : System.Security.Cryptography.RSA
type RSACng = class
    inherit RSA
Public NotInheritable Class RSACng
Inherits RSA
繼承

備註

類別 RSACng 衍生自 RSA 類別。 因此,它不是現有 用法的 RSACryptoServiceProvider卸除取代。

RSACng 使用類似於 ECDsaCng 類別的程式設計模型,而不是 RSACryptoServiceProvider 類別。 例如:

  • 所使用的 RSACng 金鑰是由個別 CngKey 的 物件所管理。 相反地, RSACryptoServiceProvider 具有直接系結至類型本身作業的索引鍵。

  • RSACng 執行這類作業,例如使用 對象的屬性 RSACng 簽署和驗證簽章,就像使用其物件屬性來控制簽署和驗證作業一樣 ECDsaCng

注意

類別 RSACng 是使用 Windows CNG 連結庫的 RSA 演算法實作,不適用於 Windows 以外的作業系統。 對於未執行 Windows Interop 的應用程式,建議您使用 RSA.Create ,而不是直接參考此類型。

建構函式

RSACng()

使用隨機 2,048 位元金鑰組,初始化 RSACng 類別的新執行個體。

RSACng(CngKey)

使用指定的金鑰,初始化 RSACng 類別的新執行個體。

RSACng(Int32)

使用指定大小之隨機產生的金鑰,初始化 RSACng 類別的新執行個體。

欄位

KeySizeValue

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

(繼承來源 AsymmetricAlgorithm)
LegalKeySizesValue

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

(繼承來源 AsymmetricAlgorithm)

屬性

Key

取得金鑰,RSACng 物件會將這個金鑰用於其所執行的任何密碼編譯作業。

KeyExchangeAlgorithm

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

KeyExchangeAlgorithm

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

(繼承來源 RSA)
KeySize

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

(繼承來源 AsymmetricAlgorithm)
LegalKeySizes

取得此 RSA 實作支援的金鑰大小 (以位元為單位)。

LegalKeySizes

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

(繼承來源 AsymmetricAlgorithm)
SignatureAlgorithm

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

SignatureAlgorithm

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

(繼承來源 RSA)

方法

Clear()

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

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

使用指定填補模式來加密輸入資料。

Decrypt(ReadOnlySpan<Byte>, RSAEncryptionPadding)

使用指定的填補模式解密輸入資料。

(繼承來源 RSA)
Decrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding)

使用指定的填補模式解密輸入資料。

(繼承來源 RSA)
DecryptValue(Byte[])

使用私密金鑰來解密輸入資料。

DecryptValue(Byte[])
已淘汰.

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

(繼承來源 RSA)
Dispose()

釋放 AsymmetricAlgorithm 類別目前的執行個體所使用的全部資源。

(繼承來源 AsymmetricAlgorithm)
Dispose(Boolean)

釋放 AsymmetricAlgorithm 類別所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

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

使用指定填補加密輸入的資料。

Encrypt(ReadOnlySpan<Byte>, RSAEncryptionPadding)

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

(繼承來源 RSA)
Encrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding)

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

(繼承來源 RSA)
EncryptValue(Byte[])

使用公開金鑰,來加密輸入資料。

EncryptValue(Byte[])
已淘汰.

在衍生類別中覆寫時,使用公開金鑰加密輸入資料。

(繼承來源 RSA)
Equals(Object)

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

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

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

ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters)

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

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

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

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)

將 RSA 物件所使用的金鑰匯出到 RSAParameters 物件中。

ExportPkcs8PrivateKey()

以 PKCS#8 PrivateKeyInfo 格式匯出目前金鑰。

(繼承來源 AsymmetricAlgorithm)
ExportPkcs8PrivateKeyPem()

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

(繼承來源 AsymmetricAlgorithm)
ExportRSAPrivateKey()

以 PKCS#1 RSAPrivateKey 格式匯出目前金鑰。

(繼承來源 RSA)
ExportRSAPrivateKeyPem()

以 PKCS#1 RSAPrivateKey 格式匯出目前的密鑰,並編碼 PEM。

(繼承來源 RSA)
ExportRSAPublicKey()

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

(繼承來源 RSA)
ExportRSAPublicKeyPem()

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

(繼承來源 RSA)
ExportSubjectPublicKeyInfo()

以 X.509 SubjectPublicKeyInfo 格式匯出目前金鑰的公開金鑰部分。

(繼承來源 AsymmetricAlgorithm)
ExportSubjectPublicKeyInfoPem()

以 X.509 SubjectPublicKeyInfo 格式 PEM 編碼,匯出目前密鑰的公鑰部分。

(繼承來源 AsymmetricAlgorithm)
FromXmlString(String)

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

(繼承來源 RSA)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetMaxOutputSize()

取得 RSA 作業可產生的最大位元元組數目。

(繼承來源 RSA)
GetType()

取得目前執行個體的 Type

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

在衍生類別中覆寫時,會使用指定的雜湊演算法,來為位元組陣列中的指定部分計算出雜湊值。

(繼承來源 RSA)
HashData(Stream, HashAlgorithmName)

在衍生類別中覆寫時,會使用指定的雜湊演算法,來為指定的二進位資料流計算出雜湊值。

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

使用位元組型密碼解密之後,從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

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

使用位元組型密碼解密之後,從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

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

使用 Char 型密碼解密之後,從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

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

使用 Char 型密碼解密之後,從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

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

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

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

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

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

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

(繼承來源 RSA)
ImportParameters(RSAParameters)

為參數結構建立新的 CngKey,來取代目前執行個體正在使用的現有金鑰。

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

解密後,從 PKCS#8 PrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

解密後,從 PKCS#8 PrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

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

解密後,從 PKCS#1 RSAPrivateKey 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

(繼承來源 RSA)
ImportRSAPublicKey(ReadOnlySpan<Byte>, Int32)

解密後,從 PKCS#1 RSAPublicKey 結構匯入公開金鑰,以取代這個物件的金鑰。

(繼承來源 RSA)
ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32)

解密後,從 X.509 SubjectPublicKeyInfo 結構匯入公開金鑰,以取代這個物件的金鑰。

(繼承來源 RSA)
MemberwiseClone()

建立目前 Object 的淺層複製。

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

使用指定的雜湊演算法和填補模式,並簽署產生的雜湊值,來為指定的位元組陣列計算出雜湊值。

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

使用指定的雜湊演算法和填補模式,並簽署產生的雜湊值,來為指定的部分位元組陣列計算出雜湊值。

(繼承來源 RSA)
SignData(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

計算指定資料的雜湊值並進行簽署。

(繼承來源 RSA)
SignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding)

使用指定的演算法計算所提供數據的哈希,並使用目前的密鑰簽署哈希,並將簽章寫入提供的緩衝區。

(繼承來源 RSA)
SignData(Stream, HashAlgorithmName, RSASignaturePadding)

使用指定的雜湊演算法和填補模式,並簽署產生的雜湊值,來為指定的資料流計算出雜湊值。

(繼承來源 RSA)
SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)

簽署資料,該資料已使用指定的雜湊演算法和填補模式進行雜湊處理。

SignHash(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

針對指定雜湊值的簽章,使用指定的填補來計算。

(繼承來源 RSA)
SignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding)

使用目前的金鑰簽署哈希,並將簽章寫入提供的緩衝區。

(繼承來源 RSA)
ToString()

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

(繼承來源 Object)
ToXmlString(Boolean)

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

(繼承來源 RSA)
TryDecrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding, Int32)

使用私鑰解密資料。

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

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

(繼承來源 RSA)
TryEncrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding, Int32)

使用公鑰加密數據。

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

使用指定的填補模式,嘗試加密所提供緩衝區中的輸入資料。

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

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

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

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

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

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

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

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

(繼承來源 RSA)
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 格式將目前的金鑰匯出至提供的緩衝區。

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

嘗試將 PEM 編碼 PKCS#8 PrivateKeyInfo 格式中的目前密鑰導出至提供的緩衝區。

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

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

(繼承來源 RSA)
TryExportRSAPrivateKeyPem(Span<Char>, Int32)

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

(繼承來源 RSA)
TryExportRSAPublicKey(Span<Byte>, Int32)

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

(繼承來源 RSA)
TryExportRSAPublicKeyPem(Span<Char>, Int32)

嘗試將 PEM 編碼 PKCS#1 RSAPublicKey 格式中的目前密鑰導出至提供的緩衝區。

(繼承來源 RSA)
TryExportSubjectPublicKeyInfo(Span<Byte>, Int32)

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

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

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

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

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

(繼承來源 RSA)
TrySignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32)

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

(繼承來源 RSA)
TrySignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32)

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

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

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

(繼承來源 RSA)
VerifyData(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

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

(繼承來源 RSA)
VerifyData(Byte[], Int32, Int32, Byte[], HashAlgorithmName, RSASignaturePadding)

使用指定的雜湊演算法和填補,並和提供的簽章比較,來為指定的部分位元組陣列計算出資料的雜湊值,便藉此驗證數位簽章是否有效。

(繼承來源 RSA)
VerifyData(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

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

(繼承來源 RSA)
VerifyData(Stream, Byte[], HashAlgorithmName, RSASignaturePadding)

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

(繼承來源 RSA)
VerifyHash(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

驗證已簽署且已使用指定演算法和填補模式雜湊處理的資料。

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

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

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

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

(繼承來源 RSA)

適用於