summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/src/asn1/Asn1Object.cs2
-rw-r--r--crypto/src/asn1/Asn1ObjectDescriptor.cs5
-rw-r--r--crypto/src/asn1/Asn1Sequence.cs5
-rw-r--r--crypto/src/asn1/Asn1Set.cs5
-rw-r--r--crypto/src/asn1/BERBitString.cs9
-rw-r--r--crypto/src/asn1/BerOctetString.cs9
-rw-r--r--crypto/src/asn1/BerTaggedObject.cs10
-rw-r--r--crypto/src/asn1/DERExternal.cs6
-rw-r--r--crypto/src/asn1/DerApplicationSpecific.cs5
-rw-r--r--crypto/src/asn1/DerBMPString.cs5
-rw-r--r--crypto/src/asn1/DerBitString.cs5
-rw-r--r--crypto/src/asn1/DerBoolean.cs5
-rw-r--r--crypto/src/asn1/DerEnumerated.cs5
-rw-r--r--crypto/src/asn1/DerGeneralString.cs7
-rw-r--r--crypto/src/asn1/DerGeneralizedTime.cs5
-rw-r--r--crypto/src/asn1/DerGraphicString.cs5
-rw-r--r--crypto/src/asn1/DerIA5String.cs7
-rw-r--r--crypto/src/asn1/DerInteger.cs7
-rw-r--r--crypto/src/asn1/DerNull.cs5
-rw-r--r--crypto/src/asn1/DerNumericString.cs7
-rw-r--r--crypto/src/asn1/DerObjectIdentifier.cs5
-rw-r--r--crypto/src/asn1/DerOctetString.cs7
-rw-r--r--crypto/src/asn1/DerPrintableString.cs7
-rw-r--r--crypto/src/asn1/DerT61String.cs5
-rw-r--r--crypto/src/asn1/DerTaggedObject.cs9
-rw-r--r--crypto/src/asn1/DerUTCTime.cs7
-rw-r--r--crypto/src/asn1/DerUTF8String.cs5
-rw-r--r--crypto/src/asn1/DerUniversalString.cs7
-rw-r--r--crypto/src/asn1/DerVideotexString.cs5
-rw-r--r--crypto/src/asn1/DerVisibleString.cs7
30 files changed, 164 insertions, 19 deletions
diff --git a/crypto/src/asn1/Asn1Object.cs b/crypto/src/asn1/Asn1Object.cs
index 415c0a721..2f438c236 100644
--- a/crypto/src/asn1/Asn1Object.cs
+++ b/crypto/src/asn1/Asn1Object.cs
@@ -62,6 +62,8 @@ namespace Org.BouncyCastle.Asn1
             return this;
         }
 
+        internal abstract bool EncodeConstructed();
+
         internal abstract int EncodedLength(bool withID);
 
         internal abstract void Encode(Asn1OutputStream asn1Out, bool withID);
diff --git a/crypto/src/asn1/Asn1ObjectDescriptor.cs b/crypto/src/asn1/Asn1ObjectDescriptor.cs
index 8472043e7..20158af8e 100644
--- a/crypto/src/asn1/Asn1ObjectDescriptor.cs
+++ b/crypto/src/asn1/Asn1ObjectDescriptor.cs
@@ -77,6 +77,11 @@ namespace Org.BouncyCastle.Asn1
             get { return m_baseGraphicString; }
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return m_baseGraphicString.EncodedLength(withID);
diff --git a/crypto/src/asn1/Asn1Sequence.cs b/crypto/src/asn1/Asn1Sequence.cs
index ecc773a1a..8ea554932 100644
--- a/crypto/src/asn1/Asn1Sequence.cs
+++ b/crypto/src/asn1/Asn1Sequence.cs
@@ -249,6 +249,11 @@ namespace Org.BouncyCastle.Asn1
             return true;
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return true;
+        }
+
         public override string ToString()
         {
             return CollectionUtilities.ToString(elements);
diff --git a/crypto/src/asn1/Asn1Set.cs b/crypto/src/asn1/Asn1Set.cs
index 8c6e2f0e4..91163417b 100644
--- a/crypto/src/asn1/Asn1Set.cs
+++ b/crypto/src/asn1/Asn1Set.cs
@@ -285,6 +285,11 @@ namespace Org.BouncyCastle.Asn1
 #endif
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return true;
+        }
+
         public override string ToString()
         {
             return CollectionUtilities.ToString(elements);
diff --git a/crypto/src/asn1/BERBitString.cs b/crypto/src/asn1/BERBitString.cs
index 1756ee9c0..156ea2d1f 100644
--- a/crypto/src/asn1/BERBitString.cs
+++ b/crypto/src/asn1/BERBitString.cs
@@ -113,9 +113,10 @@ namespace Org.BouncyCastle.Asn1
             this.segmentLimit = DefaultSegmentLimit;
         }
 
