Skip to content

Commit 8b8a625

Browse files
committed
Add new SignerInformation protected constructor
1 parent 6e4b978 commit 8b8a625

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

crypto/src/cms/SignerInformation.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,30 @@ internal SignerInformation(
8484
this.digestCalculator = digestCalculator;
8585
}
8686

87+
/**
88+
* Protected constructor. In some cases clients have their own idea about how to encode
89+
* the signed attributes and calculate the signature. This constructor is to allow developers
90+
* to deal with that by extending off the class and overridng methods like getSignedAttributes().
91+
*
92+
* @param baseInfo the SignerInformation to base this one on.
93+
*/
94+
protected SignerInformation(SignerInformation baseInfo)
95+
{
96+
this.info = baseInfo.info;
97+
this.contentType = baseInfo.contentType;
98+
this.isCounterSignature = baseInfo.IsCounterSignature;
99+
this.sid = baseInfo.SignerID;
100+
this.digestAlgorithm = info.DigestAlgorithm;
101+
this.signedAttributeSet = info.AuthenticatedAttributes;
102+
this.unsignedAttributeSet = info.UnauthenticatedAttributes;
103+
this.encryptionAlgorithm = info.DigestEncryptionAlgorithm;
104+
this.signature = info.EncryptedDigest.GetOctets();
105+
this.content = baseInfo.content;
106+
this.resultDigest = baseInfo.resultDigest;
107+
this.signedAttributeTable = baseInfo.signedAttributeTable;
108+
this.unsignedAttributeTable = baseInfo.unsignedAttributeTable;
109+
}
110+
87111
public bool IsCounterSignature
88112
{
89113
get { return isCounterSignature; }

0 commit comments

Comments
 (0)