다음을 통해 공유


SignedCms.ComputeSignature 메서드

정의

서명을 만들고 CMS/PKCS #7 메시지에 서명을 추가합니다.

오버로드

Name Description
ComputeSignature(CmsSigner, Boolean)

지정된 서명자를 사용하여 서명을 만들고 CMS/PKCS #7 메시지에 서명을 추가합니다.

ComputeSignature()

서명을 만들고 CMS/PKCS #7 메시지에 서명을 추가합니다.

ComputeSignature(CmsSigner)

지정된 서명자를 사용하여 서명을 만들고 CMS/PKCS #7 메시지에 서명을 추가합니다.

ComputeSignature(CmsSigner, Boolean)

Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs

지정된 서명자를 사용하여 서명을 만들고 CMS/PKCS #7 메시지에 서명을 추가합니다.

public:
 void ComputeSignature(System::Security::Cryptography::Pkcs::CmsSigner ^ signer, bool silent);
public void ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner signer, bool silent);
member this.ComputeSignature : System.Security.Cryptography.Pkcs.CmsSigner * bool -> unit
Public Sub ComputeSignature (signer As CmsSigner, silent As Boolean)

매개 변수

signer
CmsSigner

CmsSigner 서명자를 나타내는 개체입니다.

silent
Boolean

.NET Core 및 .NET 5+만 해당: true PIN 프롬프트가 비활성화된 상태로 여는 키를 요청하려면 지원되는 경우, 그렇지 않으면 false. .NET Framework에서는 이 매개 변수가 사용되지 않으며 필요한 경우 PIN 프롬프트가 항상 표시됩니다.

예외

signernull입니다.

암호화 작업을 완료할 수 없습니다.

.NET Framework만 해당: 서명 인증서가 지정되지 않았습니다.

.NET Core 및 .NET 5+만 해당: 서명 인증서가 지정되지 않았습니다.

설명

.NET Core만 해당: 값이 silent null이 아니면 매개 변수가 CmsSigner.PrivateKey 적용되지 않습니다. 제공된 값은 서명을 계산할 때 PIN 프롬프트가 표시되는지 여부를 제어합니다. 속성이 PrivateKey null이고 매개 변수가 silent 설정된 true경우에도 운영 체제와 서명자 옵션의 일부 조합으로 인해 PIN 프롬프트가 계속 발생할 수 있습니다.

.NET Framework에서 사용자 인터페이스를 표시하려면 다음 권한이 필요합니다.

.NET Framework의 서명 키에 액세스하려면 다음 권한이 필요합니다.

적용 대상

ComputeSignature()

Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs

서명을 만들고 CMS/PKCS #7 메시지에 서명을 추가합니다.

public:
 void ComputeSignature();
public void ComputeSignature();
member this.ComputeSignature : unit -> unit
Public Sub ComputeSignature ()

예외

받는 사람 인증서가 지정되지 않았습니다.

설명

이 메서드는 생성자 오버로드 중 SignedCms 하나의 인수로 signerIdentifierType 제공된 경우 SubjectIdentifierType.NoSignature 성공합니다. 그렇지 않으면 예외가 throw됩니다.

.NET Framework의 서명 키에 액세스하려면 다음 권한이 필요합니다.

적용 대상

ComputeSignature(CmsSigner)

Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs
Source:
SignedCms.cs

지정된 서명자를 사용하여 서명을 만들고 CMS/PKCS #7 메시지에 서명을 추가합니다.

public:
 void ComputeSignature(System::Security::Cryptography::Pkcs::CmsSigner ^ signer);
public void ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner signer);
member this.ComputeSignature : System.Security.Cryptography.Pkcs.CmsSigner -> unit
Public Sub ComputeSignature (signer As CmsSigner)

매개 변수

signer
CmsSigner

CmsSigner 서명자를 나타내는 개체입니다.

예외

null 참조가 유효한 인수로 허용되지 않는 메서드에 전달되었습니다.

암호화 작업을 완료할 수 없습니다.

예제

다음 예제에서는 분리되지 않은 메시지 콘텐츠가 포함된 메시지의 SignedCms 서명을 계산하는 단계를 보여 있습니다. 이 경우 메시지 콘텐츠가 메시지에 포함 SignedCms 됩니다.

// The dataToSign byte array holds the data to be signed.
ContentInfo contentInfo = new ContentInfo(dataToSign);

// Create a new, nondetached SignedCms message.
SignedCms signedCms = new SignedCms(contentInfo);

// Sign the message.
signedCms.ComputeSignature();

// Encode the message.
byte[] myCmsMessage = signedCms.Encode();

// The signed CMS/PKCS #7 message is ready to send.
// The original content is included in this byte array.
' The dataToSign byte array holds the data to be signed.
Dim contentInfo As New ContentInfo(dataToSign)

' Create a new, nondetached SignedCms message.
Dim signedCms As New SignedCms(contentInfo)

' Sign the message.
signedCms.ComputeSignature()

' Encode the message.
Dim myCmsMessage As Byte() = signedCms.Encode()

' The signed CMS/PKCS #7 message is ready to send.
' The original content is included in this byte array.

다음 예제에서는 분리된 메시지 콘텐츠가 포함된 메시지의 SignedCms 서명을 계산하는 단계를 보여 있습니다. 이 경우 메시지 콘텐츠는 메시지와 독립적으로 SignedCms 확인해야 합니다.

// The dataToSign byte array holds the data to be signed.
ContentInfo contentInfo = new ContentInfo(dataToSign);

// Create a new, detached SignedCms message.
SignedCms signedCms = new SignedCms(contentInfo, true);

// Sign the message.
signedCms.ComputeSignature();

// Encode the message.
byte[] myCmsMessage = signedCms.Encode();

// The signed CMS/PKCS #7 message is ready to send.
// The original content is not included in this byte array.
' The dataToSign byte array holds the data to be signed.
Dim contentInfo As New ContentInfo(dataToSign)

' Create a new, detached SignedCms message.
Dim signedCms As New SignedCms(contentInfo, True)

' Sign the message.
signedCms.ComputeSignature()

' Encode the message.
Dim myCmsMessage As Byte() = signedCms.Encode()

' The signed CMS/PKCS #7 message is ready to send.
' The original content is not included in this byte array.

설명

.NET Framework의 서명 키에 액세스하려면 다음 권한이 필요합니다.

적용 대상