-        private bool IsConstructed
+        internal override bool EncodeConstructed()
         {
-            get { return null != elements || contents.Length > segmentLimit; }
+            // NOTE: Assumes BER encoding
+            return null != elements || contents.Length > segmentLimit;
         }
 
         internal override int EncodedLength(bool withID)
@@ -123,7 +124,7 @@ namespace Org.BouncyCastle.Asn1
             throw Platform.CreateNotImplementedException("BerBitString.EncodedLength");
 
             // TODO This depends on knowing it's not DER
-            //if (!IsConstructed)
+            //if (!EncodeConstructed())
             //    return EncodedLength(withID, contents.Length);
 
             //int totalLength = withID ? 4 : 3;
@@ -159,7 +160,7 @@ namespace Org.BouncyCastle.Asn1
                 return;
             }
 
-            if (!IsConstructed)
+            if (!EncodeConstructed())
             {
                 Encode(asn1Out, withID, contents, 0, contents.Length);
                 return;
diff --git a/crypto/src/asn1/BerOctetString.cs b/crypto/src/asn1/BerOctetString.cs
index 9963819cf..c1e03106f 100644
--- a/crypto/src/asn1/BerOctetString.cs
+++ b/crypto/src/asn1/BerOctetString.cs
@@ -120,9 +120,10 @@ namespace Org.BouncyCastle.Asn1
 			return GetEnumerator();
 		}
 
-        private bool IsConstructed
+        internal override bool EncodeConstructed()
         {
-            get { return null != elements || str.Length > segmentLimit; }
+            // NOTE: Assumes BER encoding
+            return null != elements || str.Length > segmentLimit;
         }
 
         internal override int EncodedLength(bool withID)
@@ -130,7 +131,7 @@ namespace Org.BouncyCastle.Asn1
             throw Platform.CreateNotImplementedException("BerOctetString.EncodedLength");
 
             // TODO This depends on knowing it's not DER
-            //if (!IsConstructed)
+            //if (!EncodeConstructed())
             //    return EncodedLength(withID, str.Length);
 
             //int totalLength = withID ? 4 : 3;
@@ -159,7 +160,7 @@ namespace Org.BouncyCastle.Asn1
 
         internal override void Encode(Asn1OutputStream asn1Out, bool withID)
         {
-            if (!asn1Out.IsBer || !IsConstructed)
+            if (!asn1Out.IsBer || !EncodeConstructed())
             {
                 base.Encode(asn1Out, withID);
                 return;
diff --git a/crypto/src/asn1/BerTaggedObject.cs b/crypto/src/asn1/BerTaggedObject.cs
index 447aebecf..164936c6f 100644
--- a/crypto/src/asn1/BerTaggedObject.cs
+++ b/crypto/src/asn1/BerTaggedObject.cs
@@ -47,6 +47,14 @@ namespace Org.BouncyCastle.Asn1
 		{
 		}
 
+        internal override bool EncodeConstructed()
+        {
+            throw Platform.CreateNotImplementedException("BerTaggedObject.EncodeConstructed");
+
+            // TODO This depends on knowing it's not DER
+            //return IsExplicit() || obj.ToAsn1Object().EncodeConstructed();
+        }
+
         internal override int EncodedLength(bool withID)
         {
             throw Platform.CreateNotImplementedException("BerTaggedObject.EncodedLength");
@@ -109,5 +117,5 @@ namespace Org.BouncyCastle.Asn1
 				base.Encode(asn1Out, withID);
 			}
 		}
-	}
+    }
 }
diff --git a/crypto/src/asn1/DERExternal.cs b/crypto/src/asn1/DERExternal.cs
index faf64c266..edd517849 100644
--- a/crypto/src/asn1/DERExternal.cs
+++ b/crypto/src/asn1/DERExternal.cs
@@ -155,6 +155,12 @@ namespace Org.BouncyCastle.Asn1
             return new DerSequence(v);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            //return BuildSequence().EncodeConstructed();
+            return true;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return BuildSequence().EncodedLength(withID);
diff --git a/crypto/src/asn1/DerApplicationSpecific.cs b/crypto/src/asn1/DerApplicationSpecific.cs
index 56263834e..a71526876 100644
--- a/crypto/src/asn1/DerApplicationSpecific.cs
+++ b/crypto/src/asn1/DerApplicationSpecific.cs
@@ -163,6 +163,11 @@ namespace Org.BouncyCastle.Asn1
 			return FromByteArray(tmp);
 		}
 
