DSA 类

定义

表示数字签名算法(DSA)的所有实现都必须从中继承的抽象基类。

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

注解

可以使用 DSA 类和派生类来创建有助于保护数据完整性的数字签名。 DSACryptoServiceProvider提供此类的实现。

若要使用公钥系统对消息进行数字签名,发送方首先对消息应用哈希函数以创建消息摘要。 然后,发送方使用发件人的私钥加密消息摘要,以创建发件人的个人签名。 收到消息和签名后,接收方使用发送方的公钥解密签名,以恢复消息摘要,并使用发送方使用的相同哈希算法对消息进行哈希处理。 如果接收方计算的消息摘要与从发送方接收的消息摘要完全匹配,则接收方可以假定消息在传输过程中未更改。 请注意,任何人都可以验证签名,因为发送方的公钥是常识。

重要

DSA 算法的创建者已经撤回了对它的支持。 请考虑使用 RSA 类或 ECDsa 类而不是 DSA 类。 仅用于 DSA 与旧应用程序和数据的兼容性。

存在两个不同版本的 DSA 算法。 FIPS 186-2 中所述的原始形式需要使用 SHA-1 作为哈希算法,并支持密钥长度从 512 位到 1024 位,增量为 64 位。 FIPS 186-3 中介绍了该算法的更新版本,它允许使用 SHA-2 系列哈希算法,并添加了对 2048 位密钥和 3072 位密钥的支持。 并非所有此类型的派生实现都支持 DSA 的 FIPS 186-3 增强功能。 可以通过 属性检测到 LegalKeySizes 支持。

构造函数

DSA()

初始化 DSA 类的新实例。

字段

KeySizeValue

表示非对称算法所用密钥模块的大小(以位为单位)。

(继承自 AsymmetricAlgorithm)
LegalKeySizesValue

指定非对称算法支持的密钥大小。

(继承自 AsymmetricAlgorithm)

属性

KeyExchangeAlgorithm

当在派生类中重写时,请获取密钥交换算法的名称。 否则,将引发 NotImplementedException

(继承自 AsymmetricAlgorithm)
KeySize

获取或设置非对称算法所用密钥模块的大小(以位为单位)。

(继承自 AsymmetricAlgorithm)
LegalKeySizes

获取非对称算法支持的密钥大小。

(继承自 AsymmetricAlgorithm)
SignatureAlgorithm

当在派生类中实现时,请获取签名算法的名称。 否则,将始终引发 NotImplementedException

(继承自 AsymmetricAlgorithm)

方法

Clear()

释放 AsymmetricAlgorithm 类使用的所有资源。

(继承自 AsymmetricAlgorithm)
Create()

创建用于执行不对称算法的默认加密对象。

Create(DSAParameters)

创建具有指定 DSA 密钥参数的新临时 DSA 密钥。

Create(Int32)

创建具有指定密钥大小的新临时 DSA 密钥。

Create(String)
已过时.

创建用于执行不对称算法的指定加密对象。

CreateSignature(Byte[])

在派生类中重写时,为指定的哈希值创建 DSA 签名。

CreateSignature(Byte[], DSASignatureFormat)

采用指定格式为指定的哈希值创建 DSA 签名。

CreateSignatureCore(ReadOnlySpan<Byte>, DSASignatureFormat)

采用指定格式为指定的哈希值创建 DSA 签名。

Dispose()

释放 AsymmetricAlgorithm 类的当前实例所使用的所有资源。

(继承自 AsymmetricAlgorithm)
Dispose(Boolean)

释放 AsymmetricAlgorithm 类使用的非托管资源,并可以选择释放托管资源。

(继承自 AsymmetricAlgorithm)
Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters)

使用基于字节的密码以 PKCS#8 EncryptedPrivateKeyInfo 格式导出当前密钥。

(继承自 AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters)

使用基于字符的密码以 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)
FromXmlString(String)

通过 XML 字符串重新构造 DSA 对象。

GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetMaxSignatureSize(DSASignatureFormat)

获取此密钥按指定格式生成的签名的最大尺寸(以字节为单位)。

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<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(DSAParameters)

当在派生类中重写时,导入指定的 DSAParameters

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

解密后,从 PKCS#8 PrivateKeyInfo 结构中导入公/私钥对,以替换此对象的密钥。

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

在派生的类中替代时,解密后从 PKCS#8 PrivateKeyInfo 结构中导入公/私钥对,以替换此对象的密钥。

