summary refs log tree commit diff
path: root/crypto/src/asn1/x509
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2024-03-12 17:00:28 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2024-03-12 17:00:28 +0700
commitb243cd4ff1d6e8049ee58ec971771c92139db70b (patch)
tree27ebad743538d7386c2aae94f0992c834e333a48 /crypto/src/asn1/x509
parentASN.1: Limit OID contents to 4096 bytes (diff)
downloadBouncyCastle.NET-ed25519-b243cd4ff1d6e8049ee58ec971771c92139db70b.tar.xz
Use TryFromID to check for OID string
Diffstat (limited to 'crypto/src/asn1/x509')
-rw-r--r--crypto/src/asn1/x509/X509Name.cs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/src/asn1/x509/X509Name.cs b/crypto/src/asn1/x509/X509Name.cs
index 8fd564090..6135ad2fa 100644
--- a/crypto/src/asn1/x509/X509Name.cs
+++ b/crypto/src/asn1/x509/X509Name.cs
@@ -532,11 +532,11 @@ namespace Org.BouncyCastle.Asn1.X509
             if (name.StartsWith("OID.", StringComparison.OrdinalIgnoreCase))
                 return new DerObjectIdentifier(name.Substring("OID.".Length));
 
-            if (name[0] >= '0' && name[0] <= '9')
-                return new DerObjectIdentifier(name);
-
-            if (lookup.TryGetValue(name, out var oid))
+            if (DerObjectIdentifier.TryFromID(name, out var oid) ||
+                lookup.TryGetValue(name, out oid))
+            {
                 return oid;
+            }
 
             throw new ArgumentException("Unknown object id - " + name + " - passed to distinguished name");
         }