+        internal override bool EncodeConstructed()
+        {
+            throw Platform.CreateNotImplementedException("DerApplicationSpecific.EncodeConstructed");
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, tag, octets.Length);
diff --git a/crypto/src/asn1/DerBMPString.cs b/crypto/src/asn1/DerBMPString.cs
index 1847dae16..f3fe6aa42 100644
--- a/crypto/src/asn1/DerBMPString.cs
+++ b/crypto/src/asn1/DerBMPString.cs
@@ -111,6 +111,11 @@ namespace Org.BouncyCastle.Asn1
 			return this.str.Equals(other.str);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, str.Length * 2);
diff --git a/crypto/src/asn1/DerBitString.cs b/crypto/src/asn1/DerBitString.cs
index 591d4403c..3f3697d99 100644
--- a/crypto/src/asn1/DerBitString.cs
+++ b/crypto/src/asn1/DerBitString.cs
@@ -208,6 +208,11 @@ namespace Org.BouncyCastle.Asn1
             }
 		}
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, contents.Length);
diff --git a/crypto/src/asn1/DerBoolean.cs b/crypto/src/asn1/DerBoolean.cs
index e2885f156..e2cd145a1 100644
--- a/crypto/src/asn1/DerBoolean.cs
+++ b/crypto/src/asn1/DerBoolean.cs
@@ -81,6 +81,11 @@ namespace Org.BouncyCastle.Asn1
             get { return value != 0; }
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, 1);
diff --git a/crypto/src/asn1/DerEnumerated.cs b/crypto/src/asn1/DerEnumerated.cs
index 227af1888..03d85fbfd 100644
--- a/crypto/src/asn1/DerEnumerated.cs
+++ b/crypto/src/asn1/DerEnumerated.cs
@@ -119,6 +119,11 @@ namespace Org.BouncyCastle.Asn1
             }
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, bytes.Length);
diff --git a/crypto/src/asn1/DerGeneralString.cs b/crypto/src/asn1/DerGeneralString.cs
index 01c75e278..9724870b1 100644
--- a/crypto/src/asn1/DerGeneralString.cs
+++ b/crypto/src/asn1/DerGeneralString.cs
@@ -61,6 +61,11 @@ namespace Org.BouncyCastle.Asn1
             return Strings.ToAsciiByteArray(str);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, str.Length);
@@ -71,7 +76,7 @@ namespace Org.BouncyCastle.Asn1
             asn1Out.WriteEncodingDL(withID, Asn1Tags.GeneralString, GetOctets());
         }
 
-		protected override bool Asn1Equals(
+        protected override bool Asn1Equals(
 			Asn1Object asn1Object)
         {
 			DerGeneralString other = asn1Object as DerGeneralString;
diff --git a/crypto/src/asn1/DerGeneralizedTime.cs b/crypto/src/asn1/DerGeneralizedTime.cs
index bf4072b64..c17fcbdce 100644
--- a/crypto/src/asn1/DerGeneralizedTime.cs
+++ b/crypto/src/asn1/DerGeneralizedTime.cs
@@ -295,6 +295,11 @@ namespace Org.BouncyCastle.Asn1
             return Strings.ToAsciiByteArray(time);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, time.Length);
diff --git a/crypto/src/asn1/DerGraphicString.cs b/crypto/src/asn1/DerGraphicString.cs
index 7d7a15f59..f037c648b 100644
--- a/crypto/src/asn1/DerGraphicString.cs
+++ b/crypto/src/asn1/DerGraphicString.cs
@@ -83,6 +83,11 @@ namespace Org.BouncyCastle.Asn1
             return Arrays.Clone(m_contents);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, m_contents.Length);
diff --git a/crypto/src/asn1/DerIA5String.cs b/crypto/src/asn1/DerIA5String.cs
index c23a4835a..47c1395cf 100644
--- a/crypto/src/asn1/DerIA5String.cs
+++ b/crypto/src/asn1/DerIA5String.cs
@@ -100,6 +100,11 @@ namespace Org.BouncyCastle.Asn1
             return Strings.ToAsciiByteArray(str);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, str.Length);
@@ -110,7 +115,7 @@ namespace Org.BouncyCastle.Asn1
             asn1Out.WriteEncodingDL(withID, Asn1Tags.IA5String, GetOctets());
         }
 
-		protected override int Asn1GetHashCode()
+        protected override int Asn1GetHashCode()
 		{
             return this.str.GetHashCode();
         }
