DSACng Class

Definition

Provides a Cryptography Next Generation (CNG) implementation of the Digital Signature Algorithm (DSA).

public ref class DSACng sealed : System::Security::Cryptography::DSA
public sealed class DSACng : System.Security.Cryptography.DSA
type DSACng = class
    inherit DSA
Public NotInheritable Class DSACng
Inherits DSA
Inheritance

Constructors

DSACng()

Initializes a new instance of the DSACng class with a random 2,048-bit key pair.

DSACng(CngKey)

Initializes a new instance of the DSACng class with the specified key.

DSACng(Int32)

Initializes a new instance of the DSACng class with a randomly generated key of the specified size.

Fields

KeySizeValue

Represents the size, in bits, of the key modulus used by the asymmetric algorithm.

(Inherited from AsymmetricAlgorithm)
LegalKeySizesValue

Specifies the key sizes that are supported by the asymmetric algorithm.

(Inherited from AsymmetricAlgorithm)

Properties

Key

Gets the key that will be used by the DSACng object for any cryptographic operation that it performs.

KeyExchangeAlgorithm

Gets the name of the key exchange algorithm.

KeySize

Gets or sets the size, in bits, of the key modulus used by the asymmetric algorithm.

(Inherited from AsymmetricAlgorithm)
LegalKeySizes

Gets the key sizes, in bits, that are supported by the DSA algorithm.

SignatureAlgorithm

Gets the name of the signature algorithm.

Methods

Clear()

Releases all resources used by the AsymmetricAlgorithm class.

(Inherited from AsymmetricAlgorithm)
CreateSignature(Byte[])

Creates the DSA signature for the specified data.

CreateSignature(Byte[], DSASignatureFormat)

Creates the DSA signature for the specified hash value in the indicated format.

(Inherited from DSA)
CreateSignatureCore(ReadOnlySpan<Byte>, DSASignatureFormat)

Creates the DSA signature for the specified hash value in the indicated format.

(Inherited from DSA)
Dispose()

Releases all resources used by the current instance of the AsymmetricAlgorithm class.

(Inherited from AsymmetricAlgorithm)
Dispose(Boolean)

Releases the unmanaged resources used by the AsymmetricAlgorithm class and optionally releases the managed resources.

(Inherited from AsymmetricAlgorithm)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password.

ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password.

(Inherited from AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password.

ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password.

(Inherited from AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password, PEM encoded.

(Inherited from AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password, PEM encoded.

(Inherited from AsymmetricAlgorithm)
ExportParameters(Boolean)

Exports the DSA algorithm parameters.

ExportPkcs8PrivateKey()

Exports the current key in the PKCS#8 PrivateKeyInfo format.

(Inherited from AsymmetricAlgorithm)
ExportPkcs8PrivateKeyPem()

Exports the current key in the PKCS#8 PrivateKeyInfo format, PEM encoded.

(Inherited from AsymmetricAlgorithm)
ExportSubjectPublicKeyInfo()

Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format.

(Inherited from AsymmetricAlgorithm)
ExportSubjectPublicKeyInfoPem()

Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format, PEM encoded.

(Inherited from AsymmetricAlgorithm)
FromXmlString(String)

Reconstructs a DSA object from an XML string.

(Inherited from DSA)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetMaxSignatureSize(DSASignatureFormat)

Gets the largest size, in bytes, for a signature produced by this key in the indicated format.

(Inherited from DSA)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
HashData(Byte[], Int32, Int32, HashAlgorithmName)

When overridden in a derived class, computes the hash value of a specified portion of a byte array by using a specified hashing algorithm.

(Inherited from DSA)
HashData(Stream, HashAlgorithmName)

When overridden in a derived class, computes the hash value of a specified binary stream by using a specified hashing algorithm.

(Inherited from DSA)
ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)

Imports the public/private keypair from a PKCS#8 EncryptedPrivateKeyInfo structure after decrypting with a byte-based password, replacing the keys for this object.

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

Imports the public/private keypair from a PKCS#8 EncryptedPrivateKeyInfo structure after decrypting with a byte-based password, replacing the keys for this object.

(Inherited from DSA)
ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32)

Imports the public/private keypair from a PKCS#8 EncryptedPrivateKeyInfo structure after decrypting with a char-based password, replacing the keys for this object.

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

Imports the public/private keypair from a PKCS#8 EncryptedPrivateKeyInfo structure after decrypting with a char-based password, replacing the keys for this object.

(Inherited from DSA)
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)

