summary refs log tree commit diff
path: root/crypto/src/asn1/DerTaggedObject.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-11-12 01:54:30 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-11-12 01:54:30 +0700
commit8c32dba3fc4f2033e7597ee1999e793cf6552584 (patch)
treec48d45537cfbea6f7e0ab92de4793a2b35204573 /crypto/src/asn1/DerTaggedObject.cs
parentAdd new Equals method (diff)
downloadBouncyCastle.NET-ed25519-8c32dba3fc4f2033e7597ee1999e793cf6552584.tar.xz
Reimplement application-specific over tagged object
Diffstat (limited to 'crypto/src/asn1/DerTaggedObject.cs')
-rw-r--r--crypto/src/asn1/DerTaggedObject.cs55
1 files changed, 33 insertions, 22 deletions
diff --git a/crypto/src/asn1/DerTaggedObject.cs b/crypto/src/asn1/DerTaggedObject.cs
index e58590c8d..66f804ebb 100644
--- a/crypto/src/asn1/DerTaggedObject.cs
+++ b/crypto/src/asn1/DerTaggedObject.cs
@@ -13,38 +13,44 @@ namespace Org.BouncyCastle.Asn1
         private int m_contentsLengthDer = -1;
 
         /**
-		 * @param tagNo the tag number for this object.
-		 * @param obj the tagged object.
+		 * create an implicitly tagged object that contains a zero
+		 * length sequence.
 		 */
-        public DerTaggedObject(
-			int				tagNo,
-			Asn1Encodable	obj)
-			: base(tagNo, obj)
+        [Obsolete("Will be removed")]
+        public DerTaggedObject(int tagNo)
+            : base(false, tagNo, DerSequence.Empty)
+        {
+        }
+
+        public DerTaggedObject(int tagNo, Asn1Encodable obj)
+			: base(true, tagNo, obj)
 		{
 		}
 
-		/**
-		 * @param explicitly true if an explicitly tagged object.
+        public DerTaggedObject(int tagClass, int tagNo, Asn1Encodable obj)
+            : base(true, tagClass, tagNo, obj)
+        {
+        }
+
+        /**
+		 * @param isExplicit true if an explicitly tagged object.
 		 * @param tagNo the tag number for this object.
 		 * @param obj the tagged object.
 		 */
-		public DerTaggedObject(
-			bool			explicitly,
-			int				tagNo,
-			Asn1Encodable	obj)
-			: base(explicitly, tagNo, obj)
+        public DerTaggedObject(bool isExplicit, int tagNo, Asn1Encodable obj)
+			: base(isExplicit, tagNo, obj)
 		{
 		}
 
-		/**
-		 * create an implicitly tagged object that contains a zero
-		 * length sequence.
-		 */
-		public DerTaggedObject(
-			int tagNo)
-			: base(false, tagNo, DerSequence.Empty)
-		{
-		}
+        public DerTaggedObject(bool isExplicit, int tagClass, int tagNo, Asn1Encodable obj)
+            : base(isExplicit, tagClass, tagNo, obj)
+        {
+        }
+
+        internal DerTaggedObject(int explicitness, int tagClass, int tagNo, Asn1Encodable obj)
+            : base(explicitness, tagClass, tagNo, obj)
+        {
+        }
 
         internal override string Asn1Encoding
         {
@@ -108,6 +114,11 @@ namespace Org.BouncyCastle.Asn1
             return new DerSequence(asn1Object);
         }
 
+        internal override Asn1TaggedObject ReplaceTag(int tagClass, int tagNo)
+        {
+            return new DerTaggedObject(explicitness, tagClass, tagNo, obj);
+        }
+
         private int GetContentsLengthDer(Asn1Object baseObject, bool withBaseID)
         {
             if (m_contentsLengthDer < 0)