diff --git a/crypto/src/asn1/DerInteger.cs b/crypto/src/asn1/DerInteger.cs
index fc30ad5fc..791b6e7e3 100644
--- a/crypto/src/asn1/DerInteger.cs
+++ b/crypto/src/asn1/DerInteger.cs
@@ -169,6 +169,11 @@ namespace Org.BouncyCastle.Asn1
             }
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, bytes.Length);
@@ -179,7 +184,7 @@ namespace Org.BouncyCastle.Asn1
             asn1Out.WriteEncodingDL(withID, Asn1Tags.Integer, bytes);
         }
 
-		protected override int Asn1GetHashCode()
+        protected override int Asn1GetHashCode()
 		{
 			return Arrays.GetHashCode(bytes);
         }
diff --git a/crypto/src/asn1/DerNull.cs b/crypto/src/asn1/DerNull.cs
index 1ee374db4..5ca8ba771 100644
--- a/crypto/src/asn1/DerNull.cs
+++ b/crypto/src/asn1/DerNull.cs
@@ -16,6 +16,11 @@ namespace Org.BouncyCastle.Asn1
 		{
 		}
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, 0);
diff --git a/crypto/src/asn1/DerNumericString.cs b/crypto/src/asn1/DerNumericString.cs
index 310c18e5a..cb73817be 100644
--- a/crypto/src/asn1/DerNumericString.cs
+++ b/crypto/src/asn1/DerNumericString.cs
@@ -100,6 +100,11 @@ namespace Org.BouncyCastle.Asn1
             return Strings.ToAsciiByteArray(str);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, str.Length);
@@ -110,7 +115,7 @@ namespace Org.BouncyCastle.Asn1
             asn1Out.WriteEncodingDL(withID, Asn1Tags.NumericString, GetOctets());
         }
 
-		protected override bool Asn1Equals(
+        protected override bool Asn1Equals(
 			Asn1Object asn1Object)
 		{
 			DerNumericString other = asn1Object as DerNumericString;
diff --git a/crypto/src/asn1/DerObjectIdentifier.cs b/crypto/src/asn1/DerObjectIdentifier.cs
index d9cd80032..3fd3d6401 100644
--- a/crypto/src/asn1/DerObjectIdentifier.cs
+++ b/crypto/src/asn1/DerObjectIdentifier.cs
@@ -197,6 +197,11 @@ namespace Org.BouncyCastle.Asn1
             }
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, GetContents().Length);
diff --git a/crypto/src/asn1/DerOctetString.cs b/crypto/src/asn1/DerOctetString.cs
index bcd4e7333..7679d5eb1 100644
--- a/crypto/src/asn1/DerOctetString.cs
+++ b/crypto/src/asn1/DerOctetString.cs
@@ -22,6 +22,11 @@ namespace Org.BouncyCastle.Asn1
         {
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, str.Length);
@@ -32,7 +37,7 @@ namespace Org.BouncyCastle.Asn1
             asn1Out.WriteEncodingDL(withID, Asn1Tags.OctetString, str);
         }
 
-		internal static void Encode(Asn1OutputStream asn1Out, bool withID, byte[] buf, int off, int len)
+        internal static void Encode(Asn1OutputStream asn1Out, bool withID, byte[] buf, int off, int len)
 		{
 			asn1Out.WriteEncodingDL(withID, Asn1Tags.OctetString, buf, off, len);
 		}
diff --git a/crypto/src/asn1/DerPrintableString.cs b/crypto/src/asn1/DerPrintableString.cs
index f450e2896..e930e2845 100644
--- a/crypto/src/asn1/DerPrintableString.cs
+++ b/crypto/src/asn1/DerPrintableString.cs
@@ -100,6 +100,11 @@ namespace Org.BouncyCastle.Asn1
             return Strings.ToAsciiByteArray(str);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, str.Length);
@@ -110,7 +115,7 @@ namespace Org.BouncyCastle.Asn1
             asn1Out.WriteEncodingDL(withID, Asn1Tags.PrintableString, GetOctets());
         }
 
