summary refs log tree commit diff
path: root/crypto/src/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r--crypto/src/asn1/ASN1StreamParser.cs4
-rw-r--r--crypto/src/asn1/Asn1InputStream.cs2
-rw-r--r--crypto/src/asn1/BEROctetStringParser.cs18
-rw-r--r--crypto/src/asn1/BERSequenceParser.cs20
-rw-r--r--crypto/src/asn1/BERSetParser.cs20
5 files changed, 25 insertions, 39 deletions
diff --git a/crypto/src/asn1/ASN1StreamParser.cs b/crypto/src/asn1/ASN1StreamParser.cs
index 78e34d870..d1e380481 100644
--- a/crypto/src/asn1/ASN1StreamParser.cs
+++ b/crypto/src/asn1/ASN1StreamParser.cs
@@ -124,9 +124,11 @@ namespace Org.BouncyCastle.Asn1
             case Asn1Tags.External:
                 // TODO[asn1] DLExternalParser
                 return new DerExternalParser(this);
+#pragma warning disable CS0618 // Type or member is obsolete
             case Asn1Tags.OctetString:
                 // TODO[asn1] DLConstructedOctetStringParser
                 return new BerOctetStringParser(this);
+#pragma warning restore CS0618 // Type or member is obsolete
             case Asn1Tags.Set:
                 // TODO[asn1] DLSetParser
                 return new DerSetParser(this);
@@ -147,12 +149,14 @@ namespace Org.BouncyCastle.Asn1
             case Asn1Tags.External:
                 // TODO[asn1] BERExternalParser
                 return new DerExternalParser(this);
+#pragma warning disable CS0618 // Type or member is obsolete
             case Asn1Tags.OctetString:
                 return new BerOctetStringParser(this);
             case Asn1Tags.Sequence:
                 return new BerSequenceParser(this);
             case Asn1Tags.Set:
                 return new BerSetParser(this);
+#pragma warning restore CS0618 // Type or member is obsolete
             default:
                 throw new Asn1Exception("unknown BER object encountered: 0x" + univTagNo.ToString("X"));
             }
diff --git a/crypto/src/asn1/Asn1InputStream.cs b/crypto/src/asn1/Asn1InputStream.cs
index 9ac9a6b02..96b0a1c66 100644
--- a/crypto/src/asn1/Asn1InputStream.cs
+++ b/crypto/src/asn1/Asn1InputStream.cs
@@ -212,12 +212,14 @@ namespace Org.BouncyCastle.Asn1
             {
             case Asn1Tags.BitString:
                 return BerBitStringParser.Parse(sp);
+#pragma warning disable CS0618 // Type or member is obsolete
             case Asn1Tags.OctetString:
                 return BerOctetStringParser.Parse(sp);
             case Asn1Tags.Sequence:
                 return BerSequenceParser.Parse(sp);
             case Asn1Tags.Set:
                 return BerSetParser.Parse(sp);
+#pragma warning restore CS0618 // Type or member is obsolete
             case Asn1Tags.External:
                 // TODO[asn1] BerExternalParser
                 return DerExternalParser.Parse(sp);
diff --git a/crypto/src/asn1/BEROctetStringParser.cs b/crypto/src/asn1/BEROctetStringParser.cs
index c8c344e11..03dd00fbe 100644
--- a/crypto/src/asn1/BEROctetStringParser.cs
+++ b/crypto/src/asn1/BEROctetStringParser.cs
@@ -5,26 +5,24 @@ using Org.BouncyCastle.Utilities.IO;
 
 namespace Org.BouncyCastle.Asn1
 {
+    [Obsolete("Check for 'Asn1OctetStringParser' instead")]
     public class BerOctetStringParser
         : Asn1OctetStringParser
     {
-        private readonly Asn1StreamParser _parser;
+        private readonly Asn1StreamParser m_parser;
 
         internal BerOctetStringParser(Asn1StreamParser parser)
         {
-            _parser = parser;
+            m_parser = parser;
         }
 
-        public Stream GetOctetStream()
-        {
-            return new ConstructedOctetStream(_parser);
-        }
+        public Stream GetOctetStream() => new ConstructedOctetStream(m_parser);
 
         public Asn1Object ToAsn1Object()
         {
             try
             {
-                return Parse(_parser);
+                return Parse(m_parser);
             }
             catch (IOException e)
             {
@@ -32,9 +30,7 @@ namespace Org.BouncyCastle.Asn1
             }
         }
 
-        internal static BerOctetString Parse(Asn1StreamParser sp)
-        {
-            return new BerOctetString(Streams.ReadAll(new ConstructedOctetStream(sp)));
-        }
+        internal static BerOctetString Parse(Asn1StreamParser sp) =>
+            new BerOctetString(Streams.ReadAll(new ConstructedOctetStream(sp)));
     }
 }
diff --git a/crypto/src/asn1/BERSequenceParser.cs b/crypto/src/asn1/BERSequenceParser.cs
index 5fa1de8a6..0b4c78eb3 100644
--- a/crypto/src/asn1/BERSequenceParser.cs
+++ b/crypto/src/asn1/BERSequenceParser.cs
@@ -2,29 +2,21 @@ using System;
 
 namespace Org.BouncyCastle.Asn1
 {
+    [Obsolete("Check for 'Asn1SequenceParser' instead")]
     public class BerSequenceParser
         : Asn1SequenceParser
     {
-        private readonly Asn1StreamParser _parser;
+        private readonly Asn1StreamParser m_parser;
 
         internal BerSequenceParser(Asn1StreamParser parser)
         {
-            this._parser = parser;
+            m_parser = parser;
         }
 
-        public IAsn1Convertible ReadObject()
-        {
-            return _parser.ReadObject();
-        }
+        public IAsn1Convertible ReadObject() => m_parser.ReadObject();
 
-        public Asn1Object ToAsn1Object()
-        {
-            return Parse(_parser);
-        }
+        public Asn1Object ToAsn1Object() => Parse(m_parser);
 
-        internal static BerSequence Parse(Asn1StreamParser sp)
-        {
-            return new BerSequence(sp.ReadVector());
-        }
+        internal static BerSequence Parse(Asn1StreamParser sp) => BerSequence.FromVector(sp.ReadVector());
     }
 }
diff --git a/crypto/src/asn1/BERSetParser.cs b/crypto/src/asn1/BERSetParser.cs
index 292ae60b1..63be54524 100644
--- a/crypto/src/asn1/BERSetParser.cs
+++ b/crypto/src/asn1/BERSetParser.cs
@@ -2,29 +2,21 @@ using System;
 
 namespace Org.BouncyCastle.Asn1
 {
+    [Obsolete("Check for 'Asn1SetParser' instead")]
     public class BerSetParser
         : Asn1SetParser
     {
-        private readonly Asn1StreamParser _parser;
+        private readonly Asn1StreamParser m_parser;
 
         internal BerSetParser(Asn1StreamParser parser)
         {
-            this._parser = parser;
+            m_parser = parser;
         }
 
-        public IAsn1Convertible ReadObject()
-        {
-            return _parser.ReadObject();
-        }
+        public IAsn1Convertible ReadObject() => m_parser.ReadObject();
 
-        public Asn1Object ToAsn1Object()
-        {
-            return Parse(_parser);
-        }
+        public Asn1Object ToAsn1Object() => Parse(m_parser);
 
-        internal static BerSet Parse(Asn1StreamParser sp)
-        {
-            return BerSet.FromVector(sp.ReadVector());
-        }
+        internal static BerSet Parse(Asn1StreamParser sp) => BerSet.FromVector(sp.ReadVector());
     }
 }