Co-signatures
PKI SDK lets you group different signers of the same document in a single signature package. These parallel signatures are called co-signatures, and the CAdES standard provides for them.
The example below shows a basic co-signature:
// Previous basic CAdES signature
byte[] cadesSig1 = ...
// Co-signing the cadesSig1 signature
PKCertificateWithKey signingCert2 = ...
var signer2 = new CadesSigner();
signer2.SetSigningCertificate(signingCert2);
signer2.SetDataToSign(toSign);
signer2.SetPolicy(policy);
// Setting the previous signature to co-sign
signer2.SetSignatureToCoSign(cadesSig1);
signer2.ComputeSignature();
byte[] cadesCoSig = signer2.GetSignature();
If the cadesSig1 signature already has the signed document in its encapsulated content, you don't need to call @Lacuna.Pki.Cades.CadesSigner.SetDataToSign(System.Byte[]) on the co-signature.
If you have parallel signatures of the same document that were created without
@Lacuna.Pki.Cades.CadesSigner.SetSignatureToCoSign(System.Byte[]), you can still merge them into a co-signature with the
Lacuna.Pki.Cades.CadesSignatureEditor.MergeSignatures(IEnumerable<Lacuna.Pki.Cades.CadesSignature>) method of the
@Lacuna.Pki.Cades.CadesSignatureEditor class.
See also
- @Lacuna.Pki.Cades.CadesSigner
- @Lacuna.Pki.Cades.CadesSignatureEditor