Imports an encrypted RFC 7468 PEM-encoded private key, replacing the keys for this object.

(Inherited from DSA)
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

Imports an encrypted RFC 7468 PEM-encoded private key, replacing the keys for this object.

(Inherited from DSA)
ImportFromPem(ReadOnlySpan<Char>)

Imports an RFC 7468 PEM-encoded key, replacing the keys for this object.

(Inherited from DSA)
ImportParameters(DSAParameters)

Replaces the existing key that the current instance is working with by creating a new CngKey for the parameters structure.

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

Imports the public/private keypair from a PKCS#8 PrivateKeyInfo structure after decryption, replacing the keys for this object.

(Inherited from DSA)
ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32)

Imports the public key from an X.509 SubjectPublicKeyInfo structure after decryption, replacing the keys for this object.

(Inherited from DSA)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
SignData(Byte[], HashAlgorithmName)

Computes the hash value of the specified byte array using the specified hash algorithm and signs the resulting hash value.

(Inherited from DSA)
SignData(Byte[], HashAlgorithmName, DSASignatureFormat)

Computes the hash value of the specified data and signs it using the specified signature format.

(Inherited from DSA)
SignData(Byte[], Int32, Int32, HashAlgorithmName)

Computes the hash value of a portion of the specified byte array using the specified hash algorithm and signs the resulting hash value.

(Inherited from DSA)
SignData(Byte[], Int32, Int32, HashAlgorithmName, DSASignatureFormat)

Computes the hash value of the specified data and signs it using the specified signature format.

(Inherited from DSA)
SignData(Stream, HashAlgorithmName)

Computes the hash value of the specified stream using the specified hash algorithm and signs the resulting hash value.

(Inherited from DSA)
SignData(Stream, HashAlgorithmName, DSASignatureFormat)

Computes the hash value of the specified data and signs it using the specified signature format.

(Inherited from DSA)
SignDataCore(ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

Computes the hash value of the specified data and signs it using the specified signature format.

(Inherited from DSA)
SignDataCore(Stream, HashAlgorithmName, DSASignatureFormat)

Computes the hash value of the specified data and signs it using the specified signature format.

(Inherited from DSA)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
ToXmlString(Boolean)

Creates and returns an XML string representation of the current DSA object.

(Inherited from DSA)
TryCreateSignature(ReadOnlySpan<Byte>, Span<Byte>, DSASignatureFormat, Int32)

Attempts to create the DSA signature for the specified hash value in the indicated format and place it into the provided buffer.

(Inherited from DSA)
TryCreateSignature(ReadOnlySpan<Byte>, Span<Byte>, Int32)

Attempts to create the DSA signature for the specified hash into the provided buffer.

(Inherited from DSA)
TryCreateSignatureCore(ReadOnlySpan<Byte>, Span<Byte>, DSASignatureFormat, Int32)

Attempts to create the DSA signature for the specified hash value in the indicated format and place it into the provided buffer.

(Inherited from DSA)
TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32)

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a byte-based password.

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

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a byte-based password.

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

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password.

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

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password.

(Inherited from DSA)
TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters, Span<Char>, Int32)

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password, PEM encoded.

(Inherited from AsymmetricAlgorithm)
TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters, Span<Char>, Int32)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password, PEM encoded.

