DSACryptoServiceProvider 類別

定義

定義包裝函式物件,以存取 DSA 演算法的密碼編譯服務供應者 (CSP) 實作。 此類別無法獲得繼承。

public ref class DSACryptoServiceProvider sealed : System::Security::Cryptography::DSA, System::Security::Cryptography::ICspAsymmetricAlgorithm
public ref class DSACryptoServiceProvider sealed : System::Security::Cryptography::DSA
public sealed class DSACryptoServiceProvider : System.Security.Cryptography.DSA, System.Security.Cryptography.ICspAsymmetricAlgorithm
public sealed class DSACryptoServiceProvider : System.Security.Cryptography.DSA
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class DSACryptoServiceProvider : System.Security.Cryptography.DSA, System.Security.Cryptography.ICspAsymmetricAlgorithm
type DSACryptoServiceProvider = class
    inherit DSA
    interface ICspAsymmetricAlgorithm
type DSACryptoServiceProvider = class
    inherit DSA
[<System.Runtime.InteropServices.ComVisible(true)>]
type DSACryptoServiceProvider = class
    inherit DSA
    interface ICspAsymmetricAlgorithm
Public NotInheritable Class DSACryptoServiceProvider
Inherits DSA
Implements ICspAsymmetricAlgorithm
Public NotInheritable Class DSACryptoServiceProvider
Inherits DSA
繼承
DSACryptoServiceProvider
屬性
實作

備註

您可以使用 類別 DSACryptoServiceProvider 來建立數位簽章,並保護資料的完整性。

若要使用公開金鑰系統以數位方式簽署訊息,傳送者會先將雜湊函式套用至訊息,以建立訊息摘要。 寄件者接著會使用寄件者的私密金鑰來加密訊息摘要,以建立寄件者的個人簽章。 收到訊息和簽章時,接收者會使用寄件者的公開金鑰解密簽章,以復原訊息摘要,並使用傳送者所使用的相同雜湊演算法來雜湊訊息。 如果接收者計算的訊息摘要完全符合從傳送者接收的訊息摘要,則接收者可以確定傳輸中訊息未改變。 請注意,任何人都可以驗證簽章,因為寄件者的公開金鑰是常見的知識。

注意

DSA 演算法的建立者已撤銷其支援。 請考慮使用 RSACryptoServiceProvider 類別,而不是 DSACryptoServiceProvider 類別。 DSACryptoServiceProvider僅用於與繼承應用程式和資料的相容性。

此演算法支援 512 位到 1024 位的金鑰長度,增量為 64 位。

建構函式

DSACryptoServiceProvider()

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

DSACryptoServiceProvider(CspParameters)

使用指定的密碼編譯服務提供者 (CSP) 參數,初始化 DSACryptoServiceProvider 類別的新執行個體。

DSACryptoServiceProvider(Int32)

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

DSACryptoServiceProvider(Int32, CspParameters)

使用指定的密碼編譯服務提供者的金鑰大小和參數,初始化 DSACryptoServiceProvider 類別的新執行個體。

欄位

KeySizeValue

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

(繼承來源 AsymmetricAlgorithm)
LegalKeySizesValue

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

(繼承來源 AsymmetricAlgorithm)

屬性

CspKeyContainerInfo

取得 CspKeyContainerInfo 物件,其描述密碼編譯金鑰組的其他相關資訊。

KeyExchangeAlgorithm

取得金鑰交換演算法的名稱。

KeySize

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

LegalKeySizes

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

LegalKeySizes

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

(繼承來源 AsymmetricAlgorithm)
PersistKeyInCsp

取得或設定值,表示金鑰是否應該保存在密碼編譯服務提供者 (CSP) 中。

PublicOnly

取得值,這個值表示 DSACryptoServiceProvider 物件是否只包含公開金鑰。

SignatureAlgorithm

取得簽章演算法的名稱。

UseMachineKeyStore

取得或設定值,表示是否應該將金鑰保存在電腦的金鑰存放區中,而非使用者設定檔存放區。

方法

Clear()

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

(繼承來源 AsymmetricAlgorithm)
CreateSignature(Byte[])

建立指定資料的 DSA 簽章。

CreateSignature(Byte[], DSASignatureFormat)

以指定的格式建立指定雜湊值的 DSA 簽章。

(繼承來源 DSA)
CreateSignatureCore(ReadOnlySpan<Byte>, DSASignatureFormat)

以指定的格式建立指定雜湊值的 DSA 簽章。

(繼承來源 DSA)
Dispose()

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

(繼承來源 AsymmetricAlgorithm)
Dispose(Boolean)

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

(繼承來源 AsymmetricAlgorithm)
Equals(Object)

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

(繼承來源 Object)
ExportCspBlob(Boolean)

匯出 BLOB,其中含有與 DSACryptoServiceProvider 物件相關的金鑰資訊。

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)

匯出 DSAParameters

ExportPkcs8PrivateKey()

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

(繼承來源 AsymmetricAlgorithm)
ExportPkcs8PrivateKeyPem()

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

(繼承來源 AsymmetricAlgorithm)
ExportSubjectPublicKeyInfo()

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

(繼承來源 AsymmetricAlgorithm)
ExportSubjectPublicKeyInfoPem()

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

(繼承來源 AsymmetricAlgorithm)
Finalize()

釋出與此執行個體建立關聯的所有資源。

FromXmlString(String)

從 XML 字串重新建構 DSA 物件。

(繼承來源 DSA)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetMaxSignatureSize(DSASignatureFormat)

