diff options
author | Oren Novotny <oren@novotny.org> | 2018-10-06 09:02:41 -0400 |
---|---|---|
committer | Oren Novotny <oren@novotny.org> | 2018-10-06 09:02:41 -0400 |
commit | 3350bb30259861952a800527756f39df2c140b5b (patch) | |
tree | 31944d5ec252481a88371c4ff9a4bcca9389b1a9 /crypto/src/cms | |
parent | rename entrypoint (diff) | |
parent | Fix initialization checks (diff) | |
download | BouncyCastle.NET-ed25519-3350bb30259861952a800527756f39df2c140b5b.tar.xz |
merge from master
Diffstat (limited to 'crypto/src/cms')
-rw-r--r-- | crypto/src/cms/SignerInformation.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crypto/src/cms/SignerInformation.cs b/crypto/src/cms/SignerInformation.cs index dad128263..39ecfa6d3 100644 --- a/crypto/src/cms/SignerInformation.cs +++ b/crypto/src/cms/SignerInformation.cs @@ -84,6 +84,30 @@ namespace Org.BouncyCastle.Cms this.digestCalculator = digestCalculator; } + /** + * Protected constructor. In some cases clients have their own idea about how to encode + * the signed attributes and calculate the signature. This constructor is to allow developers + * to deal with that by extending off the class and overridng methods like getSignedAttributes(). + * + * @param baseInfo the SignerInformation to base this one on. + */ + protected SignerInformation(SignerInformation baseInfo) + { + this.info = baseInfo.info; + this.contentType = baseInfo.contentType; + this.isCounterSignature = baseInfo.IsCounterSignature; + this.sid = baseInfo.SignerID; + this.digestAlgorithm = info.DigestAlgorithm; + this.signedAttributeSet = info.AuthenticatedAttributes; + this.unsignedAttributeSet = info.UnauthenticatedAttributes; + this.encryptionAlgorithm = info.DigestEncryptionAlgorithm; + this.signature = info.EncryptedDigest.GetOctets(); + this.content = baseInfo.content; + this.resultDigest = baseInfo.resultDigest; + this.signedAttributeTable = baseInfo.signedAttributeTable; + this.unsignedAttributeTable = baseInfo.unsignedAttributeTable; + } + public bool IsCounterSignature { get { return isCounterSignature; } |