RSAPKCS1SignatureFormatter 클래스

정의

RSA PKCS #1 버전 1.5 서명을 만듭니다.

public ref class RSAPKCS1SignatureFormatter : System::Security::Cryptography::AsymmetricSignatureFormatter
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public class RSAPKCS1SignatureFormatter : System.Security.Cryptography.AsymmetricSignatureFormatter
public class RSAPKCS1SignatureFormatter : System.Security.Cryptography.AsymmetricSignatureFormatter
[System.Runtime.InteropServices.ComVisible(true)]
public class RSAPKCS1SignatureFormatter : System.Security.Cryptography.AsymmetricSignatureFormatter
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
type RSAPKCS1SignatureFormatter = class
    inherit AsymmetricSignatureFormatter
type RSAPKCS1SignatureFormatter = class
    inherit AsymmetricSignatureFormatter
[<System.Runtime.InteropServices.ComVisible(true)>]
type RSAPKCS1SignatureFormatter = class
    inherit AsymmetricSignatureFormatter
Public Class RSAPKCS1SignatureFormatter
Inherits AsymmetricSignatureFormatter
상속
RSAPKCS1SignatureFormatter
특성

예제

다음 예제에서는 PKCS #1 버전 1.5 서명을 만드는 방법을 보여 줍니다.

using System;
using System.Security.Cryptography;

class RSASample
{

    static void Main()
    {
        try
        {
            //Create a new instance of RSA.
            using (RSA rsa = RSA.Create())
            {
                //The hash to sign.
                byte[] hash;
                using (SHA256 sha256 = SHA256.Create())
                {
                    byte[] data = new byte[] { 59, 4, 248, 102, 77, 97, 142, 201, 210, 12, 224, 93, 25, 41, 100, 197, 213, 134, 130, 135 };
                    hash = sha256.ComputeHash(data);
                }

                //Create an RSASignatureFormatter object and pass it the 
                //RSA instance to transfer the key information.
                RSAPKCS1SignatureFormatter RSAFormatter = new RSAPKCS1SignatureFormatter(rsa);

                //Set the hash algorithm to SHA256.
                RSAFormatter.SetHashAlgorithm("SHA256");

                //Create a signature for HashValue and return it.
                byte[] SignedHash = RSAFormatter.CreateSignature(hash);
            }
        }
        catch (CryptographicException e)
        {
            Console.WriteLine(e.Message);
        }
    }
}
Imports System.Security.Cryptography

Friend Class RSASample

    Shared Sub Main()
        Try
            'Create a new instance of RSA.
            Using rsa As RSA = RSA.Create()
                'The hash to sign.
                Dim hash() As Byte
                Using sha256 As SHA256 = SHA256.Create()
                    Dim data() As Byte = { 59, 4, 248, 102, 77, 97, 142, 201, 210, 12, 224, 93, 25, 41, 100, 197, 213, 134, 130, 135 }
                    hash = sha256.ComputeHash(data)
                End Using

                'Create an RSASignatureFormatter object and pass it the 
                'RSA to transfer the key information.
                Dim RSAFormatter As New RSAPKCS1SignatureFormatter(rsa)

                'Set the hash algorithm to SHA256.
                RSAFormatter.SetHashAlgorithm("SHA256")

                'Create a signature for HashValue and return it.
                Dim SignedHash() As Byte = RSAFormatter.CreateSignature(hash)
            End Using

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

End Class

설명

이 클래스는 알고리즘을 사용하여 RSA 디지털 서명을 만드는 데 사용됩니다.

를 사용하여 RSAPKCS1SignatureDeformatter 알고리즘을 사용하여 디지털 서명을 확인합니다 RSA .

생성자

RSAPKCS1SignatureFormatter()

RSAPKCS1SignatureFormatter 클래스의 새 인스턴스를 초기화합니다.

RSAPKCS1SignatureFormatter(AsymmetricAlgorithm)

지정된 키를 사용하여 RSAPKCS1SignatureFormatter 클래스의 새 인스턴스를 초기화합니다.

메서드

CreateSignature(Byte[])

지정된 데이터의 RSA PKCS #1 서명을 생성합니다.

CreateSignature(HashAlgorithm)

지정된 해시 값의 서명을 만듭니다.

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

지정된 개체가 현재 개체와 같은지 확인합니다.

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

기본 해시 함수로 작동합니다.

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

현재 인스턴스의 Type을 가져옵니다.

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

현재 Object의 단순 복사본을 만듭니다.

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

서명을 만드는 데 사용할 해시 알고리즘을 설정합니다.

SetKey(AsymmetricAlgorithm)

서명을 만드는 데 사용할 프라이빗 키를 설정합니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보