SignedCmsBuilderSign Method

Signs current PKCS#7 message and adds a new signer information to SignerInfos collection. Certificates specified in chain parameter are added to Certificates collection.

Definition

Namespace: SysadminsLV.PKI.Cryptography.Pkcs
Assembly: SysadminsLV.PKI (in SysadminsLV.PKI.dll) Version: 4.0.1
C#
public DefaultSignedPkcs7 Sign(
	ICryptSigner signer,
	X509Certificate2Collection chain = null
)

Parameters

signer  ICryptSigner
signing object that contains public certificate, private key and signing configuration.
chain  X509Certificate2Collection  (Optional)
Signing certificate chain to add to CMS. This parameter is optional. If not specified, only leaf (signing) certificate is added to Certificates collection and signed message.

Return Value

DefaultSignedPkcs7
An instance of DefaultSignedPkcs7 class that represents signed CMS message.

Remarks

You can call this method multiple times to attach multiple signatures to signed CMS message.

Exceptions

InvalidOperationException No data to sign was passed in the constructor.

See Also