(继承自 AsymmetricAlgorithm)
ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32)

解密后,从 X.509 SubjectPublicKeyInfo 结构中导入公钥,以替换此对象的密钥。

ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32)

在派生的类中替代时,解密后从 X.509 SubjectPublicKeyInfo 结构中导入公/私钥对,以替换此对象的密钥。

(继承自 AsymmetricAlgorithm)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
SignData(Byte[], HashAlgorithmName)

使用指定的哈希算法计算指定字节数组的哈希值,并对生成的哈希值进行签名。

SignData(Byte[], HashAlgorithmName, DSASignatureFormat)

计算指定数据的哈希值,并使用指定的签名格式对其进行签名。

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

使用指定的哈希算法计算指定字节数组的一个部分的哈希值,并对生成的哈希值进行签名。

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

计算指定数据的哈希值,并使用指定的签名格式对其进行签名。

SignData(Stream, HashAlgorithmName)

使用指定的哈希算法计算指定流的哈希值,并对生成的哈希值进行签名。

SignData(Stream, HashAlgorithmName, DSASignatureFormat)

计算指定数据的哈希值,并使用指定的签名格式对其进行签名。

SignDataCore(ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

计算指定数据的哈希值,并使用指定的签名格式对其进行签名。

SignDataCore(Stream, HashAlgorithmName, DSASignatureFormat)

计算指定数据的哈希值,并使用指定的签名格式对其进行签名。

ToString()

返回表示当前对象的字符串。

(继承自 Object)
ToXmlString(Boolean)

创建并返回当前 DSA 对象的 XML 字符串表示形式。

TryCreateSignature(ReadOnlySpan<Byte>, Span<Byte>, DSASignatureFormat, Int32)

尝试采用指定格式为指定的哈希值创建 DSA 签名并将其置于提供的缓冲区中。

TryCreateSignature(ReadOnlySpan<Byte>, Span<Byte>, Int32)

尝试将指定哈希的 DSA 签名创建到所提供的缓冲区中。

TryCreateSignatureCore(ReadOnlySpan<Byte>, Span<Byte>, DSASignatureFormat, Int32)

尝试采用指定格式为指定的哈希值创建 DSA 签名并将其置于提供的缓冲区中。

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)

尝试使用基于字节的密码(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)
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, DSASignatureFormat, Int32)

尝试采用指定格式为指定的数据创建 DSA 签名并将其置于提供的缓冲区中。

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

尝试将指定数据的 DSA 签名创建到所提供的缓冲区中。

TrySignDataCore(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, DSASignatureFormat, Int32)

尝试采用指定格式为指定的数据创建 DSA 签名并将其置于提供的缓冲区中。

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

通过使用指定的哈希算法计算指定数据的哈希值,并将其与提供的签名进行比较,验证数字签名是否有效。

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

验证数字签名对于所提供的数据是否有效。

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

通过使用指定的哈希算法计算字节数组一个部分中数据的哈希值,并将其与提供的签名进行比较,验证数字签名是否有效。

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

验证数字签名对于所提供的数据是否有效。

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

通过使用指定的哈希算法计算某字节范围内数据的哈希值,并将其与提供的签名进行比较,验证数字签名是否有效。

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

验证数字签名对于所提供的数据是否有效。

VerifyData(Stream, Byte[], HashAlgorithmName)

通过使用指定的哈希算法计算指定流的哈希值,并将其与提供的签名进行比较,验证数字签名是否有效。

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

验证数字签名对于所提供的数据是否有效。

VerifyDataCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

验证数字签名对于所提供的数据是否有效。

VerifyDataCore(Stream, ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

验证数字签名对于所提供的数据是否有效。

VerifySignature(Byte[], Byte[])

当在派生类中重写时,验证指定数据的 DSA 签名。

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

验证数字签名对于所提供的哈希是否有效。

VerifySignature(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

验证数字签名对于所提供的数据哈希是否有效。

VerifySignature(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, DSASignatureFormat)

验证数字签名对于所提供的哈希是否有效。

VerifySignatureCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, DSASignatureFormat)

验证数字签名对于所提供的哈希是否有效。

显式接口实现

IDisposable.Dispose()

此 API 支持产品基础结构,不能在代码中直接使用。

有关此成员的说明,请参见 Dispose()

(继承自 AsymmetricAlgorithm)

适用于

另请参阅