summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2024-03-26 20:49:11 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2024-03-26 20:49:11 +0700
commita5ee312d22b65c8902f91e6700e3ab0120a7e5d7 (patch)
tree87f299edcc00ad3e0cfe47d9947dd0db2857dd82 /crypto
parentImprove TLS RSA PreMasterSecret decryption (diff)
downloadBouncyCastle.NET-ed25519-a5ee312d22b65c8902f91e6700e3ab0120a7e5d7.tar.xz
Refactoring in Asn1
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/asn1/Asn1RelativeOid.cs5
-rw-r--r--crypto/src/asn1/DerObjectIdentifier.cs2
-rw-r--r--crypto/src/asn1/util/Asn1Dump.cs6
-rw-r--r--crypto/test/src/asn1/test/RelativeOidTest.cs4
4 files changed, 8 insertions, 9 deletions
diff --git a/crypto/src/asn1/Asn1RelativeOid.cs b/crypto/src/asn1/Asn1RelativeOid.cs
index f1b9bc274..587d41d2c 100644
--- a/crypto/src/asn1/Asn1RelativeOid.cs
+++ b/crypto/src/asn1/Asn1RelativeOid.cs
@@ -134,8 +134,7 @@ namespace Org.BouncyCastle.Asn1
             return Objects.EnsureSingletonInitialized(ref m_identifier, m_contents, ParseContents);
         }
 
-        // TODO[api]
-        //[Obsolete("Use 'GetID' instead")]
+        [Obsolete("Use 'GetID' instead")]
         public string Id => GetID();
 
         public override string ToString() => GetID();
@@ -180,7 +179,7 @@ namespace Org.BouncyCastle.Asn1
         internal static void CheckIdentifier(string identifier)
         {
             if (identifier == null)
-                throw new ArgumentNullException("identifier");
+                throw new ArgumentNullException(nameof(identifier));
             if (identifier.Length > MaxIdentifierLength)
                 throw new ArgumentException("exceeded relative OID contents length limit");
             if (!IsValidIdentifier(identifier, from: 0))
diff --git a/crypto/src/asn1/DerObjectIdentifier.cs b/crypto/src/asn1/DerObjectIdentifier.cs
index 4a68d541c..7e1d5c2ff 100644
--- a/crypto/src/asn1/DerObjectIdentifier.cs
+++ b/crypto/src/asn1/DerObjectIdentifier.cs
@@ -211,7 +211,7 @@ namespace Org.BouncyCastle.Asn1
         internal static void CheckIdentifier(string identifier)
         {
             if (identifier == null)
-                throw new ArgumentNullException("identifier");
+                throw new ArgumentNullException(nameof(identifier));
             if (identifier.Length > MaxIdentifierLength)
                 throw new ArgumentException("exceeded OID contents length limit");
             if (!IsValidIdentifier(identifier))
diff --git a/crypto/src/asn1/util/Asn1Dump.cs b/crypto/src/asn1/util/Asn1Dump.cs
index 67fbba979..d4576000a 100644
--- a/crypto/src/asn1/util/Asn1Dump.cs
+++ b/crypto/src/asn1/util/Asn1Dump.cs
@@ -104,12 +104,12 @@ namespace Org.BouncyCastle.Asn1.Utilities
             else if (obj is DerObjectIdentifier oid)
             {
                 buf.Append(indent);
-                buf.AppendLine("ObjectIdentifier(" + oid.Id + ")");
+                buf.AppendLine("ObjectIdentifier(" + oid.GetID() + ")");
             }
             else if (obj is Asn1RelativeOid relativeOid)
             {
                 buf.Append(indent);
-                buf.AppendLine("RelativeOID(" + relativeOid.Id + ")");
+                buf.AppendLine("RelativeOID(" + relativeOid.GetID() + ")");
             }
             else if (obj is DerBoolean derBoolean)
             {
@@ -230,7 +230,7 @@ namespace Org.BouncyCastle.Asn1.Utilities
                 if (ext.DirectReference != null)
                 {
                     buf.Append(tab);
-                    buf.AppendLine("Direct Reference: " + ext.DirectReference.Id);
+                    buf.AppendLine("Direct Reference: " + ext.DirectReference.GetID());
                 }
                 if (ext.IndirectReference != null)
                 {
diff --git a/crypto/test/src/asn1/test/RelativeOidTest.cs b/crypto/test/src/asn1/test/RelativeOidTest.cs
index c7d13af68..bbf83064a 100644
--- a/crypto/test/src/asn1/test/RelativeOidTest.cs
+++ b/crypto/test/src/asn1/test/RelativeOidTest.cs
@@ -45,7 +45,7 @@ namespace Org.BouncyCastle.Asn1.Tests
             Asn1RelativeOid o = new Asn1RelativeOid(oid);
 			o = (Asn1RelativeOid)Asn1Object.FromByteArray(o.GetEncoded());
 
-			if (!o.Id.Equals(oid))
+			if (!o.GetID().Equals(oid))
 			{
                 Fail("failed relative oid check for " + oid);
             }
@@ -69,7 +69,7 @@ namespace Org.BouncyCastle.Asn1.Tests
         private void BranchCheck(string stem, string branch)
         {
             string expected = stem + "." + branch;
-            string actual = new Asn1RelativeOid(stem).Branch(branch).Id;
+            string actual = new Asn1RelativeOid(stem).Branch(branch).GetID();
 
             if (expected != actual)
             {