Source Code Cross Referenced for SECNamedCurves.java in  » Security » Bouncy-Castle » org » bouncycastle » asn1 » sec » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Security » Bouncy Castle » org.bouncycastle.asn1.sec 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        package org.bouncycastle.asn1.sec;
0002:
0003:        import org.bouncycastle.asn1.DERObjectIdentifier;
0004:        import org.bouncycastle.asn1.x9.X9ECParameters;
0005:        import org.bouncycastle.asn1.x9.X9ECParametersHolder;
0006:        import org.bouncycastle.math.ec.ECCurve;
0007:        import org.bouncycastle.math.ec.ECPoint;
0008:        import org.bouncycastle.math.ec.ECConstants;
0009:        import org.bouncycastle.util.Strings;
0010:        import org.bouncycastle.util.encoders.Hex;
0011:
0012:        import java.math.BigInteger;
0013:        import java.util.Enumeration;
0014:        import java.util.Hashtable;
0015:
0016:        public class SECNamedCurves {
0017:            private static BigInteger fromHex(String hex) {
0018:                return new BigInteger(1, Hex.decode(hex));
0019:            }
0020:
0021:            /*
0022:             * secp112r1
0023:             */
0024:            static X9ECParametersHolder secp112r1 = new X9ECParametersHolder() {
0025:                protected X9ECParameters createParameters() {
0026:                    // p = (2^128 - 3) / 76439
0027:                    BigInteger p = fromHex("DB7C2ABF62E35E668076BEAD208B");
0028:                    BigInteger a = fromHex("DB7C2ABF62E35E668076BEAD2088");
0029:                    BigInteger b = fromHex("659EF8BA043916EEDE8911702B22");
0030:                    byte[] S = Hex
0031:                            .decode("00F50B028E4D696E676875615175290472783FB1");
0032:                    BigInteger n = fromHex("DB7C2ABF62E35E7628DFAC6561C5");
0033:                    BigInteger h = BigInteger.valueOf(1);
0034:
0035:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0036:                    //ECPoint G = curve.decodePoint(Hex.decode("02"
0037:                    //+ "09487239995A5EE76B55F9C2F098"));
0038:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0039:                            + "09487239995A5EE76B55F9C2F098"
0040:                            + "A89CE5AF8724C0A23E0E0FF77500"));
0041:
0042:                    return new X9ECParameters(curve, G, n, h, S);
0043:                }
0044:            };
0045:
0046:            /*
0047:             * secp112r2
0048:             */
0049:            static X9ECParametersHolder secp112r2 = new X9ECParametersHolder() {
0050:                protected X9ECParameters createParameters() {
0051:                    // p = (2^128 - 3) / 76439
0052:                    BigInteger p = fromHex("DB7C2ABF62E35E668076BEAD208B");
0053:                    BigInteger a = fromHex("6127C24C05F38A0AAAF65C0EF02C");
0054:                    BigInteger b = fromHex("51DEF1815DB5ED74FCC34C85D709");
0055:                    byte[] S = Hex
0056:                            .decode("002757A1114D696E6768756151755316C05E0BD4");
0057:                    BigInteger n = fromHex("36DF0AAFD8B8D7597CA10520D04B");
0058:                    BigInteger h = BigInteger.valueOf(4);
0059:
0060:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0061:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0062:                    //+ "4BA30AB5E892B4E1649DD0928643"));
0063:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0064:                            + "4BA30AB5E892B4E1649DD0928643"
0065:                            + "ADCD46F5882E3747DEF36E956E97"));
0066:
0067:                    return new X9ECParameters(curve, G, n, h, S);
0068:                }
0069:            };
0070:
0071:            /*
0072:             * secp128r1
0073:             */
0074:            static X9ECParametersHolder secp128r1 = new X9ECParametersHolder() {
0075:                protected X9ECParameters createParameters() {
0076:                    // p = 2^128 - 2^97 - 1
0077:                    BigInteger p = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF");
0078:                    BigInteger a = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC");
0079:                    BigInteger b = fromHex("E87579C11079F43DD824993C2CEE5ED3");
0080:                    byte[] S = Hex
0081:                            .decode("000E0D4D696E6768756151750CC03A4473D03679");
0082:                    BigInteger n = fromHex("FFFFFFFE0000000075A30D1B9038A115");
0083:                    BigInteger h = BigInteger.valueOf(1);
0084:
0085:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0086:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0087:                    //+ "161FF7528B899B2D0C28607CA52C5B86"));
0088:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0089:                            + "161FF7528B899B2D0C28607CA52C5B86"
0090:                            + "CF5AC8395BAFEB13C02DA292DDED7A83"));
0091:
0092:                    return new X9ECParameters(curve, G, n, h, S);
0093:                }
0094:            };
0095:
0096:            /*
0097:             * secp128r2
0098:             */
0099:            static X9ECParametersHolder secp128r2 = new X9ECParametersHolder() {
0100:                protected X9ECParameters createParameters() {
0101:                    // p = 2^128 - 2^97 - 1
0102:                    BigInteger p = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF");
0103:                    BigInteger a = fromHex("D6031998D1B3BBFEBF59CC9BBFF9AEE1");
0104:                    BigInteger b = fromHex("5EEEFCA380D02919DC2C6558BB6D8A5D");
0105:                    byte[] S = Hex
0106:                            .decode("004D696E67687561517512D8F03431FCE63B88F4");
0107:                    BigInteger n = fromHex("3FFFFFFF7FFFFFFFBE0024720613B5A3");
0108:                    BigInteger h = BigInteger.valueOf(4);
0109:
0110:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0111:                    //ECPoint G = curve.decodePoint(Hex.decode("02"
0112:                    //+ "7B6AA5D85E572983E6FB32A7CDEBC140"));
0113:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0114:                            + "7B6AA5D85E572983E6FB32A7CDEBC140"
0115:                            + "27B6916A894D3AEE7106FE805FC34B44"));
0116:
0117:                    return new X9ECParameters(curve, G, n, h, S);
0118:                }
0119:            };
0120:
0121:            /*
0122:             * secp160k1
0123:             */
0124:            static X9ECParametersHolder secp160k1 = new X9ECParametersHolder() {
0125:                protected X9ECParameters createParameters() {
0126:                    // p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1
0127:                    BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73");
0128:                    BigInteger a = ECConstants.ZERO;
0129:                    BigInteger b = BigInteger.valueOf(7);
0130:                    byte[] S = null;
0131:                    BigInteger n = fromHex("0100000000000000000001B8FA16DFAB9ACA16B6B3");
0132:                    BigInteger h = BigInteger.valueOf(1);
0133:
0134:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0135:                    //            ECPoint G = curve.decodePoint(Hex.decode("02"
0136:                    //                + "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB"));
0137:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0138:                            + "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB"
0139:                            + "938CF935318FDCED6BC28286531733C3F03C4FEE"));
0140:
0141:                    return new X9ECParameters(curve, G, n, h, S);
0142:                }
0143:            };
0144:
0145:            /*
0146:             * secp160r1
0147:             */
0148:            static X9ECParametersHolder secp160r1 = new X9ECParametersHolder() {
0149:                protected X9ECParameters createParameters() {
0150:                    // p = 2^160 - 2^31 - 1
0151:                    BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF");
0152:                    BigInteger a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC");
0153:                    BigInteger b = fromHex("1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45");
0154:                    byte[] S = Hex
0155:                            .decode("1053CDE42C14D696E67687561517533BF3F83345");
0156:                    BigInteger n = fromHex("0100000000000000000001F4C8F927AED3CA752257");
0157:                    BigInteger h = BigInteger.valueOf(1);
0158:
0159:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0160:                    //ECPoint G = curve.decodePoint(Hex.decode("02"
0161:                    //+ "4A96B5688EF573284664698968C38BB913CBFC82"));
0162:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0163:                            + "4A96B5688EF573284664698968C38BB913CBFC82"
0164:                            + "23A628553168947D59DCC912042351377AC5FB32"));
0165:
0166:                    return new X9ECParameters(curve, G, n, h, S);
0167:                }
0168:            };
0169:
0170:            /*
0171:             * secp160r2
0172:             */
0173:            static X9ECParametersHolder secp160r2 = new X9ECParametersHolder() {
0174:                protected X9ECParameters createParameters() {
0175:                    // p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1
0176:                    BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73");
0177:                    BigInteger a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC70");
0178:                    BigInteger b = fromHex("B4E134D3FB59EB8BAB57274904664D5AF50388BA");
0179:                    byte[] S = Hex
0180:                            .decode("B99B99B099B323E02709A4D696E6768756151751");
0181:                    BigInteger n = fromHex("0100000000000000000000351EE786A818F3A1A16B");
0182:                    BigInteger h = BigInteger.valueOf(1);
0183:
0184:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0185:                    //ECPoint G = curve.decodePoint(Hex.decode("02"
0186:                    //+ "52DCB034293A117E1F4FF11B30F7199D3144CE6D"));
0187:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0188:                            + "52DCB034293A117E1F4FF11B30F7199D3144CE6D"
0189:                            + "FEAFFEF2E331F296E071FA0DF9982CFEA7D43F2E"));
0190:
0191:                    return new X9ECParameters(curve, G, n, h, S);
0192:                }
0193:            };
0194:
0195:            /*
0196:             * secp192k1
0197:             */
0198:            static X9ECParametersHolder secp192k1 = new X9ECParametersHolder() {
0199:                protected X9ECParameters createParameters() {
0200:                    // p = 2^192 - 2^32 - 2^12 - 2^8 - 2^7 - 2^6 - 2^3 - 1
0201:                    BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37");
0202:                    BigInteger a = ECConstants.ZERO;
0203:                    BigInteger b = BigInteger.valueOf(3);
0204:                    byte[] S = null;
0205:                    BigInteger n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D");
0206:                    BigInteger h = BigInteger.valueOf(1);
0207:
0208:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0209:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0210:                    //+ "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D"));
0211:                    ECPoint G = curve
0212:                            .decodePoint(Hex
0213:                                    .decode("04"
0214:                                            + "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D"
0215:                                            + "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D"));
0216:
0217:                    return new X9ECParameters(curve, G, n, h, S);
0218:                }
0219:            };
0220:
0221:            /*
0222:             * secp192r1
0223:             */
0224:            static X9ECParametersHolder secp192r1 = new X9ECParametersHolder() {
0225:                protected X9ECParameters createParameters() {
0226:                    // p = 2^192 - 2^64 - 1
0227:                    BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF");
0228:                    BigInteger a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC");
0229:                    BigInteger b = fromHex("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1");
0230:                    byte[] S = Hex
0231:                            .decode("3045AE6FC8422F64ED579528D38120EAE12196D5");
0232:                    BigInteger n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831");
0233:                    BigInteger h = BigInteger.valueOf(1);
0234:
0235:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0236:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0237:                    //+ "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012"));
0238:                    ECPoint G = curve
0239:                            .decodePoint(Hex
0240:                                    .decode("04"
0241:                                            + "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012"
0242:                                            + "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811"));
0243:
0244:                    return new X9ECParameters(curve, G, n, h, S);
0245:                }
0246:            };
0247:
0248:            /*
0249:             * secp224k1
0250:             */
0251:            static X9ECParametersHolder secp224k1 = new X9ECParametersHolder() {
0252:                protected X9ECParameters createParameters() {
0253:                    // p = 2^224 - 2^32 - 2^12 - 2^11 - 2^9 - 2^7 - 2^4 - 2 - 1
0254:                    BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFE56D");
0255:                    BigInteger a = ECConstants.ZERO;
0256:                    BigInteger b = BigInteger.valueOf(5);
0257:                    byte[] S = null;
0258:                    BigInteger n = fromHex("010000000000000000000000000001DCE8D2EC6184CAF0A971769FB1F7");
0259:                    BigInteger h = BigInteger.valueOf(1);
0260:
0261:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0262:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0263:                    //+ "A1455B334DF099DF30FC28A169A467E9E47075A90F7E650EB6B7A45C"));
0264:                    ECPoint G = curve
0265:                            .decodePoint(Hex
0266:                                    .decode("04"
0267:                                            + "A1455B334DF099DF30FC28A169A467E9E47075A90F7E650EB6B7A45C"
0268:                                            + "7E089FED7FBA344282CAFBD6F7E319F7C0B0BD59E2CA4BDB556D61A5"));
0269:
0270:                    return new X9ECParameters(curve, G, n, h, S);
0271:                }
0272:            };
0273:
0274:            /*
0275:             * secp224r1
0276:             */
0277:            static X9ECParametersHolder secp224r1 = new X9ECParametersHolder() {
0278:                protected X9ECParameters createParameters() {
0279:                    // p = 2^224 - 2^96 + 1
0280:                    BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001");
0281:                    BigInteger a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE");
0282:                    BigInteger b = fromHex("B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4");
0283:                    byte[] S = Hex
0284:                            .decode("BD71344799D5C7FCDC45B59FA3B9AB8F6A948BC5");
0285:                    BigInteger n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D");
0286:                    BigInteger h = BigInteger.valueOf(1);
0287:
0288:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0289:                    //ECPoint G = curve.decodePoint(Hex.decode("02"
0290:                    //+ "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21"));
0291:                    ECPoint G = curve
0292:                            .decodePoint(Hex
0293:                                    .decode("04"
0294:                                            + "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21"
0295:                                            + "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34"));
0296:
0297:                    return new X9ECParameters(curve, G, n, h, S);
0298:                }
0299:            };
0300:
0301:            /*
0302:             * secp256k1
0303:             */
0304:            static X9ECParametersHolder secp256k1 = new X9ECParametersHolder() {
0305:                protected X9ECParameters createParameters() {
0306:                    // p = 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1
0307:                    BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F");
0308:                    BigInteger a = ECConstants.ZERO;
0309:                    BigInteger b = BigInteger.valueOf(7);
0310:                    byte[] S = null;
0311:                    BigInteger n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141");
0312:                    BigInteger h = BigInteger.valueOf(1);
0313:
0314:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0315:                    //ECPoint G = curve.decodePoint(Hex.decode("02"
0316:                    //+ "79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798"));
0317:                    ECPoint G = curve
0318:                            .decodePoint(Hex
0319:                                    .decode("04"
0320:                                            + "79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798"
0321:                                            + "483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8"));
0322:
0323:                    return new X9ECParameters(curve, G, n, h, S);
0324:                }
0325:            };
0326:
0327:            /*
0328:             * secp256r1
0329:             */
0330:            static X9ECParametersHolder secp256r1 = new X9ECParametersHolder() {
0331:                protected X9ECParameters createParameters() {
0332:                    // p = 2^224 (2^32 - 1) + 2^192 + 2^96 - 1
0333:                    BigInteger p = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF");
0334:                    BigInteger a = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC");
0335:                    BigInteger b = fromHex("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B");
0336:                    byte[] S = Hex
0337:                            .decode("C49D360886E704936A6678E1139D26B7819F7E90");
0338:                    BigInteger n = fromHex("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551");
0339:                    BigInteger h = BigInteger.valueOf(1);
0340:
0341:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0342:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0343:                    //+ "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296"));
0344:                    ECPoint G = curve
0345:                            .decodePoint(Hex
0346:                                    .decode("04"
0347:                                            + "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296"
0348:                                            + "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5"));
0349:
0350:                    return new X9ECParameters(curve, G, n, h, S);
0351:                }
0352:            };
0353:
0354:            /*
0355:             * secp384r1
0356:             */
0357:            static X9ECParametersHolder secp384r1 = new X9ECParametersHolder() {
0358:                protected X9ECParameters createParameters() {
0359:                    // p = 2^384 - 2^128 - 2^96 + 2^32 - 1
0360:                    BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF");
0361:                    BigInteger a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC");
0362:                    BigInteger b = fromHex("B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF");
0363:                    byte[] S = Hex
0364:                            .decode("A335926AA319A27A1D00896A6773A4827ACDAC73");
0365:                    BigInteger n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973");
0366:                    BigInteger h = BigInteger.valueOf(1);
0367:
0368:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0369:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0370:                    //+ "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7"));
0371:                    ECPoint G = curve
0372:                            .decodePoint(Hex
0373:                                    .decode("04"
0374:                                            + "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7"
0375:                                            + "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F"));
0376:
0377:                    return new X9ECParameters(curve, G, n, h, S);
0378:                }
0379:            };
0380:
0381:            /*
0382:             * secp521r1
0383:             */
0384:            static X9ECParametersHolder secp521r1 = new X9ECParametersHolder() {
0385:                protected X9ECParameters createParameters() {
0386:                    // p = 2^521 - 1
0387:                    BigInteger p = fromHex("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
0388:                    BigInteger a = fromHex("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC");
0389:                    BigInteger b = fromHex("0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00");
0390:                    byte[] S = Hex
0391:                            .decode("D09E8800291CB85396CC6717393284AAA0DA64BA");
0392:                    BigInteger n = fromHex("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409");
0393:                    BigInteger h = BigInteger.valueOf(1);
0394:
0395:                    ECCurve curve = new ECCurve.Fp(p, a, b);
0396:                    //ECPoint G = curve.decodePoint(Hex.decode("02"
0397:                    //+ "00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66"));
0398:                    ECPoint G = curve
0399:                            .decodePoint(Hex
0400:                                    .decode("04"
0401:                                            + "00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66"
0402:                                            + "011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650"));
0403:
0404:                    return new X9ECParameters(curve, G, n, h, S);
0405:                }
0406:            };
0407:
0408:            /*
0409:             * sect113r1
0410:             */
0411:            static X9ECParametersHolder sect113r1 = new X9ECParametersHolder() {
0412:                protected X9ECParameters createParameters() {
0413:                    int m = 113;
0414:                    int k = 9;
0415:
0416:                    BigInteger a = fromHex("003088250CA6E7C7FE649CE85820F7");
0417:                    BigInteger b = fromHex("00E8BEE4D3E2260744188BE0E9C723");
0418:                    byte[] S = Hex
0419:                            .decode("10E723AB14D696E6768756151756FEBF8FCB49A9");
0420:                    BigInteger n = fromHex("0100000000000000D9CCEC8A39E56F");
0421:                    BigInteger h = BigInteger.valueOf(2);
0422:
0423:                    ECCurve curve = new ECCurve.F2m(m, k, a, b, n, h);
0424:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0425:                    //+ "009D73616F35F4AB1407D73562C10F"));
0426:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0427:                            + "009D73616F35F4AB1407D73562C10F"
0428:                            + "00A52830277958EE84D1315ED31886"));
0429:
0430:                    return new X9ECParameters(curve, G, n, h, S);
0431:                }
0432:            };
0433:
0434:            /*
0435:             * sect113r2
0436:             */
0437:            static X9ECParametersHolder sect113r2 = new X9ECParametersHolder() {
0438:                protected X9ECParameters createParameters() {
0439:                    int m = 113;
0440:                    int k = 9;
0441:
0442:                    BigInteger a = fromHex("00689918DBEC7E5A0DD6DFC0AA55C7");
0443:                    BigInteger b = fromHex("0095E9A9EC9B297BD4BF36E059184F");
0444:                    byte[] S = Hex
0445:                            .decode("10C0FB15760860DEF1EEF4D696E676875615175D");
0446:                    BigInteger n = fromHex("010000000000000108789B2496AF93");
0447:                    BigInteger h = BigInteger.valueOf(2);
0448:
0449:                    ECCurve curve = new ECCurve.F2m(m, k, a, b, n, h);
0450:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0451:                    //+ "01A57A6A7B26CA5EF52FCDB8164797"));
0452:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0453:                            + "01A57A6A7B26CA5EF52FCDB8164797"
0454:                            + "00B3ADC94ED1FE674C06E695BABA1D"));
0455:
0456:                    return new X9ECParameters(curve, G, n, h, S);
0457:                }
0458:            };
0459:
0460:            /*
0461:             * sect131r1
0462:             */
0463:            static X9ECParametersHolder sect131r1 = new X9ECParametersHolder() {
0464:                protected X9ECParameters createParameters() {
0465:                    int m = 131;
0466:                    int k1 = 2;
0467:                    int k2 = 3;
0468:                    int k3 = 8;
0469:
0470:                    BigInteger a = fromHex("07A11B09A76B562144418FF3FF8C2570B8");
0471:                    BigInteger b = fromHex("0217C05610884B63B9C6C7291678F9D341");
0472:                    byte[] S = Hex
0473:                            .decode("4D696E676875615175985BD3ADBADA21B43A97E2");
0474:                    BigInteger n = fromHex("0400000000000000023123953A9464B54D");
0475:                    BigInteger h = BigInteger.valueOf(2);
0476:
0477:                    ECCurve curve = new ECCurve.F2m(m, k1, k2, k3, a, b, n, h);
0478:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0479:                    //+ "0081BAF91FDF9833C40F9C181343638399"));
0480:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0481:                            + "0081BAF91FDF9833C40F9C181343638399"
0482:                            + "078C6E7EA38C001F73C8134B1B4EF9E150"));
0483:
0484:                    return new X9ECParameters(curve, G, n, h, S);
0485:                }
0486:            };
0487:
0488:            /*
0489:             * sect131r2
0490:             */
0491:            static X9ECParametersHolder sect131r2 = new X9ECParametersHolder() {
0492:                protected X9ECParameters createParameters() {
0493:                    int m = 131;
0494:                    int k1 = 2;
0495:                    int k2 = 3;
0496:                    int k3 = 8;
0497:
0498:                    BigInteger a = fromHex("03E5A88919D7CAFCBF415F07C2176573B2");
0499:                    BigInteger b = fromHex("04B8266A46C55657AC734CE38F018F2192");
0500:                    byte[] S = Hex
0501:                            .decode("985BD3ADBAD4D696E676875615175A21B43A97E3");
0502:                    BigInteger n = fromHex("0400000000000000016954A233049BA98F");
0503:                    BigInteger h = BigInteger.valueOf(2);
0504:
0505:                    ECCurve curve = new ECCurve.F2m(m, k1, k2, k3, a, b, n, h);
0506:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0507:                    //+ "0356DCD8F2F95031AD652D23951BB366A8"));
0508:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0509:                            + "0356DCD8F2F95031AD652D23951BB366A8"
0510:                            + "0648F06D867940A5366D9E265DE9EB240F"));
0511:
0512:                    return new X9ECParameters(curve, G, n, h, S);
0513:                }
0514:            };
0515:
0516:            /*
0517:             * sect163k1
0518:             */
0519:            static X9ECParametersHolder sect163k1 = new X9ECParametersHolder() {
0520:                protected X9ECParameters createParameters() {
0521:                    int m = 163;
0522:                    int k1 = 3;
0523:                    int k2 = 6;
0524:                    int k3 = 7;
0525:
0526:                    BigInteger a = BigInteger.valueOf(1);
0527:                    BigInteger b = BigInteger.valueOf(1);
0528:                    byte[] S = null;
0529:                    BigInteger n = fromHex("04000000000000000000020108A2E0CC0D99F8A5EF");
0530:                    BigInteger h = BigInteger.valueOf(2);
0531:
0532:                    ECCurve curve = new ECCurve.F2m(m, k1, k2, k3, a, b, n, h);
0533:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0534:                    //+ "02FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE8"));
0535:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0536:                            + "02FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE8"
0537:                            + "0289070FB05D38FF58321F2E800536D538CCDAA3D9"));
0538:
0539:                    return new X9ECParameters(curve, G, n, h, S);
0540:                }
0541:            };
0542:
0543:            /*
0544:             * sect163r1
0545:             */
0546:            static X9ECParametersHolder sect163r1 = new X9ECParametersHolder() {
0547:                protected X9ECParameters createParameters() {
0548:                    int m = 163;
0549:                    int k1 = 3;
0550:                    int k2 = 6;
0551:                    int k3 = 7;
0552:
0553:                    BigInteger a = fromHex("07B6882CAAEFA84F9554FF8428BD88E246D2782AE2");
0554:                    BigInteger b = fromHex("0713612DCDDCB40AAB946BDA29CA91F73AF958AFD9");
0555:                    byte[] S = Hex
0556:                            .decode("24B7B137C8A14D696E6768756151756FD0DA2E5C");
0557:                    BigInteger n = fromHex("03FFFFFFFFFFFFFFFFFFFF48AAB689C29CA710279B");
0558:                    BigInteger h = BigInteger.valueOf(2);
0559:
0560:                    ECCurve curve = new ECCurve.F2m(m, k1, k2, k3, a, b, n, h);
0561:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0562:                    //+ "0369979697AB43897789566789567F787A7876A654"));
0563:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0564:                            + "0369979697AB43897789566789567F787A7876A654"
0565:                            + "00435EDB42EFAFB2989D51FEFCE3C80988F41FF883"));
0566:
0567:                    return new X9ECParameters(curve, G, n, h, S);
0568:                }
0569:            };
0570:
0571:            /*
0572:             * sect163r2
0573:             */
0574:            static X9ECParametersHolder sect163r2 = new X9ECParametersHolder() {
0575:                protected X9ECParameters createParameters() {
0576:                    int m = 163;
0577:                    int k1 = 3;
0578:                    int k2 = 6;
0579:                    int k3 = 7;
0580:
0581:                    BigInteger a = BigInteger.valueOf(1);
0582:                    BigInteger b = fromHex("020A601907B8C953CA1481EB10512F78744A3205FD");
0583:                    byte[] S = Hex
0584:                            .decode("85E25BFE5C86226CDB12016F7553F9D0E693A268");
0585:                    BigInteger n = fromHex("040000000000000000000292FE77E70C12A4234C33");
0586:                    BigInteger h = BigInteger.valueOf(2);
0587:
0588:                    ECCurve curve = new ECCurve.F2m(m, k1, k2, k3, a, b, n, h);
0589:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0590:                    //+ "03F0EBA16286A2D57EA0991168D4994637E8343E36"));
0591:                    ECPoint G = curve.decodePoint(Hex.decode("04"
0592:                            + "03F0EBA16286A2D57EA0991168D4994637E8343E36"
0593:                            + "00D51FBC6C71A0094FA2CDD545B11C5C0C797324F1"));
0594:
0595:                    return new X9ECParameters(curve, G, n, h, S);
0596:                }
0597:            };
0598:
0599:            /*
0600:             * sect193r1
0601:             */
0602:            static X9ECParametersHolder sect193r1 = new X9ECParametersHolder() {
0603:                protected X9ECParameters createParameters() {
0604:                    int m = 193;
0605:                    int k = 15;
0606:
0607:                    BigInteger a = fromHex("0017858FEB7A98975169E171F77B4087DE098AC8A911DF7B01");
0608:                    BigInteger b = fromHex("00FDFB49BFE6C3A89FACADAA7A1E5BBC7CC1C2E5D831478814");
0609:                    byte[] S = Hex
0610:                            .decode("103FAEC74D696E676875615175777FC5B191EF30");
0611:                    BigInteger n = fromHex("01000000000000000000000000C7F34A778F443ACC920EBA49");
0612:                    BigInteger h = BigInteger.valueOf(2);
0613:
0614:                    ECCurve curve = new ECCurve.F2m(m, k, a, b, n, h);
0615:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0616:                    //+ "01F481BC5F0FF84A74AD6CDF6FDEF4BF6179625372D8C0C5E1"));
0617:                    ECPoint G = curve
0618:                            .decodePoint(Hex
0619:                                    .decode("04"
0620:                                            + "01F481BC5F0FF84A74AD6CDF6FDEF4BF6179625372D8C0C5E1"
0621:                                            + "0025E399F2903712CCF3EA9E3A1AD17FB0B3201B6AF7CE1B05"));
0622:
0623:                    return new X9ECParameters(curve, G, n, h, S);
0624:                }
0625:            };
0626:
0627:            /*
0628:             * sect193r2
0629:             */
0630:            static X9ECParametersHolder sect193r2 = new X9ECParametersHolder() {
0631:                protected X9ECParameters createParameters() {
0632:                    int m = 193;
0633:                    int k = 15;
0634:
0635:                    BigInteger a = fromHex("0163F35A5137C2CE3EA6ED8667190B0BC43ECD69977702709B");
0636:                    BigInteger b = fromHex("00C9BB9E8927D4D64C377E2AB2856A5B16E3EFB7F61D4316AE");
0637:                    byte[] S = Hex
0638:                            .decode("10B7B4D696E676875615175137C8A16FD0DA2211");
0639:                    BigInteger n = fromHex("010000000000000000000000015AAB561B005413CCD4EE99D5");
0640:                    BigInteger h = BigInteger.valueOf(2);
0641:
0642:                    ECCurve curve = new ECCurve.F2m(m, k, a, b, n, h);
0643:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0644:                    //+ "00D9B67D192E0367C803F39E1A7E82CA14A651350AAE617E8F"));
0645:                    ECPoint G = curve
0646:                            .decodePoint(Hex
0647:                                    .decode("04"
0648:                                            + "00D9B67D192E0367C803F39E1A7E82CA14A651350AAE617E8F"
0649:                                            + "01CE94335607C304AC29E7DEFBD9CA01F596F927224CDECF6C"));
0650:
0651:                    return new X9ECParameters(curve, G, n, h, S);
0652:                }
0653:            };
0654:
0655:            /*
0656:             * sect233k1
0657:             */
0658:            static X9ECParametersHolder sect233k1 = new X9ECParametersHolder() {
0659:                protected X9ECParameters createParameters() {
0660:                    int m = 233;
0661:                    int k = 74;
0662:
0663:                    BigInteger a = ECConstants.ZERO;
0664:                    BigInteger b = BigInteger.valueOf(1);
0665:                    byte[] S = null;
0666:                    BigInteger n = fromHex("8000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF");
0667:                    BigInteger h = BigInteger.valueOf(4);
0668:
0669:                    ECCurve curve = new ECCurve.F2m(m, k, a, b, n, h);
0670:                    //ECPoint G = curve.decodePoint(Hex.decode("02"
0671:                    //+ "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126"));
0672:                    ECPoint G = curve
0673:                            .decodePoint(Hex
0674:                                    .decode("04"
0675:                                            + "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126"
0676:                                            + "01DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3"));
0677:
0678:                    return new X9ECParameters(curve, G, n, h, S);
0679:                }
0680:            };
0681:
0682:            /*
0683:             * sect233r1
0684:             */
0685:            static X9ECParametersHolder sect233r1 = new X9ECParametersHolder() {
0686:                protected X9ECParameters createParameters() {
0687:                    int m = 233;
0688:                    int k = 74;
0689:
0690:                    BigInteger a = BigInteger.valueOf(1);
0691:                    BigInteger b = fromHex("0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD");
0692:                    byte[] S = Hex
0693:                            .decode("74D59FF07F6B413D0EA14B344B20A2DB049B50C3");
0694:                    BigInteger n = fromHex("01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7");
0695:                    BigInteger h = BigInteger.valueOf(2);
0696:
0697:                    ECCurve curve = new ECCurve.F2m(m, k, a, b, n, h);
0698:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0699:                    //+ "00FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B"));
0700:                    ECPoint G = curve
0701:                            .decodePoint(Hex
0702:                                    .decode("04"
0703:                                            + "00FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B"
0704:                                            + "01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052"));
0705:
0706:                    return new X9ECParameters(curve, G, n, h, S);
0707:                }
0708:            };
0709:
0710:            /*
0711:             * sect239k1
0712:             */
0713:            static X9ECParametersHolder sect239k1 = new X9ECParametersHolder() {
0714:                protected X9ECParameters createParameters() {
0715:                    int m = 239;
0716:                    int k = 158;
0717:
0718:                    BigInteger a = ECConstants.ZERO;
0719:                    BigInteger b = BigInteger.valueOf(1);
0720:                    byte[] S = null;
0721:                    BigInteger n = fromHex("2000000000000000000000000000005A79FEC67CB6E91F1C1DA800E478A5");
0722:                    BigInteger h = BigInteger.valueOf(4);
0723:
0724:                    ECCurve curve = new ECCurve.F2m(m, k, a, b, n, h);
0725:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0726:                    //+ "29A0B6A887A983E9730988A68727A8B2D126C44CC2CC7B2A6555193035DC"));
0727:                    ECPoint G = curve
0728:                            .decodePoint(Hex
0729:                                    .decode("04"
0730:                                            + "29A0B6A887A983E9730988A68727A8B2D126C44CC2CC7B2A6555193035DC"
0731:                                            + "76310804F12E549BDB011C103089E73510ACB275FC312A5DC6B76553F0CA"));
0732:
0733:                    return new X9ECParameters(curve, G, n, h, S);
0734:                }
0735:            };
0736:
0737:            /*
0738:             * sect283k1
0739:             */
0740:            static X9ECParametersHolder sect283k1 = new X9ECParametersHolder() {
0741:                protected X9ECParameters createParameters() {
0742:                    int m = 283;
0743:                    int k1 = 5;
0744:                    int k2 = 7;
0745:                    int k3 = 12;
0746:
0747:                    BigInteger a = ECConstants.ZERO;
0748:                    BigInteger b = BigInteger.valueOf(1);
0749:                    byte[] S = null;
0750:                    BigInteger n = fromHex("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61");
0751:                    BigInteger h = BigInteger.valueOf(4);
0752:
0753:                    ECCurve curve = new ECCurve.F2m(m, k1, k2, k3, a, b, n, h);
0754:                    //ECPoint G = curve.decodePoint(Hex.decode("02"
0755:                    //+ "0503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC2458492836"));
0756:                    ECPoint G = curve
0757:                            .decodePoint(Hex
0758:                                    .decode("04"
0759:                                            + "0503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC2458492836"
0760:                                            + "01CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2259"));
0761:
0762:                    return new X9ECParameters(curve, G, n, h, S);
0763:                }
0764:            };
0765:
0766:            /*
0767:             * sect283r1
0768:             */
0769:            static X9ECParametersHolder sect283r1 = new X9ECParametersHolder() {
0770:                protected X9ECParameters createParameters() {
0771:                    int m = 283;
0772:                    int k1 = 5;
0773:                    int k2 = 7;
0774:                    int k3 = 12;
0775:
0776:                    BigInteger a = BigInteger.valueOf(1);
0777:                    BigInteger b = fromHex("027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A2F5");
0778:                    byte[] S = Hex
0779:                            .decode("77E2B07370EB0F832A6DD5B62DFC88CD06BB84BE");
0780:                    BigInteger n = fromHex("03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB307");
0781:                    BigInteger h = BigInteger.valueOf(2);
0782:
0783:                    ECCurve curve = new ECCurve.F2m(m, k1, k2, k3, a, b, n, h);
0784:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0785:                    //+ "05F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B12053"));
0786:                    ECPoint G = curve
0787:                            .decodePoint(Hex
0788:                                    .decode("04"
0789:                                            + "05F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B12053"
0790:                                            + "03676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE8112F4"));
0791:
0792:                    return new X9ECParameters(curve, G, n, h, S);
0793:                }
0794:            };
0795:
0796:            /*
0797:             * sect409k1
0798:             */
0799:            static X9ECParametersHolder sect409k1 = new X9ECParametersHolder() {
0800:                protected X9ECParameters createParameters() {
0801:                    int m = 409;
0802:                    int k = 87;
0803:
0804:                    BigInteger a = ECConstants.ZERO;
0805:                    BigInteger b = BigInteger.valueOf(1);
0806:                    byte[] S = null;
0807:                    BigInteger n = fromHex("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F83B2D4EA20400EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF");
0808:                    BigInteger h = BigInteger.valueOf(4);
0809:
0810:                    ECCurve curve = new ECCurve.F2m(m, k, a, b, n, h);
0811:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0812:                    //+ "0060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE9023746"));
0813:                    ECPoint G = curve
0814:                            .decodePoint(Hex
0815:                                    .decode("04"
0816:                                            + "0060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE9023746"
0817:                                            + "01E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6C42E9C55215AA9CA27A5863EC48D8E0286B"));
0818:
0819:                    return new X9ECParameters(curve, G, n, h, S);
0820:                }
0821:            };
0822:
0823:            /*
0824:             * sect409r1
0825:             */
0826:            static X9ECParametersHolder sect409r1 = new X9ECParametersHolder() {
0827:                protected X9ECParameters createParameters() {
0828:                    int m = 409;
0829:                    int k = 87;
0830:
0831:                    BigInteger a = BigInteger.valueOf(1);
0832:                    BigInteger b = fromHex("0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A197B272822F6CD57A55AA4F50AE317B13545F");
0833:                    byte[] S = Hex
0834:                            .decode("4099B5A457F9D69F79213D094C4BCD4D4262210B");
0835:                    BigInteger n = fromHex("010000000000000000000000000000000000000000000000000001E2AAD6A612F33307BE5FA47C3C9E052F838164CD37D9A21173");
0836:                    BigInteger h = BigInteger.valueOf(2);
0837:
0838:                    ECCurve curve = new ECCurve.F2m(m, k, a, b, n, h);
0839:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0840:                    //+ "015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A7"));
0841:                    ECPoint G = curve
0842:                            .decodePoint(Hex
0843:                                    .decode("04"
0844:                                            + "015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A7"
0845:                                            + "0061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514F1FDF4B4F40D2181B3681C364BA0273C706"));
0846:
0847:                    return new X9ECParameters(curve, G, n, h, S);
0848:                }
0849:            };
0850:
0851:            /*
0852:             * sect571k1
0853:             */
0854:            static X9ECParametersHolder sect571k1 = new X9ECParametersHolder() {
0855:                protected X9ECParameters createParameters() {
0856:                    int m = 571;
0857:                    int k1 = 2;
0858:                    int k2 = 5;
0859:                    int k3 = 10;
0860:
0861:                    BigInteger a = ECConstants.ZERO;
0862:                    BigInteger b = BigInteger.valueOf(1);
0863:                    byte[] S = null;
0864:                    BigInteger n = fromHex("020000000000000000000000000000000000000000000000000000000000000000000000131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F637C1001");
0865:                    BigInteger h = BigInteger.valueOf(4);
0866:
0867:                    ECCurve curve = new ECCurve.F2m(m, k1, k2, k3, a, b, n, h);
0868:                    //ECPoint G = curve.decodePoint(Hex.decode("02"
0869:                    //+ "026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C8972"));
0870:                    ECPoint G = curve
0871:                            .decodePoint(Hex
0872:                                    .decode("04"
0873:                                            + "026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C8972"
0874:                                            + "0349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D4979C0AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143EF1C7A3"));
0875:
0876:                    return new X9ECParameters(curve, G, n, h, S);
0877:                }
0878:            };
0879:
0880:            /*
0881:             * sect571r1
0882:             */
0883:            static X9ECParametersHolder sect571r1 = new X9ECParametersHolder() {
0884:                protected X9ECParameters createParameters() {
0885:                    int m = 571;
0886:                    int k1 = 2;
0887:                    int k2 = 5;
0888:                    int k3 = 10;
0889:
0890:                    BigInteger a = BigInteger.valueOf(1);
0891:                    BigInteger b = fromHex("02F40E7E2221F295DE297117B7F3D62F5C6A97FFCB8CEFF1CD6BA8CE4A9A18AD84FFABBD8EFA59332BE7AD6756A66E294AFD185A78FF12AA520E4DE739BACA0C7FFEFF7F2955727A");
0892:                    byte[] S = Hex
0893:                            .decode("2AA058F73A0E33AB486B0F610410C53A7F132310");
0894:                    BigInteger n = fromHex("03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE661CE18FF55987308059B186823851EC7DD9CA1161DE93D5174D66E8382E9BB2FE84E47");
0895:                    BigInteger h = BigInteger.valueOf(2);
0896:
0897:                    ECCurve curve = new ECCurve.F2m(m, k1, k2, k3, a, b, n, h);
0898:                    //ECPoint G = curve.decodePoint(Hex.decode("03"
0899:                    //+ "0303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53950F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8EEC2D19"));
0900:                    ECPoint G = curve
0901:                            .decodePoint(Hex
0902:                                    .decode("04"
0903:                                            + "0303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53950F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8EEC2D19"
0904:                                            + "037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423E43BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B8AC15B"));
0905:
0906:                    return new X9ECParameters(curve, G, n, h, S);
0907:                }
0908:            };
0909:
0910:            static final Hashtable objIds = new Hashtable();
0911:            static final Hashtable curves = new Hashtable();
0912:            static final Hashtable names = new Hashtable();
0913:
0914:            static void defineCurve(String name, DERObjectIdentifier oid,
0915:                    X9ECParametersHolder holder) {
0916:                objIds.put(name, oid);
0917:                names.put(oid, name);
0918:                curves.put(oid, holder);
0919:            }
0920:
0921:            static {
0922:                defineCurve("secp112r1", SECObjectIdentifiers.secp112r1,
0923:                        secp112r1);
0924:                defineCurve("secp112r2", SECObjectIdentifiers.secp112r2,
0925:                        secp112r2);
0926:                defineCurve("secp128r1", SECObjectIdentifiers.secp128r1,
0927:                        secp128r1);
0928:                defineCurve("secp128r2", SECObjectIdentifiers.secp128r2,
0929:                        secp128r2);
0930:                //        defineCurve("secp160k1", SECObjectIdentifiers.secp160k1, secp160k1);
0931:                defineCurve("secp160r1", SECObjectIdentifiers.secp160r1,
0932:                        secp160r1);
0933:                defineCurve("secp160r2", SECObjectIdentifiers.secp160r2,
0934:                        secp160r2);
0935:                //        defineCurve("secp192k1", SECObjectIdentifiers.secp192k1, secp192k1);
0936:                defineCurve("secp192r1", SECObjectIdentifiers.secp192r1,
0937:                        secp192r1);
0938:                //        defineCurve("secp224k1", SECObjectIdentifiers.secp224k1, secp224k1);
0939:                defineCurve("secp224r1", SECObjectIdentifiers.secp224r1,
0940:                        secp224r1);
0941:                //        defineCurve("secp256k1", SECObjectIdentifiers.secp256k1, secp256k1);
0942:                defineCurve("secp256r1", SECObjectIdentifiers.secp256r1,
0943:                        secp256r1);
0944:                defineCurve("secp384r1", SECObjectIdentifiers.secp384r1,
0945:                        secp384r1);
0946:                defineCurve("secp521r1", SECObjectIdentifiers.secp521r1,
0947:                        secp521r1);
0948:
0949:                defineCurve("sect113r1", SECObjectIdentifiers.sect113r1,
0950:                        sect113r1);
0951:                defineCurve("sect113r2", SECObjectIdentifiers.sect113r2,
0952:                        sect113r2);
0953:                defineCurve("sect131r1", SECObjectIdentifiers.sect131r1,
0954:                        sect131r1);
0955:                defineCurve("sect131r2", SECObjectIdentifiers.sect131r2,
0956:                        sect131r2);
0957:                defineCurve("sect163k1", SECObjectIdentifiers.sect163k1,
0958:                        sect163k1);
0959:                defineCurve("sect163r1", SECObjectIdentifiers.sect163r1,
0960:                        sect163r1);
0961:                defineCurve("sect163r2", SECObjectIdentifiers.sect163r2,
0962:                        sect163r2);
0963:                defineCurve("sect193r1", SECObjectIdentifiers.sect193r1,
0964:                        sect193r1);
0965:                defineCurve("sect193r2", SECObjectIdentifiers.sect193r2,
0966:                        sect193r2);
0967:                defineCurve("sect233k1", SECObjectIdentifiers.sect233k1,
0968:                        sect233k1);
0969:                defineCurve("sect233r1", SECObjectIdentifiers.sect233r1,
0970:                        sect233r1);
0971:                defineCurve("sect239k1", SECObjectIdentifiers.sect239k1,
0972:                        sect239k1);
0973:                defineCurve("sect283k1", SECObjectIdentifiers.sect283k1,
0974:                        sect283k1);
0975:                defineCurve("sect283r1", SECObjectIdentifiers.sect283r1,
0976:                        sect283r1);
0977:                defineCurve("sect409k1", SECObjectIdentifiers.sect409k1,
0978:                        sect409k1);
0979:                defineCurve("sect409r1", SECObjectIdentifiers.sect409r1,
0980:                        sect409r1);
0981:                defineCurve("sect571k1", SECObjectIdentifiers.sect571k1,
0982:                        sect571k1);
0983:                defineCurve("sect571r1", SECObjectIdentifiers.sect571r1,
0984:                        sect571r1);
0985:            }
0986:
0987:            public static X9ECParameters getByName(String name) {
0988:                DERObjectIdentifier oid = (DERObjectIdentifier) objIds
0989:                        .get(Strings.toLowerCase(name));
0990:
0991:                if (oid != null) {
0992:                    return getByOID(oid);
0993:                }
0994:
0995:                return null;
0996:            }
0997:
0998:            /**
0999:             * return the X9ECParameters object for the named curve represented by
1000:             * the passed in object identifier. Null if the curve isn't present.
1001:             *
1002:             * @param oid an object identifier representing a named curve, if present.
1003:             */
1004:            public static X9ECParameters getByOID(DERObjectIdentifier oid) {
1005:                X9ECParametersHolder holder = (X9ECParametersHolder) curves
1006:                        .get(oid);
1007:
1008:                if (holder != null) {
1009:                    return holder.getParameters();
1010:                }
1011:
1012:                return null;
1013:            }
1014:
1015:            /**
1016:             * return the object identifier signified by the passed in name. Null
1017:             * if there is no object identifier associated with name.
1018:             *
1019:             * @return the object identifier associated with name, if present.
1020:             */
1021:            public static DERObjectIdentifier getOID(String name) {
1022:                return (DERObjectIdentifier) objIds.get(Strings
1023:                        .toLowerCase(name));
1024:            }
1025:
1026:            /**
1027:             * return the named curve name represented by the given object identifier.
1028:             */
1029:            public static String getName(DERObjectIdentifier oid) {
1030:                return (String) names.get(oid);
1031:            }
1032:
1033:            /**
1034:             * returns an enumeration containing the name strings for curves
1035:             * contained in this structure.
1036:             */
1037:            public static Enumeration getNames() {
1038:                return objIds.keys();
1039:            }
1040:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.