summary refs log tree commit diff
path: root/crypto/src/cms
diff options
context:
space:
mode:
authorOren Novotny <oren@novotny.org>2018-10-06 09:02:41 -0400
committerOren Novotny <oren@novotny.org>2018-10-06 09:02:41 -0400
commit3350bb30259861952a800527756f39df2c140b5b (patch)
tree31944d5ec252481a88371c4ff9a4bcca9389b1a9 /crypto/src/cms
parentrename entrypoint (diff)
parentFix initialization checks (diff)
downloadBouncyCastle.NET-ed25519-3350bb30259861952a800527756f39df2c140b5b.tar.xz
merge from master
Diffstat (limited to 'crypto/src/cms')
-rw-r--r--crypto/src/cms/SignerInformation.cs24
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; }