001: package org.bouncycastle.asn1.x9;
002:
003: import org.bouncycastle.asn1.DERObjectIdentifier;
004: import org.bouncycastle.math.ec.ECCurve;
005: import org.bouncycastle.util.Strings;
006: import org.bouncycastle.util.encoders.Hex;
007:
008: import java.math.BigInteger;
009: import java.util.Enumeration;
010: import java.util.Hashtable;
011:
012: /**
013: * table of the current named curves defined in X.962 EC-DSA.
014: */
015: public class X962NamedCurves {
016: static X9ECParametersHolder prime192v1 = new X9ECParametersHolder() {
017: protected X9ECParameters createParameters() {
018: ECCurve cFp192v1 = new ECCurve.Fp(
019: new BigInteger(
020: "6277101735386680763835789423207666416083908700390324961279"),
021: new BigInteger(
022: "fffffffffffffffffffffffffffffffefffffffffffffffc",
023: 16),
024: new BigInteger(
025: "64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1",
026: 16));
027:
028: return new X9ECParameters(
029: cFp192v1,
030: cFp192v1
031: .decodePoint(Hex
032: .decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")),
033: new BigInteger(
034: "ffffffffffffffffffffffff99def836146bc9b1b4d22831",
035: 16),
036: BigInteger.valueOf(1),
037: Hex
038: .decode("3045AE6FC8422f64ED579528D38120EAE12196D5"));
039: }
040: };
041:
042: static X9ECParametersHolder prime192v2 = new X9ECParametersHolder() {
043: protected X9ECParameters createParameters() {
044: ECCurve cFp192v2 = new ECCurve.Fp(
045: new BigInteger(
046: "6277101735386680763835789423207666416083908700390324961279"),
047: new BigInteger(
048: "fffffffffffffffffffffffffffffffefffffffffffffffc",
049: 16),
050: new BigInteger(
051: "cc22d6dfb95c6b25e49c0d6364a4e5980c393aa21668d953",
052: 16));
053:
054: return new X9ECParameters(
055: cFp192v2,
056: cFp192v2
057: .decodePoint(Hex
058: .decode("03eea2bae7e1497842f2de7769cfe9c989c072ad696f48034a")),
059: new BigInteger(
060: "fffffffffffffffffffffffe5fb1a724dc80418648d8dd31",
061: 16),
062: BigInteger.valueOf(1),
063: Hex
064: .decode("31a92ee2029fd10d901b113e990710f0d21ac6b6"));
065: }
066: };
067:
068: static X9ECParametersHolder prime192v3 = new X9ECParametersHolder() {
069: protected X9ECParameters createParameters() {
070: ECCurve cFp192v3 = new ECCurve.Fp(
071: new BigInteger(
072: "6277101735386680763835789423207666416083908700390324961279"),
073: new BigInteger(
074: "fffffffffffffffffffffffffffffffefffffffffffffffc",
075: 16),
076: new BigInteger(
077: "22123dc2395a05caa7423daeccc94760a7d462256bd56916",
078: 16));
079:
080: return new X9ECParameters(
081: cFp192v3,
082: cFp192v3
083: .decodePoint(Hex
084: .decode("027d29778100c65a1da1783716588dce2b8b4aee8e228f1896")),
085: new BigInteger(
086: "ffffffffffffffffffffffff7a62d031c83f4294f640ec13",
087: 16),
088: BigInteger.valueOf(1),
089: Hex
090: .decode("c469684435deb378c4b65ca9591e2a5763059a2e"));
091: }
092: };
093:
094: static X9ECParametersHolder prime239v1 = new X9ECParametersHolder() {
095: protected X9ECParameters createParameters() {
096: ECCurve cFp239v1 = new ECCurve.Fp(
097: new BigInteger(
098: "883423532389192164791648750360308885314476597252960362792450860609699839"),
099: new BigInteger(
100: "7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc",
101: 16),
102: new BigInteger(
103: "6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a",
104: 16));
105:
106: return new X9ECParameters(
107: cFp239v1,
108: cFp239v1
109: .decodePoint(Hex
110: .decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")),
111: new BigInteger(
112: "7fffffffffffffffffffffff7fffff9e5e9a9f5d9071fbd1522688909d0b",
113: 16),
114: BigInteger.valueOf(1),
115: Hex
116: .decode("e43bb460f0b80cc0c0b075798e948060f8321b7d"));
117: }
118: };
119:
120: static X9ECParametersHolder prime239v2 = new X9ECParametersHolder() {
121: protected X9ECParameters createParameters() {
122: ECCurve cFp239v2 = new ECCurve.Fp(
123: new BigInteger(
124: "883423532389192164791648750360308885314476597252960362792450860609699839"),
125: new BigInteger(
126: "7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc",
127: 16),
128: new BigInteger(
129: "617fab6832576cbbfed50d99f0249c3fee58b94ba0038c7ae84c8c832f2c",
130: 16));
131:
132: return new X9ECParameters(
133: cFp239v2,
134: cFp239v2
135: .decodePoint(Hex
136: .decode("0238af09d98727705120c921bb5e9e26296a3cdcf2f35757a0eafd87b830e7")),
137: new BigInteger(
138: "7fffffffffffffffffffffff800000cfa7e8594377d414c03821bc582063",
139: 16),
140: BigInteger.valueOf(1),
141: Hex
142: .decode("e8b4011604095303ca3b8099982be09fcb9ae616"));
143: }
144: };
145:
146: static X9ECParametersHolder prime239v3 = new X9ECParametersHolder() {
147: protected X9ECParameters createParameters() {
148: ECCurve cFp239v3 = new ECCurve.Fp(
149: new BigInteger(
150: "883423532389192164791648750360308885314476597252960362792450860609699839"),
151: new BigInteger(
152: "7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc",
153: 16),
154: new BigInteger(
155: "255705fa2a306654b1f4cb03d6a750a30c250102d4988717d9ba15ab6d3e",
156: 16));
157:
158: return new X9ECParameters(
159: cFp239v3,
160: cFp239v3
161: .decodePoint(Hex
162: .decode("036768ae8e18bb92cfcf005c949aa2c6d94853d0e660bbf854b1c9505fe95a")),
163: new BigInteger(
164: "7fffffffffffffffffffffff7fffff975deb41b3a6057c3c432146526551",
165: 16),
166: BigInteger.valueOf(1),
167: Hex
168: .decode("7d7374168ffe3471b60a857686a19475d3bfa2ff"));
169: }
170: };
171:
172: static X9ECParametersHolder prime256v1 = new X9ECParametersHolder() {
173: protected X9ECParameters createParameters() {
174: ECCurve cFp256v1 = new ECCurve.Fp(
175: new BigInteger(
176: "115792089210356248762697446949407573530086143415290314195533631308867097853951"),
177: new BigInteger(
178: "ffffffff00000001000000000000000000000000fffffffffffffffffffffffc",
179: 16),
180: new BigInteger(
181: "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b",
182: 16));
183:
184: return new X9ECParameters(
185: cFp256v1,
186: cFp256v1
187: .decodePoint(Hex
188: .decode("036b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296")),
189: new BigInteger(
190: "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551",
191: 16),
192: BigInteger.valueOf(1),
193: Hex
194: .decode("c49d360886e704936a6678e1139d26b7819f7e90"));
195: }
196: };
197:
198: /*
199: * F2m Curves
200: */
201: static X9ECParametersHolder c2pnb163v1 = new X9ECParametersHolder() {
202: protected X9ECParameters createParameters() {
203: BigInteger c2m163v1n = new BigInteger(
204: "0400000000000000000001E60FC8821CC74DAEAFC1", 16);
205: BigInteger c2m163v1h = BigInteger.valueOf(2);
206:
207: ECCurve c2m163v1 = new ECCurve.F2m(
208: 163,
209: 1,
210: 2,
211: 8,
212: new BigInteger(
213: "072546B5435234A422E0789675F432C89435DE5242",
214: 16),
215: new BigInteger(
216: "00C9517D06D5240D3CFF38C74B20B6CD4D6F9DD4D9",
217: 16), c2m163v1n, c2m163v1h);
218:
219: return new X9ECParameters(
220: c2m163v1,
221: c2m163v1
222: .decodePoint(Hex
223: .decode("0307AF69989546103D79329FCC3D74880F33BBE803CB")),
224: c2m163v1n,
225: c2m163v1h,
226: Hex
227: .decode("D2COFB15760860DEF1EEF4D696E6768756151754"));
228: }
229: };
230:
231: static X9ECParametersHolder c2pnb163v2 = new X9ECParametersHolder() {
232: protected X9ECParameters createParameters() {
233: BigInteger c2m163v2n = new BigInteger(
234: "03FFFFFFFFFFFFFFFFFFFDF64DE1151ADBB78F10A7", 16);
235: BigInteger c2m163v2h = BigInteger.valueOf(2);
236:
237: ECCurve c2m163v2 = new ECCurve.F2m(
238: 163,
239: 1,
240: 2,
241: 8,
242: new BigInteger(
243: "0108B39E77C4B108BED981ED0E890E117C511CF072",
244: 16),
245: new BigInteger(
246: "0667ACEB38AF4E488C407433FFAE4F1C811638DF20",
247: 16), c2m163v2n, c2m163v2h);
248:
249: return new X9ECParameters(
250: c2m163v2,
251: c2m163v2
252: .decodePoint(Hex
253: .decode("030024266E4EB5106D0A964D92C4860E2671DB9B6CC5")),
254: c2m163v2n, c2m163v2h, null);
255: }
256: };
257:
258: static X9ECParametersHolder c2pnb163v3 = new X9ECParametersHolder() {
259: protected X9ECParameters createParameters() {
260: BigInteger c2m163v3n = new BigInteger(
261: "03FFFFFFFFFFFFFFFFFFFE1AEE140F110AFF961309", 16);
262: BigInteger c2m163v3h = BigInteger.valueOf(2);
263:
264: ECCurve c2m163v3 = new ECCurve.F2m(
265: 163,
266: 1,
267: 2,
268: 8,
269: new BigInteger(
270: "07A526C63D3E25A256A007699F5447E32AE456B50E",
271: 16),
272: new BigInteger(
273: "03F7061798EB99E238FD6F1BF95B48FEEB4854252B",
274: 16), c2m163v3n, c2m163v3h);
275:
276: return new X9ECParameters(
277: c2m163v3,
278: c2m163v3
279: .decodePoint(Hex
280: .decode("0202F9F87B7C574D0BDECF8A22E6524775F98CDEBDCB")),
281: c2m163v3n, c2m163v3h, null);
282: }
283: };
284:
285: static X9ECParametersHolder c2pnb176w1 = new X9ECParametersHolder() {
286: protected X9ECParameters createParameters() {
287: BigInteger c2m176w1n = new BigInteger(
288: "010092537397ECA4F6145799D62B0A19CE06FE26AD", 16);
289: BigInteger c2m176w1h = BigInteger.valueOf(0xFF6E);
290:
291: ECCurve c2m176w1 = new ECCurve.F2m(
292: 176,
293: 1,
294: 2,
295: 43,
296: new BigInteger(
297: "00E4E6DB2995065C407D9D39B8D0967B96704BA8E9C90B",
298: 16),
299: new BigInteger(
300: "005DDA470ABE6414DE8EC133AE28E9BBD7FCEC0AE0FFF2",
301: 16), c2m176w1n, c2m176w1h);
302:
303: return new X9ECParameters(
304: c2m176w1,
305: c2m176w1
306: .decodePoint(Hex
307: .decode("038D16C2866798B600F9F08BB4A8E860F3298CE04A5798")),
308: c2m176w1n, c2m176w1h, null);
309: }
310: };
311:
312: static X9ECParametersHolder c2tnb191v1 = new X9ECParametersHolder() {
313: protected X9ECParameters createParameters() {
314: BigInteger c2m191v1n = new BigInteger(
315: "40000000000000000000000004A20E90C39067C893BBB9A5",
316: 16);
317: BigInteger c2m191v1h = BigInteger.valueOf(2);
318:
319: ECCurve c2m191v1 = new ECCurve.F2m(191, 9, new BigInteger(
320: "2866537B676752636A68F56554E12640276B649EF7526267",
321: 16), new BigInteger(
322: "2E45EF571F00786F67B0081B9495A3D95462F5DE0AA185EC",
323: 16), c2m191v1n, c2m191v1h);
324:
325: return new X9ECParameters(
326: c2m191v1,
327: c2m191v1
328: .decodePoint(Hex
329: .decode("0236B3DAF8A23206F9C4F299D7B21A9C369137F2C84AE1AA0D")),
330: c2m191v1n,
331: c2m191v1h,
332: Hex
333: .decode("4E13CA542744D696E67687561517552F279A8C84"));
334: }
335: };
336:
337: static X9ECParametersHolder c2tnb191v2 = new X9ECParametersHolder() {
338: protected X9ECParameters createParameters() {
339: BigInteger c2m191v2n = new BigInteger(
340: "20000000000000000000000050508CB89F652824E06B8173",
341: 16);
342: BigInteger c2m191v2h = BigInteger.valueOf(4);
343:
344: ECCurve c2m191v2 = new ECCurve.F2m(191, 9, new BigInteger(
345: "401028774D7777C7B7666D1366EA432071274F89FF01E718",
346: 16), new BigInteger(
347: "0620048D28BCBD03B6249C99182B7C8CD19700C362C46A01",
348: 16), c2m191v2n, c2m191v2h);
349:
350: return new X9ECParameters(
351: c2m191v2,
352: c2m191v2
353: .decodePoint(Hex
354: .decode("023809B2B7CC1B28CC5A87926AAD83FD28789E81E2C9E3BF10")),
355: c2m191v2n, c2m191v2h, null);
356: }
357: };
358:
359: static X9ECParametersHolder c2tnb191v3 = new X9ECParametersHolder() {
360: protected X9ECParameters createParameters() {
361: BigInteger c2m191v3n = new BigInteger(
362: "155555555555555555555555610C0B196812BFB6288A3EA3",
363: 16);
364: BigInteger c2m191v3h = BigInteger.valueOf(6);
365:
366: ECCurve c2m191v3 = new ECCurve.F2m(191, 9, new BigInteger(
367: "6C01074756099122221056911C77D77E77A777E7E7E77FCB",
368: 16), new BigInteger(
369: "71FE1AF926CF847989EFEF8DB459F66394D90F32AD3F15E8",
370: 16), c2m191v3n, c2m191v3h);
371:
372: return new X9ECParameters(
373: c2m191v3,
374: c2m191v3
375: .decodePoint(Hex
376: .decode("03375D4CE24FDE434489DE8746E71786015009E66E38A926DD")),
377: c2m191v3n, c2m191v3h, null);
378: }
379: };
380:
381: static X9ECParametersHolder c2pnb208w1 = new X9ECParametersHolder() {
382: protected X9ECParameters createParameters() {
383: BigInteger c2m208w1n = new BigInteger(
384: "0101BAF95C9723C57B6C21DA2EFF2D5ED588BDD5717E212F9D",
385: 16);
386: BigInteger c2m208w1h = BigInteger.valueOf(0xFE48);
387:
388: ECCurve c2m208w1 = new ECCurve.F2m(
389: 208,
390: 1,
391: 2,
392: 83,
393: new BigInteger("0", 16),
394: new BigInteger(
395: "00C8619ED45A62E6212E1160349E2BFA844439FAFC2A3FD1638F9E",
396: 16), c2m208w1n, c2m208w1h);
397:
398: return new X9ECParameters(
399: c2m208w1,
400: c2m208w1
401: .decodePoint(Hex
402: .decode("0289FDFBE4ABE193DF9559ECF07AC0CE78554E2784EB8C1ED1A57A")),
403: c2m208w1n, c2m208w1h, null);
404: }
405: };
406:
407: static X9ECParametersHolder c2tnb239v1 = new X9ECParametersHolder() {
408: protected X9ECParameters createParameters() {
409: BigInteger c2m239v1n = new BigInteger(
410: "2000000000000000000000000000000F4D42FFE1492A4993F1CAD666E447",
411: 16);
412: BigInteger c2m239v1h = BigInteger.valueOf(4);
413:
414: ECCurve c2m239v1 = new ECCurve.F2m(
415: 239,
416: 36,
417: new BigInteger(
418: "32010857077C5431123A46B808906756F543423E8D27877578125778AC76",
419: 16),
420: new BigInteger(
421: "790408F2EEDAF392B012EDEFB3392F30F4327C0CA3F31FC383C422AA8C16",
422: 16), c2m239v1n, c2m239v1h);
423:
424: return new X9ECParameters(
425: c2m239v1,
426: c2m239v1
427: .decodePoint(Hex
428: .decode("0257927098FA932E7C0A96D3FD5B706EF7E5F5C156E16B7E7C86038552E91D")),
429: c2m239v1n, c2m239v1h, null);
430: }
431: };
432:
433: static X9ECParametersHolder c2tnb239v2 = new X9ECParametersHolder() {
434: protected X9ECParameters createParameters() {
435: BigInteger c2m239v2n = new BigInteger(
436: "1555555555555555555555555555553C6F2885259C31E3FCDF154624522D",
437: 16);
438: BigInteger c2m239v2h = BigInteger.valueOf(6);
439:
440: ECCurve c2m239v2 = new ECCurve.F2m(
441: 239,
442: 36,
443: new BigInteger(
444: "4230017757A767FAE42398569B746325D45313AF0766266479B75654E65F",
445: 16),
446: new BigInteger(
447: "5037EA654196CFF0CD82B2C14A2FCF2E3FF8775285B545722F03EACDB74B",
448: 16), c2m239v2n, c2m239v2h);
449:
450: return new X9ECParameters(
451: c2m239v2,
452: c2m239v2
453: .decodePoint(Hex
454: .decode("0228F9D04E900069C8DC47A08534FE76D2B900B7D7EF31F5709F200C4CA205")),
455: c2m239v2n, c2m239v2h, null);
456: }
457: };
458:
459: static X9ECParametersHolder c2tnb239v3 = new X9ECParametersHolder() {
460: protected X9ECParameters createParameters() {
461: BigInteger c2m239v3n = new BigInteger(
462: "0CCCCCCCCCCCCCCCCCCCCCCCCCCCCCAC4912D2D9DF903EF9888B8A0E4CFF",
463: 16);
464: BigInteger c2m239v3h = BigInteger.valueOf(10);
465:
466: ECCurve c2m239v3 = new ECCurve.F2m(
467: 239,
468: 36,
469: new BigInteger(
470: "01238774666A67766D6676F778E676B66999176666E687666D8766C66A9F",
471: 16),
472: new BigInteger(
473: "6A941977BA9F6A435199ACFC51067ED587F519C5ECB541B8E44111DE1D40",
474: 16), c2m239v3n, c2m239v3h);
475:
476: return new X9ECParameters(
477: c2m239v3,
478: c2m239v3
479: .decodePoint(Hex
480: .decode("0370F6E9D04D289C4E89913CE3530BFDE903977D42B146D539BF1BDE4E9C92")),
481: c2m239v3n, c2m239v3h, null);
482: }
483: };
484:
485: static X9ECParametersHolder c2pnb272w1 = new X9ECParametersHolder() {
486: protected X9ECParameters createParameters() {
487: BigInteger c2m272w1n = new BigInteger(
488: "0100FAF51354E0E39E4892DF6E319C72C8161603FA45AA7B998A167B8F1E629521",
489: 16);
490: BigInteger c2m272w1h = BigInteger.valueOf(0xFF06);
491:
492: ECCurve c2m272w1 = new ECCurve.F2m(
493: 272,
494: 1,
495: 3,
496: 56,
497: new BigInteger(
498: "0091A091F03B5FBA4AB2CCF49C4EDD220FB028712D42BE752B2C40094DBACDB586FB20",
499: 16),
500: new BigInteger(
501: "7167EFC92BB2E3CE7C8AAAFF34E12A9C557003D7C73A6FAF003F99F6CC8482E540F7",
502: 16), c2m272w1n, c2m272w1h);
503:
504: return new X9ECParameters(
505: c2m272w1,
506: c2m272w1
507: .decodePoint(Hex
508: .decode("026108BABB2CEEBCF787058A056CBE0CFE622D7723A289E08A07AE13EF0D10D171DD8D")),
509: c2m272w1n, c2m272w1h, null);
510: }
511: };
512:
513: static X9ECParametersHolder c2pnb304w1 = new X9ECParametersHolder() {
514: protected X9ECParameters createParameters() {
515: BigInteger c2m304w1n = new BigInteger(
516: "0101D556572AABAC800101D556572AABAC8001022D5C91DD173F8FB561DA6899164443051D",
517: 16);
518: BigInteger c2m304w1h = BigInteger.valueOf(0xFE2E);
519:
520: ECCurve c2m304w1 = new ECCurve.F2m(
521: 304,
522: 1,
523: 2,
524: 11,
525: new BigInteger(
526: "00FD0D693149A118F651E6DCE6802085377E5F882D1B510B44160074C1288078365A0396C8E681",
527: 16),
528: new BigInteger(
529: "00BDDB97E555A50A908E43B01C798EA5DAA6788F1EA2794EFCF57166B8C14039601E55827340BE",
530: 16), c2m304w1n, c2m304w1h);
531:
532: return new X9ECParameters(
533: c2m304w1,
534: c2m304w1
535: .decodePoint(Hex
536: .decode("02197B07845E9BE2D96ADB0F5F3C7F2CFFBD7A3EB8B6FEC35C7FD67F26DDF6285A644F740A2614")),
537: c2m304w1n, c2m304w1h, null);
538: }
539: };
540:
541: static X9ECParametersHolder c2tnb359v1 = new X9ECParametersHolder() {
542: protected X9ECParameters createParameters() {
543: BigInteger c2m359v1n = new BigInteger(
544: "01AF286BCA1AF286BCA1AF286BCA1AF286BCA1AF286BC9FB8F6B85C556892C20A7EB964FE7719E74F490758D3B",
545: 16);
546: BigInteger c2m359v1h = BigInteger.valueOf(0x4C);
547:
548: ECCurve c2m359v1 = new ECCurve.F2m(
549: 359,
550: 68,
551: new BigInteger(
552: "5667676A654B20754F356EA92017D946567C46675556F19556A04616B567D223A5E05656FB549016A96656A557",
553: 16),
554: new BigInteger(
555: "2472E2D0197C49363F1FE7F5B6DB075D52B6947D135D8CA445805D39BC345626089687742B6329E70680231988",
556: 16), c2m359v1n, c2m359v1h);
557:
558: return new X9ECParameters(
559: c2m359v1,
560: c2m359v1
561: .decodePoint(Hex
562: .decode("033C258EF3047767E7EDE0F1FDAA79DAEE3841366A132E163ACED4ED2401DF9C6BDCDE98E8E707C07A2239B1B097")),
563: c2m359v1n, c2m359v1h, null);
564: }
565: };
566:
567: static X9ECParametersHolder c2pnb368w1 = new X9ECParametersHolder() {
568: protected X9ECParameters createParameters() {
569: BigInteger c2m368w1n = new BigInteger(
570: "010090512DA9AF72B08349D98A5DD4C7B0532ECA51CE03E2D10F3B7AC579BD87E909AE40A6F131E9CFCE5BD967",
571: 16);
572: BigInteger c2m368w1h = BigInteger.valueOf(0xFF70);
573:
574: ECCurve c2m368w1 = new ECCurve.F2m(
575: 368,
576: 1,
577: 2,
578: 85,
579: new BigInteger(
580: "00E0D2EE25095206F5E2A4F9ED229F1F256E79A0E2B455970D8D0D865BD94778C576D62F0AB7519CCD2A1A906AE30D",
581: 16),
582: new BigInteger(
583: "00FC1217D4320A90452C760A58EDCD30C8DD069B3C34453837A34ED50CB54917E1C2112D84D164F444F8F74786046A",
584: 16), c2m368w1n, c2m368w1h);
585:
586: return new X9ECParameters(
587: c2m368w1,
588: c2m368w1
589: .decodePoint(Hex
590: .decode("021085E2755381DCCCE3C1557AFA10C2F0C0C2825646C5B34A394CBCFA8BC16B22E7E789E927BE216F02E1FB136A5F")),
591: c2m368w1n, c2m368w1h, null);
592: }
593: };
594:
595: static X9ECParametersHolder c2tnb431r1 = new X9ECParametersHolder() {
596: protected X9ECParameters createParameters() {
597: BigInteger c2m431r1n = new BigInteger(
598: "0340340340340340340340340340340340340340340340340340340323C313FAB50589703B5EC68D3587FEC60D161CC149C1AD4A91",
599: 16);
600: BigInteger c2m431r1h = BigInteger.valueOf(0x2760);
601:
602: ECCurve c2m431r1 = new ECCurve.F2m(
603: 431,
604: 120,
605: new BigInteger(
606: "1A827EF00DD6FC0E234CAF046C6A5D8A85395B236CC4AD2CF32A0CADBDC9DDF620B0EB9906D0957F6C6FEACD615468DF104DE296CD8F",
607: 16),
608: new BigInteger(
609: "10D9B4A3D9047D8B154359ABFB1B7F5485B04CEB868237DDC9DEDA982A679A5A919B626D4E50A8DD731B107A9962381FB5D807BF2618",
610: 16), c2m431r1n, c2m431r1h);
611:
612: return new X9ECParameters(
613: c2m431r1,
614: c2m431r1
615: .decodePoint(Hex
616: .decode("02120FC05D3C67A99DE161D2F4092622FECA701BE4F50F4758714E8A87BBF2A658EF8C21E7C5EFE965361F6C2999C0C247B0DBD70CE6B7")),
617: c2m431r1n, c2m431r1h, null);
618: }
619: };
620:
621: static final Hashtable objIds = new Hashtable();
622: static final Hashtable curves = new Hashtable();
623: static final Hashtable names = new Hashtable();
624:
625: static void defineCurve(String name, DERObjectIdentifier oid,
626: X9ECParametersHolder holder) {
627: objIds.put(name, oid);
628: names.put(oid, name);
629: curves.put(oid, holder);
630: }
631:
632: static {
633: defineCurve("prime192v1", X9ObjectIdentifiers.prime192v1,
634: prime192v1);
635: defineCurve("prime192v2", X9ObjectIdentifiers.prime192v2,
636: prime192v2);
637: defineCurve("prime192v3", X9ObjectIdentifiers.prime192v3,
638: prime192v3);
639: defineCurve("prime239v1", X9ObjectIdentifiers.prime239v1,
640: prime239v1);
641: defineCurve("prime239v2", X9ObjectIdentifiers.prime239v2,
642: prime239v2);
643: defineCurve("prime239v3", X9ObjectIdentifiers.prime239v3,
644: prime239v3);
645: defineCurve("prime256v1", X9ObjectIdentifiers.prime256v1,
646: prime256v1);
647: defineCurve("c2pnb163v1", X9ObjectIdentifiers.c2pnb163v1,
648: c2pnb163v1);
649: defineCurve("c2pnb163v2", X9ObjectIdentifiers.c2pnb163v2,
650: c2pnb163v2);
651: defineCurve("c2pnb163v3", X9ObjectIdentifiers.c2pnb163v3,
652: c2pnb163v3);
653: defineCurve("c2pnb176w1", X9ObjectIdentifiers.c2pnb176w1,
654: c2pnb176w1);
655: defineCurve("c2tnb191v1", X9ObjectIdentifiers.c2tnb191v1,
656: c2tnb191v1);
657: defineCurve("c2tnb191v2", X9ObjectIdentifiers.c2tnb191v2,
658: c2tnb191v2);
659: defineCurve("c2tnb191v3", X9ObjectIdentifiers.c2tnb191v3,
660: c2tnb191v3);
661: defineCurve("c2pnb208w1", X9ObjectIdentifiers.c2pnb208w1,
662: c2pnb208w1);
663: defineCurve("c2tnb239v1", X9ObjectIdentifiers.c2tnb239v1,
664: c2tnb239v1);
665: defineCurve("c2tnb239v2", X9ObjectIdentifiers.c2tnb239v2,
666: c2tnb239v2);
667: defineCurve("c2tnb239v3", X9ObjectIdentifiers.c2tnb239v3,
668: c2tnb239v3);
669: defineCurve("c2pnb272w1", X9ObjectIdentifiers.c2pnb272w1,
670: c2pnb272w1);
671: defineCurve("c2pnb304w1", X9ObjectIdentifiers.c2pnb304w1,
672: c2pnb304w1);
673: defineCurve("c2tnb359v1", X9ObjectIdentifiers.c2tnb359v1,
674: c2tnb359v1);
675: defineCurve("c2pnb368w1", X9ObjectIdentifiers.c2pnb368w1,
676: c2pnb368w1);
677: defineCurve("c2tnb431r1", X9ObjectIdentifiers.c2tnb431r1,
678: c2tnb431r1);
679: }
680:
681: public static X9ECParameters getByName(String name) {
682: DERObjectIdentifier oid = (DERObjectIdentifier) objIds
683: .get(Strings.toLowerCase(name));
684:
685: if (oid != null) {
686: return getByOID(oid);
687: }
688:
689: return null;
690: }
691:
692: /**
693: * return the X9ECParameters object for the named curve represented by
694: * the passed in object identifier. Null if the curve isn't present.
695: *
696: * @param oid an object identifier representing a named curve, if present.
697: */
698: public static X9ECParameters getByOID(DERObjectIdentifier oid) {
699: X9ECParametersHolder holder = (X9ECParametersHolder) curves
700: .get(oid);
701:
702: if (holder != null) {
703: return holder.getParameters();
704: }
705:
706: return null;
707: }
708:
709: /**
710: * return the object identifier signified by the passed in name. Null
711: * if there is no object identifier associated with name.
712: *
713: * @return the object identifier associated with name, if present.
714: */
715: public static DERObjectIdentifier getOID(String name) {
716: return (DERObjectIdentifier) objIds.get(Strings
717: .toLowerCase(name));
718: }
719:
720: /**
721: * return the named curve name represented by the given object identifier.
722: */
723: public static String getName(DERObjectIdentifier oid) {
724: return (String) names.get(oid);
725: }
726:
727: /**
728: * returns an enumeration containing the name strings for curves
729: * contained in this structure.
730: */
731: public static Enumeration getNames() {
732: return objIds.keys();
733: }
734: }
|