(Inherited from AsymmetricAlgorithm)
TryExportPkcs8PrivateKey(Span<Byte>, Int32)

Attempts to export the current key in the PKCS#8 PrivateKeyInfo format into a provided buffer.

TryExportPkcs8PrivateKey(Span<Byte>, Int32)

Attempts to export the current key in the PKCS#8 PrivateKeyInfo format into a provided buffer.

(Inherited from DSA)
TryExportPkcs8PrivateKeyPem(Span<Char>, Int32)

Attempts to export the current key in the PEM-encoded PKCS#8 PrivateKeyInfo format into a provided buffer.

(Inherited from AsymmetricAlgorithm)
TryExportSubjectPublicKeyInfo(Span<Byte>, Int32)

Attempts to export the current key in the X.509 SubjectPublicKeyInfo format into a provided buffer.

(Inherited from DSA)
TryExportSubjectPublicKeyInfoPem(Span<Char>, Int32)

Attempts to export the current key in the PEM-encoded X.509 SubjectPublicKeyInfo format into a provided buffer.

(Inherited from AsymmetricAlgorithm)
TryHashData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, Int32)

Attempts to compute the hash value of the provided data into a provided buffer.

(Inherited from DSA)
TrySignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, DSASignatureFormat, Int32)

Attempts to create the DSA signature for the specified data in the indicated format and place it into the provided buffer.

(Inherited from DSA)
TrySignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, Int32)

Attempts to create the DSA signature for the specified data into the provided buffer.

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

Attempts to create the DSA signature for the specified data in the indicated format and place it into the provided buffer.

(Inherited from DSA)
VerifyData(Byte[], Byte[], HashAlgorithmName)

Verifies that a digital signature is valid by calculating the hash value of the specified data using the specified hash algorithm and comparing it to the provided signature.

(Inherited from DSA)
VerifyData(Byte[], Byte[], HashAlgorithmName, DSASignatureFormat)

Verifies that a digital signature is valid for the provided data.

(Inherited from DSA)
VerifyData(Byte[], Int32, Int32, Byte[], HashAlgorithmName)

Verifies that a digital signature is valid by calculating the hash value of the data in a portion of a byte array using the specified hash algorithm and comparing it to the provided signature.

(Inherited from DSA)
VerifyData(Byte[], Int32, Int32, Byte[], HashAlgorithmName, DSASignatureFormat)

Verifies that a digital signature is valid for the provided data.

(Inherited from DSA)
VerifyData(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName)

Verifies that a digital signature is valid by calculating the hash value of the data in a byte span using the specified hash algorithm and comparing it to the provided signature.

(Inherited from DSA)
VerifyData(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

Verifies that a digital signature is valid for the provided data.

(Inherited from DSA)
VerifyData(Stream, Byte[], HashAlgorithmName)

Verifies that a digital signature is valid by calculating the hash value of the specified stream using the specified hash algorithm and comparing it to the provided signature.

(Inherited from DSA)
VerifyData(Stream, Byte[], HashAlgorithmName, DSASignatureFormat)

Verifies that a digital signature is valid for the provided data.

(Inherited from DSA)
VerifyDataCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

Verifies that a digital signature is valid for the provided data.

(Inherited from DSA)
VerifyDataCore(Stream, ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

Verifies that a digital signature is valid for the provided data.

(Inherited from DSA)
VerifySignature(Byte[], Byte[])

Verifies if the specified digital signature matches the specified hash.

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

Verifies that a digital signature is valid for the provided hash.

(Inherited from DSA)
VerifySignature(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

Verifies that a digital signature is valid for a provided data hash.

(Inherited from DSA)
VerifySignature(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, DSASignatureFormat)

Verifies that a digital signature is valid for the provided hash.

(Inherited from DSA)
VerifySignatureCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, DSASignatureFormat)

Verifies that a digital signature is valid for the provided hash.

(Inherited from DSA)

Applies to