SignedCms SignedCms SignedCms SignedCms Class

定義

SignedCms 類別可以對 CMS/PKCS #7 訊息進行簽署和驗證。The SignedCms class enables signing and verifying of CMS/PKCS #7 messages.

public ref class SignedCms sealed
public sealed class SignedCms
type SignedCms = class
Public NotInheritable Class SignedCms
繼承
SignedCmsSignedCmsSignedCmsSignedCms

備註

密碼編譯訊息語法 RFC 與這些內容的型別,指定 CMS/PKCS #7 訊息的檔案名稱副檔名與下列 MIME 類型。The Cryptographic Message Syntax RFC specifies the following MIME types and file name extensions for CMS/PKCS #7 messages with these content types.

內容類型Content type MIME 類型MIME type 副檔名Extension
envelopedDataenvelopedData application/pkcs7-mimeapplication/pkcs7-mime .p7m.p7m
signedDatasignedData application/pkcs7-signatureapplication/pkcs7-signature .p7s.p7c.p7s.p7c

建構函式

SignedCms() SignedCms() SignedCms() SignedCms()

SignedCms() 建構函式會建立 SignedCms 類別的執行個體。The SignedCms() constructor creates an instance of the SignedCms class.

SignedCms(ContentInfo) SignedCms(ContentInfo) SignedCms(ContentInfo) SignedCms(ContentInfo)

SignedCms(ContentInfo) 建構函式會使用指定的內容資訊做為內部內容,建立 SignedCms 類別的執行個體。The SignedCms(ContentInfo) constructor creates an instance of the SignedCms class by using the specified content information as the inner content.

SignedCms(ContentInfo, Boolean) SignedCms(ContentInfo, Boolean) SignedCms(ContentInfo, Boolean) SignedCms(ContentInfo, Boolean)

SignedCms(ContentInfo, Boolean) 建構函式會使用指定的內容資訊做為內部內容以及使用中斷連結狀態,建立 SignedCms 類別的執行個體。The SignedCms(ContentInfo, Boolean) constructor creates an instance of the SignedCms class by using the specified content information as the inner content and by using the detached state.

SignedCms(SubjectIdentifierType) SignedCms(SubjectIdentifierType) SignedCms(SubjectIdentifierType) SignedCms(SubjectIdentifierType)

SignedCms(SubjectIdentifierType) 建構函式會藉由使用指定的主旨識別項型別做為簽署人的預設主旨識別項型別,建立 SignedCms 類別的執行個體。The SignedCms(SubjectIdentifierType) constructor creates an instance of the SignedCms class by using the specified subject identifier type as the default subject identifier type for signers.

SignedCms(SubjectIdentifierType, ContentInfo) SignedCms(SubjectIdentifierType, ContentInfo) SignedCms(SubjectIdentifierType, ContentInfo) SignedCms(SubjectIdentifierType, ContentInfo)

SignedCms(SubjectIdentifierType, ContentInfo) 建構函式會藉由使用指定的主旨識別項型別做為簽署人的預設主旨識別項型別,以及使用內容資訊做為內部內容,建立 SignedCms 類別的執行個體。The SignedCms(SubjectIdentifierType, ContentInfo) constructor creates an instance of the SignedCms class by using the specified subject identifier type as the default subject identifier type for signers and content information as the inner content.

SignedCms(SubjectIdentifierType, ContentInfo, Boolean) SignedCms(SubjectIdentifierType, ContentInfo, Boolean) SignedCms(SubjectIdentifierType, ContentInfo, Boolean) SignedCms(SubjectIdentifierType, ContentInfo, Boolean)

SignedCms(SubjectIdentifierType, ContentInfo, Boolean) 建構函式會藉由使用指定的主旨識別項型別做為簽署人的預設主旨識別項型別、使用內容資訊做為內部內容,以及使用中斷連結狀態,建立 SignedCms 類別的執行個體。The SignedCms(SubjectIdentifierType, ContentInfo, Boolean) constructor creates an instance of the SignedCms class by using the specified subject identifier type as the default subject identifier type for signers, the content information as the inner content, and by using the detached state.

屬性

Certificates Certificates Certificates Certificates

Certificates 屬性會擷取與已編碼之 CMS/PKCS #7 訊息關聯的憑證。The Certificates property retrieves the certificates associated with the encoded CMS/PKCS #7 message.

ContentInfo ContentInfo ContentInfo ContentInfo

ContentInfo 屬性會擷取已編碼之 CMS/PKCS #7 訊息的內部內容。The ContentInfo property retrieves the inner contents of the encoded CMS/PKCS #7 message.

Detached Detached Detached Detached

Detached 屬性會擷取 SignedCms 物件是否用於中斷簽章。The Detached property retrieves whether the SignedCms object is for a detached signature.

SignerInfos SignerInfos SignerInfos SignerInfos

SignerInfos 屬性會擷取與 CMS/PKCS #7 訊息關聯的 SignerInfoCollection 集合。The SignerInfos property retrieves the SignerInfoCollection collection associated with the CMS/PKCS #7 message.

