Discuss this help topic in SecureBlackbox Forum
Countersign CMS signature
'Countersigning a signature' means 'signing an existing signature'. A countersignature is always created over an existing signature and is used whenever a third party wants to certify the integrity of the original signature, or the information contained in it. In the CMS structure, a countersignature is stored as an unsigned attribute (so you can add or remove countersignatures without affecting the integrity of the signature). Format-wise, a countersignature is a valid CMS signature itself, therefore it may contain its own countersignatures, effectively forming a signature tree.
To add a countersignature:
int idx = sig.AddCountersignature();
TElCMSSignature csig = sig.get_Countersignatures(idx);
csig.SigningTime = DateTime.UtcNow;
csig.DigestAlgorithm = SBConstants.Unit.SB_ALGORITHM_DGST_SHA256;
...
csig.Sign(cert, null);