DSASignatureFormatter Constructors

Definition

Initializes a new instance of the DSASignatureFormatter class.

Overloads

DSASignatureFormatter()

Initializes a new instance of the DSASignatureFormatter class.

DSASignatureFormatter(AsymmetricAlgorithm)

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

DSASignatureFormatter()

Source:
DSASignatureFormatter.cs
Source:
DSASignatureFormatter.cs
Source:
DSASignatureFormatter.cs

Initializes a new instance of the DSASignatureFormatter class.

C#
public DSASignatureFormatter();

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

DSASignatureFormatter(AsymmetricAlgorithm)

Source:
DSASignatureFormatter.cs
Source:
DSASignatureFormatter.cs
Source:
DSASignatureFormatter.cs

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

C#
public DSASignatureFormatter(System.Security.Cryptography.AsymmetricAlgorithm key);

Parameters

key
AsymmetricAlgorithm

The instance of the Digital Signature Algorithm (DSA) that holds the key.

Exceptions

key is null.

Examples

C#
using System;
using System.Security.Cryptography;

class DSASample
{
        
    static void Main()
    {
        try
        {
            //Create a new instance of DSA.
            DSA DSA = DSA.Create();

            //The hash to sign.
            byte[] Hash = {59,4,248,102,77,97,142,201,210,12,224,93,25,41,100,197,213,134,130,135};

            //Create an DSASignatureFormatter object and pass it the 
            //DSA instance to transfer the key information.
            DSASignatureFormatter DSAFormatter = new DSASignatureFormatter(DSA);

            //Set the hash algorithm to SHA1.
            DSAFormatter.SetHashAlgorithm("SHA1");

            //Create a signature for HashValue and return it.
            byte[] SignedHash = DSAFormatter.CreateSignature(Hash);
        }
        catch(CryptographicException e)
        {
            Console.WriteLine(e.Message);
        }
    }
}

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1