Version Version Version Version

Version 屬性會擷取 CMS/PKCS #7 訊息的版本。The Version property retrieves the version of the CMS/PKCS #7 message.

方法

AddCertificate(X509Certificate2) AddCertificate(X509Certificate2) AddCertificate(X509Certificate2) AddCertificate(X509Certificate2)
CheckHash() CheckHash() CheckHash() CheckHash()

CheckHash() 方法會驗證 CMS/PKCS #7 訊息的資料完整性。The CheckHash() method verifies the data integrity of the CMS/PKCS #7 message. CheckHash() 是用於只想檢查 CMS郵件雜湊而不想執行完整數位簽章驗證之特定安全性基礎架構應用程式的特殊方法。CheckHash() is a specialized method used in specific security infrastructure applications that only wish to check the hash of the CMS message, rather than perform a full digital signature verification. CheckHash() 不會驗證訊息的作者或寄件人,因為這個方法未涉及驗證數位簽章。CheckHash() does not authenticate the author nor sender of the message because this method does not involve verifying a digital signature. 如需為一般目的而檢查 CMS/PKCS #7 訊息的完整性和真實性,請使用 CheckSignature(Boolean)CheckSignature(X509Certificate2Collection, Boolean) 方法。For general-purpose checking of the integrity and authenticity of a CMS/PKCS #7 message, use the CheckSignature(Boolean) or CheckSignature(X509Certificate2Collection, Boolean) methods.

CheckSignature(Boolean) CheckSignature(Boolean) CheckSignature(Boolean) CheckSignature(Boolean)

CheckSignature(Boolean) 方法會驗證已簽署之 CMS/PKCS #7 訊息上的數位簽章,而且可以選擇性地驗證簽署人的憑證。The CheckSignature(Boolean) method verifies the digital signatures on the signed CMS/PKCS #7 message and, optionally, validates the signers' certificates.

CheckSignature(X509Certificate2Collection, Boolean) CheckSignature(X509Certificate2Collection, Boolean) CheckSignature(X509Certificate2Collection, Boolean) CheckSignature(X509Certificate2Collection, Boolean)

CheckSignature(X509Certificate2Collection, Boolean) 方法會藉由使用指定的憑證集合,驗證已簽署之 CMS/PKCS #7 訊息上的數位簽章,而且可以選擇性地驗證簽署人的憑證。The CheckSignature(X509Certificate2Collection, Boolean) method verifies the digital signatures on the signed CMS/PKCS #7 message by using the specified collection of certificates and, optionally, validates the signers' certificates.

ComputeSignature() ComputeSignature() ComputeSignature() ComputeSignature()

建立簽章,並將簽章新增至 CMS/PKCS #7 訊息。Creates a signature and adds the signature to the CMS/PKCS #7 message.

ComputeSignature(CmsSigner) ComputeSignature(CmsSigner) ComputeSignature(CmsSigner) ComputeSignature(CmsSigner)

ComputeSignature(CmsSigner) 方法會使用指定的簽署人建立簽章,並將簽章加入至 CMS/PKCS #7 訊息。The ComputeSignature(CmsSigner) method creates a signature using the specified signer and adds the signature to the CMS/PKCS #7 message.

ComputeSignature(CmsSigner, Boolean) ComputeSignature(CmsSigner, Boolean) ComputeSignature(CmsSigner, Boolean) ComputeSignature(CmsSigner, Boolean)

使用指定的簽署人建立簽章,並將簽章加入至 CMS/PKCS #7 訊息。Creates a signature using the specified signer and adds the signature to the CMS/PKCS #7 message.

Decode(Byte[]) Decode(Byte[]) Decode(Byte[]) Decode(Byte[])

Decode(Byte[]) 方法會對已編碼的 SignedCms 訊息進行解碼。The Decode(Byte[]) method decodes an encoded SignedCms message. 在成功解碼後,就可以從 SignedCms 物件的屬性擷取解碼資訊。Upon successful decoding, the decoded information can be retrieved from the properties of the SignedCms object.

Encode() Encode() Encode() Encode()

Encode() 方法會將物件中的資訊編碼為 CMS/PKCS #7 訊息。The Encode() method encodes the information in the object into a CMS/PKCS #7 message.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
RemoveCertificate(X509Certificate2) RemoveCertificate(X509Certificate2) RemoveCertificate(X509Certificate2) RemoveCertificate(X509Certificate2)
RemoveSignature(Int32) RemoveSignature(Int32) RemoveSignature(Int32) RemoveSignature(Int32)

移除 SignerInfos 集合中指定索引處的簽章。Removes the signature at the specified index of the SignerInfos collection.

RemoveSignature(SignerInfo) RemoveSignature(SignerInfo) RemoveSignature(SignerInfo) RemoveSignature(SignerInfo)

RemoveSignature(SignerInfo) 方法會移除指定之 SignerInfo 物件的簽章。The RemoveSignature(SignerInfo) method removes the signature for the specified SignerInfo object.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於