summary refs log tree commit diff
path: root/crypto/src/math/BigInteger.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/math/BigInteger.cs')
-rw-r--r--crypto/src/math/BigInteger.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/crypto/src/math/BigInteger.cs b/crypto/src/math/BigInteger.cs
index c8581775d..5b2ea0d87 100644
--- a/crypto/src/math/BigInteger.cs
+++ b/crypto/src/math/BigInteger.cs
@@ -16,7 +16,7 @@ namespace Org.BouncyCastle.Math
 {
     [Serializable]
     public sealed class BigInteger
-        : IComparable<BigInteger>, IEquatable<BigInteger>
+        : IComparable, IComparable<BigInteger>, IEquatable<BigInteger>
     {
         // The first few odd primes
         /*
@@ -1051,6 +1051,17 @@ namespace Org.BouncyCastle.Math
             return sign > 0 && nBits == 1;
         }
 
+        public int CompareTo(object obj)
+        {
+            if (obj == null)
+                return 1;
+
+            if (!(obj is BigInteger other))
+                throw new ArgumentException("Object is not a BigInteger", nameof(obj));
+
+            return CompareTo(other);
+        }
+
         public int CompareTo(BigInteger other)
         {
             if (other == null)