summary refs log tree commit diff
path: root/crypto/src/asn1/x9
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-02-04 16:09:25 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-02-04 16:09:25 +0700
commit1ca56848fe87a98eeff9db2c93186ac1d06051f1 (patch)
tree11fcfd2216545071ee4c8da8f2677f045b4a7942 /crypto/src/asn1/x9
parentInitial work on a fixed-point comb multiplier (diff)
downloadBouncyCastle.NET-ed25519-1ca56848fe87a98eeff9db2c93186ac1d06051f1.tar.xz
Add order/cofactor to Fp curves
Diffstat (limited to 'crypto/src/asn1/x9')
-rw-r--r--crypto/src/asn1/x9/X962NamedCurves.cs71
1 files changed, 46 insertions, 25 deletions
diff --git a/crypto/src/asn1/x9/X962NamedCurves.cs b/crypto/src/asn1/x9/X962NamedCurves.cs
index 489483cb8..afcdfdb72 100644
--- a/crypto/src/asn1/x9/X962NamedCurves.cs
+++ b/crypto/src/asn1/x9/X962NamedCurves.cs
@@ -27,17 +27,20 @@ namespace Org.BouncyCastle.Asn1.X9
 
             protected override X9ECParameters CreateParameters()
             {
+                BigInteger n = new BigInteger("ffffffffffffffffffffffff99def836146bc9b1b4d22831", 16);
+                BigInteger h = BigInteger.One;
+
                 ECCurve cFp192v1 = new FpCurve(
                     new BigInteger("6277101735386680763835789423207666416083908700390324961279"),
                     new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16),
-                    new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16));
+                    new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16),
+                    n, h);
 
                 return new X9ECParameters(
                     cFp192v1,
                     cFp192v1.DecodePoint(
                         Hex.Decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")),
-                    new BigInteger("ffffffffffffffffffffffff99def836146bc9b1b4d22831", 16),
-                    BigInteger.One,
+                    n, h,
                     Hex.Decode("3045AE6FC8422f64ED579528D38120EAE12196D5"));
             }
         }
@@ -51,17 +54,20 @@ namespace Org.BouncyCastle.Asn1.X9
 
             protected override X9ECParameters CreateParameters()
             {
+                BigInteger n = new BigInteger("fffffffffffffffffffffffe5fb1a724dc80418648d8dd31", 16);
+                BigInteger h = BigInteger.One;
+
                 ECCurve cFp192v2 = new FpCurve(
                     new BigInteger("6277101735386680763835789423207666416083908700390324961279"),
                     new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16),
-                    new BigInteger("cc22d6dfb95c6b25e49c0d6364a4e5980c393aa21668d953", 16));
+                    new BigInteger("cc22d6dfb95c6b25e49c0d6364a4e5980c393aa21668d953", 16),
+                    n, h);
 
                 return new X9ECParameters(
                     cFp192v2,
                     cFp192v2.DecodePoint(
                         Hex.Decode("03eea2bae7e1497842f2de7769cfe9c989c072ad696f48034a")),
-                    new BigInteger("fffffffffffffffffffffffe5fb1a724dc80418648d8dd31", 16),
-                    BigInteger.One,
+                    n, h,
                     Hex.Decode("31a92ee2029fd10d901b113e990710f0d21ac6b6"));
             }
         }
@@ -75,17 +81,20 @@ namespace Org.BouncyCastle.Asn1.X9
 
             protected override X9ECParameters CreateParameters()
             {
+                BigInteger n = new BigInteger("ffffffffffffffffffffffff7a62d031c83f4294f640ec13", 16);
+                BigInteger h = BigInteger.One;
+
                 ECCurve cFp192v3 = new FpCurve(
                     new BigInteger("6277101735386680763835789423207666416083908700390324961279"),
                     new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16),
-                    new BigInteger("22123dc2395a05caa7423daeccc94760a7d462256bd56916", 16));
+                    new BigInteger("22123dc2395a05caa7423daeccc94760a7d462256bd56916", 16),
+                    n, h);
 
                 return new X9ECParameters(
                     cFp192v3,
                     cFp192v3.DecodePoint(
                         Hex.Decode("027d29778100c65a1da1783716588dce2b8b4aee8e228f1896")),
-                    new BigInteger("ffffffffffffffffffffffff7a62d031c83f4294f640ec13", 16),
-                    BigInteger.One,
+                    n, h,
                     Hex.Decode("c469684435deb378c4b65ca9591e2a5763059a2e"));
             }
         }
@@ -99,17 +108,20 @@ namespace Org.BouncyCastle.Asn1.X9
 
             protected override X9ECParameters CreateParameters()
             {
+                BigInteger n = new BigInteger("7fffffffffffffffffffffff7fffff9e5e9a9f5d9071fbd1522688909d0b", 16);
+                BigInteger h = BigInteger.One;
+
                 ECCurve cFp239v1 = new FpCurve(
                     new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"),
                     new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16),
-                    new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16));
+                    new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16),
+                    n, h);
 
                 return new X9ECParameters(
                     cFp239v1,
                     cFp239v1.DecodePoint(
                         Hex.Decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")),
-                    new BigInteger("7fffffffffffffffffffffff7fffff9e5e9a9f5d9071fbd1522688909d0b", 16),
-                    BigInteger.One,
+                    n, h,
                     Hex.Decode("e43bb460f0b80cc0c0b075798e948060f8321b7d"));
             }
         }
