internal unsafe void AddCountersignature(CmsSigner cmsSigner, CngKey privateKey) { using (var hb = new HeapBlockRetainer()) { var signerInfo = NativeUtility.CreateSignerInfo(cmsSigner, privateKey, hb); NativeUtility.ThrowIfFailed(NativeMethods.CryptMsgCountersign( _handle, dwIndex: 0, cCountersigners: 1, rgCountersigners: signerInfo)); AddCertificates(CertificateUtility.GetRawDataForCollection(cmsSigner.Certificates)); } }