取得此索引鍵以指定格式所產生簽章的最大大小 (以位元組為單位)。

(繼承來源 DSA)
GetType()

取得目前執行個體的 Type

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

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

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

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

(繼承來源 DSA)
ImportCspBlob(Byte[])

匯入代表 DSA 金鑰資訊的 BLOB。

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(繼承來源 DSA)
ImportParameters(DSAParameters)

匯入指定的 DSAParameters

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

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

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

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

(繼承來源 DSA)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
SignData(Byte[])

計算指定位元組陣列的雜湊值 (Hash Value),並簽名產生的雜湊值。

SignData(Byte[], HashAlgorithmName)

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

(繼承來源 DSA)
SignData(Byte[], HashAlgorithmName, DSASignatureFormat)

計算指定資料的雜湊值,並使用指定的簽章格式加以簽署。

(繼承來源 DSA)
SignData(Byte[], Int32, Int32)

從指定的起始點到指定的端點簽署位元組陣列。

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

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

(繼承來源 DSA)
SignData(Byte[], Int32, Int32, HashAlgorithmName, DSASignatureFormat)

計算指定資料的雜湊值,並使用指定的簽章格式加以簽署。

(繼承來源 DSA)
SignData(Stream)

計算指定輸入資料流的雜湊值,並簽名產生的雜湊值。

SignData(Stream, HashAlgorithmName)

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

(繼承來源 DSA)
SignData(Stream, HashAlgorithmName, DSASignatureFormat)

計算指定資料的雜湊值,並使用指定的簽章格式加以簽署。

(繼承來源 DSA)
SignDataCore(ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

計算指定資料的雜湊值,並使用指定的簽章格式加以簽署。

(繼承來源 DSA)
SignDataCore(Stream, HashAlgorithmName, DSASignatureFormat)

計算指定資料的雜湊值,並使用指定的簽章格式加以簽署。

(繼承來源 DSA)
SignHash(Byte[], String)

使用私密金鑰進行加密,為指定的雜湊值計算出簽章。

ToString()

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

(繼承來源 Object)
ToXmlString(Boolean)

建立並傳回表示目前 DSA 物件的 XML 字串。

(繼承來源 DSA)
TryCreateSignature(ReadOnlySpan<Byte>, Span<Byte>, DSASignatureFormat, Int32)

嘗試以指定的格式,建立指定雜湊值的 DSA 簽章,並放至提供的緩衝區。

(繼承來源 DSA)
TryCreateSignature(ReadOnlySpan<Byte>, Span<Byte>, Int32)

嘗試在所提供緩衝區中為指定的雜湊建立 DSA 簽章。

(繼承來源 DSA)
TryCreateSignatureCore(ReadOnlySpan<Byte>, Span<Byte>, DSASignatureFormat, Int32)

嘗試以指定的格式,建立指定雜湊值的 DSA 簽章,並放至提供的緩衝區。

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

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

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

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

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

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

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

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

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

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

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

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

嘗試在所提供緩衝區中計算所提供資料的雜湊值。

(繼承來源 DSA)
TrySignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, DSASignatureFormat, Int32)

嘗試以指定的格式,建立指定資料的 DSA 簽章,並放至提供的緩衝區。

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

嘗試在所提供緩衝區中為指定的資料建立 DSA 簽章。

(繼承來源 DSA)
TrySignDataCore(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, DSASignatureFormat, Int32)

嘗試以指定的格式,建立指定資料的 DSA 簽章,並放至提供的緩衝區。

(繼承來源 DSA)
VerifyData(Byte[], Byte[])

驗證指定的簽章資料,方法是用它與指定資料計算出來的簽章進行比對。

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

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

(繼承來源 DSA)
VerifyData(Byte[], Byte[], HashAlgorithmName, DSASignatureFormat)

驗證數位簽章對提供的資料是否有效。

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

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

(繼承來源 DSA)
VerifyData(Byte[], Int32, Int32, Byte[], HashAlgorithmName, DSASignatureFormat)

驗證數位簽章對提供的資料是否有效。

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

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

(繼承來源 DSA)
VerifyData(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

驗證數位簽章對提供的資料是否有效。

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

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

(繼承來源 DSA)
VerifyData(Stream, Byte[], HashAlgorithmName, DSASignatureFormat)

驗證數位簽章對提供的資料是否有效。

(繼承來源 DSA)
VerifyDataCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

驗證數位簽章對提供的資料是否有效。

(繼承來源 DSA)
VerifyDataCore(Stream, ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

驗證數位簽章對提供的資料是否有效。

(繼承來源 DSA)
VerifyHash(Byte[], String, Byte[])

驗證指定的簽章資料,方法是用它與指定雜湊值計算出來的簽章進行比對。

VerifySignature(Byte[], Byte[])

驗證指定之資料的 DSA 簽章。

VerifySignature(Byte[], Byte[], DSASignatureFormat)

驗證數位簽章對提供的雜湊是否有效。

(繼承來源 DSA)
VerifySignature(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

驗證數位簽章對提供的資料雜湊是否有效。

(繼承來源 DSA)
VerifySignature(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, DSASignatureFormat)

驗證數位簽章對提供的雜湊是否有效。

(繼承來源 DSA)
VerifySignatureCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, DSASignatureFormat)

驗證數位簽章對提供的雜湊是否有效。

(繼承來源 DSA)

明確介面實作

IDisposable.Dispose()

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

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

(繼承來源 AsymmetricAlgorithm)

適用於

另請參閱