@@ -123,17 +135,20 @@ namespace Org.BouncyCastle.Asn1.X9
 
             protected override X9ECParameters CreateParameters()
             {
+                BigInteger n = new BigInteger("7fffffffffffffffffffffff800000cfa7e8594377d414c03821bc582063", 16);
+                BigInteger h = BigInteger.One;
+
                 ECCurve cFp239v2 = new FpCurve(
                     new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"),
                     new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16),
-                    new BigInteger("617fab6832576cbbfed50d99f0249c3fee58b94ba0038c7ae84c8c832f2c", 16));
+                    new BigInteger("617fab6832576cbbfed50d99f0249c3fee58b94ba0038c7ae84c8c832f2c", 16),
+                    n, h);
 
                 return new X9ECParameters(
                     cFp239v2,
                     cFp239v2.DecodePoint(
                         Hex.Decode("0238af09d98727705120c921bb5e9e26296a3cdcf2f35757a0eafd87b830e7")),
-                    new BigInteger("7fffffffffffffffffffffff800000cfa7e8594377d414c03821bc582063", 16),
-                    BigInteger.One,
+                    n, h,
                     Hex.Decode("e8b4011604095303ca3b8099982be09fcb9ae616"));
             }
         }
@@ -147,17 +162,20 @@ namespace Org.BouncyCastle.Asn1.X9
 
             protected override X9ECParameters CreateParameters()
             {
+                BigInteger n = new BigInteger("7fffffffffffffffffffffff7fffff975deb41b3a6057c3c432146526551", 16);
+                BigInteger h = BigInteger.One;
+
                 ECCurve cFp239v3 = new FpCurve(
                     new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"),
                     new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16),
-                    new BigInteger("255705fa2a306654b1f4cb03d6a750a30c250102d4988717d9ba15ab6d3e", 16));
+                    new BigInteger("255705fa2a306654b1f4cb03d6a750a30c250102d4988717d9ba15ab6d3e", 16),
+                    n, h);
 
                 return new X9ECParameters(
                     cFp239v3,
                     cFp239v3.DecodePoint(
                         Hex.Decode("036768ae8e18bb92cfcf005c949aa2c6d94853d0e660bbf854b1c9505fe95a")),
-                    new BigInteger("7fffffffffffffffffffffff7fffff975deb41b3a6057c3c432146526551", 16),
-                    BigInteger.One,
+                    n, h,
                     Hex.Decode("7d7374168ffe3471b60a857686a19475d3bfa2ff"));
             }
         }
@@ -171,17 +189,20 @@ namespace Org.BouncyCastle.Asn1.X9
 
             protected override X9ECParameters CreateParameters()
             {
+                BigInteger n = new BigInteger("ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", 16);
+                BigInteger h = BigInteger.One;
+
                 ECCurve cFp256v1 = new FpCurve(
                     new BigInteger("115792089210356248762697446949407573530086143415290314195533631308867097853951"),
                     new BigInteger("ffffffff00000001000000000000000000000000fffffffffffffffffffffffc", 16),
-                    new BigInteger("5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", 16));
+                    new BigInteger("5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", 16),
+                    n, h);
 
                 return new X9ECParameters(
                     cFp256v1,
                     cFp256v1.DecodePoint(
                         Hex.Decode("036b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296")),
-                    new BigInteger("ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", 16),
-                    BigInteger.One,
+                    n, h,
                     Hex.Decode("c49d360886e704936a6678e1139d26b7819f7e90"));
             }
         }
@@ -199,7 +220,7 @@ namespace Org.BouncyCastle.Asn1.X9
             protected override X9ECParameters CreateParameters()
             {
                 BigInteger n = new BigInteger("0400000000000000000001E60FC8821CC74DAEAFC1", 16);
-                BigInteger h = BigInteger.ValueOf(2);
+                BigInteger h = BigInteger.Two;
 
                 ECCurve c2m163v1 = new F2mCurve(
                     163,
@@ -227,7 +248,7 @@ namespace Org.BouncyCastle.Asn1.X9
             protected override X9ECParameters CreateParameters()
             {
                 BigInteger n = new BigInteger("03FFFFFFFFFFFFFFFFFFFDF64DE1151ADBB78F10A7", 16);
-                BigInteger h = BigInteger.ValueOf(2);
+                BigInteger h = BigInteger.Two;
 
                 ECCurve c2m163v2 = new F2mCurve(
                     163,
@@ -255,7 +276,7 @@ namespace Org.BouncyCastle.Asn1.X9
             protected override X9ECParameters CreateParameters()
             {
                 BigInteger n = new BigInteger("03FFFFFFFFFFFFFFFFFFFE1AEE140F110AFF961309", 16);
-                BigInteger h = BigInteger.ValueOf(2);
+                BigInteger h = BigInteger.Two;
 
                 ECCurve c2m163v3 = new F2mCurve(
                     163,
@@ -310,7 +331,7 @@ namespace Org.BouncyCastle.Asn1.X9
             protected override X9ECParameters CreateParameters()
             {
                 BigInteger n = new BigInteger("40000000000000000000000004A20E90C39067C893BBB9A5", 16);
-                BigInteger h = BigInteger.ValueOf(2);
+                BigInteger h = BigInteger.Two;
 
                 ECCurve c2m191v1 = new F2mCurve(
                     191,