-		protected override bool Asn1Equals(
+        protected override bool Asn1Equals(
 			Asn1Object asn1Object)
 		{
 			DerPrintableString other = asn1Object as DerPrintableString;
diff --git a/crypto/src/asn1/DerT61String.cs b/crypto/src/asn1/DerT61String.cs
index 82a8b3a43..cf2123131 100644
--- a/crypto/src/asn1/DerT61String.cs
+++ b/crypto/src/asn1/DerT61String.cs
@@ -77,6 +77,11 @@ namespace Org.BouncyCastle.Asn1
             return str;
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, str.Length);
diff --git a/crypto/src/asn1/DerTaggedObject.cs b/crypto/src/asn1/DerTaggedObject.cs
index 053d32f0a..4800eaa04 100644
--- a/crypto/src/asn1/DerTaggedObject.cs
+++ b/crypto/src/asn1/DerTaggedObject.cs
@@ -46,6 +46,13 @@ namespace Org.BouncyCastle.Asn1
 		{
 		}
 
+        internal override bool EncodeConstructed()
+        {
+            throw Platform.CreateNotImplementedException("DerTaggedObject.EncodeConstructed");
+
+            //return IsExplicit() || obj.ToAsn1Object().ToDerObject().EncodeConstructed();
+        }
+
         internal override int EncodedLength(bool withID)
         {
             throw Platform.CreateNotImplementedException("DerTaggedObject.EncodedLength");
@@ -71,5 +78,5 @@ namespace Org.BouncyCastle.Asn1
                 asn1Out.Write(bytes, 1, bytes.Length - 1);
 			}
 		}
-	}
+    }
 }
diff --git a/crypto/src/asn1/DerUTCTime.cs b/crypto/src/asn1/DerUTCTime.cs
index 90b2999c5..5124af12f 100644
--- a/crypto/src/asn1/DerUTCTime.cs
+++ b/crypto/src/asn1/DerUTCTime.cs
@@ -237,6 +237,11 @@ namespace Org.BouncyCastle.Asn1
             return Strings.ToAsciiByteArray(time);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, time.Length);
@@ -247,7 +252,7 @@ namespace Org.BouncyCastle.Asn1
             asn1Out.WriteEncodingDL(withID, Asn1Tags.UtcTime, GetOctets());
         }
 
-		protected override bool Asn1Equals(
+        protected override bool Asn1Equals(
 			Asn1Object asn1Object)
 		{
 			DerUtcTime other = asn1Object as DerUtcTime;
diff --git a/crypto/src/asn1/DerUTF8String.cs b/crypto/src/asn1/DerUTF8String.cs
index 8126e10ae..0406f4a71 100644
--- a/crypto/src/asn1/DerUTF8String.cs
+++ b/crypto/src/asn1/DerUTF8String.cs
@@ -89,6 +89,11 @@ namespace Org.BouncyCastle.Asn1
 			return this.str.Equals(other.str);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, Encoding.UTF8.GetByteCount(str));
diff --git a/crypto/src/asn1/DerUniversalString.cs b/crypto/src/asn1/DerUniversalString.cs
index 2e9baa76e..e9188b202 100644
--- a/crypto/src/asn1/DerUniversalString.cs
+++ b/crypto/src/asn1/DerUniversalString.cs
@@ -86,6 +86,11 @@ namespace Org.BouncyCastle.Asn1
             return (byte[]) str.Clone();
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, this.str.Length);
@@ -96,7 +101,7 @@ namespace Org.BouncyCastle.Asn1
             asn1Out.WriteEncodingDL(withID, Asn1Tags.UniversalString, this.str);
         }
 
-		protected override bool Asn1Equals(
+        protected override bool Asn1Equals(
 			Asn1Object asn1Object)
 		{
 			DerUniversalString other = asn1Object as DerUniversalString;
diff --git a/crypto/src/asn1/DerVideotexString.cs b/crypto/src/asn1/DerVideotexString.cs
index fcb535ede..377cd060a 100644
--- a/crypto/src/asn1/DerVideotexString.cs
+++ b/crypto/src/asn1/DerVideotexString.cs
@@ -79,6 +79,11 @@ namespace Org.BouncyCastle.Asn1
             return Arrays.Clone(mString);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, mString.Length);
diff --git a/crypto/src/asn1/DerVisibleString.cs b/crypto/src/asn1/DerVisibleString.cs
index 21b01fe4a..ae2aaeec2 100644
--- a/crypto/src/asn1/DerVisibleString.cs
+++ b/crypto/src/asn1/DerVisibleString.cs
@@ -86,6 +86,11 @@ namespace Org.BouncyCastle.Asn1
             return Strings.ToAsciiByteArray(str);
         }
 
+        internal override bool EncodeConstructed()
+        {
+            return false;
+        }
+
         internal override int EncodedLength(bool withID)
         {
             return Asn1OutputStream.GetLengthOfEncodingDL(withID, str.Length);
@@ -96,7 +101,7 @@ namespace Org.BouncyCastle.Asn1
             asn1Out.WriteEncodingDL(withID, Asn1Tags.VisibleString, GetOctets());
         }
 
-		protected override bool Asn1Equals(
+        protected override bool Asn1Equals(
 			Asn1Object asn1Object)
 		{
 			DerVisibleString other = asn1Object as DerVisibleString;