DSASignatureFormatter 클래스

정의

디지털 서명 알고리즘(DSA) 서명을 만듭니다.Creates a Digital Signature Algorithm (DSA) signature.

public ref class DSASignatureFormatter : System::Security::Cryptography::AsymmetricSignatureFormatter
[System.Runtime.InteropServices.ComVisible(true)]
public class DSASignatureFormatter : System.Security.Cryptography.AsymmetricSignatureFormatter
type DSASignatureFormatter = class
    inherit AsymmetricSignatureFormatter
Public Class DSASignatureFormatter
Inherits AsymmetricSignatureFormatter
상속
DSASignatureFormatter
특성

예제

#using <System.dll>

using namespace System;
using namespace System::Security::Cryptography;
int main()
{
   try
   {
      
      //Create a new instance of DSACryptoServiceProvider.
      DSACryptoServiceProvider^ DSA = gcnew DSACryptoServiceProvider;
      
      //The hash to sign.
      array<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 
      //DSACryptoServiceProvider to transfer the key information.
      DSASignatureFormatter^ DSAFormatter = gcnew DSASignatureFormatter( DSA );
      
      //Set the hash algorithm to SHA1.
      DSAFormatter->SetHashAlgorithm( "SHA1" );
      
      //Create a signature for HashValue and return it.
      array<Byte>^SignedHash = DSAFormatter->CreateSignature( Hash );
   }
   catch ( CryptographicException^ e ) 
   {
      Console::WriteLine( e->Message );
   }

}

using System;
using System.Security.Cryptography;

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

            //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 
            //DSACryptoServiceProvider 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);
        }
    }

}
Imports System.Security.Cryptography

 _

Class DSASample


    Shared Sub Main()
        Try
            'Create a new instance of DSACryptoServiceProvider.
            Dim DSA As New DSACryptoServiceProvider()

            'The hash to sign.
            Dim Hash As Byte() = {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 
            'DSACryptoServiceProvider to transfer the key information.
            Dim DSAFormatter As New DSASignatureFormatter(DSA)

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

            'Create a signature for HashValue and return it.
            Dim SignedHash As Byte() = DSAFormatter.CreateSignature(Hash)

        Catch e As CryptographicException
            Console.WriteLine(e.Message)
        End Try
    End Sub
End Class

생성자

DSASignatureFormatter()

DSASignatureFormatter 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the DSASignatureFormatter class.

DSASignatureFormatter(AsymmetricAlgorithm)

지정된 키를 사용하여 DSASignatureFormatter 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the DSASignatureFormatter class with the specified key.

메서드

CreateSignature(Byte[])

지정된 데이터에 대해 디지털 서명 알고리즘(DSA) PKCS #1 서명을 만듭니다.Creates the Digital Signature Algorithm (DSA) PKCS #1 signature for the specified data.

CreateSignature(HashAlgorithm)

지정된 해시 값의 서명을 만듭니다.Creates the signature from the specified hash value.

(다음에서 상속됨 AsymmetricSignatureFormatter)
Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified object is equal to the current object.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(다음에서 상속됨 Object)
SetHashAlgorithm(String)

디지털 서명 알고리즘(DSA) 서명 형성자에 대해 해시 알고리즘을 지정합니다.Specifies the hash algorithm for the Digital Signature Algorithm (DSA) signature formatter.

SetKey(AsymmetricAlgorithm)

디지털 서명 알고리즘(DSA) 서명 형성자를 위해 사용되는 키를 지정합니다.Specifies the key to be used for the Digital Signature Algorithm (DSA) signature formatter.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(다음에서 상속됨 Object)

적용 대상

추가 정보