cryptography - brainpool320r1 Elliptic Curve not supported in Java Card? -


i working on java card 3.0.1 applet on use ecc. card supports ecc gf(p) 320bits, tried use brainpool320r1 elliptic curve (parameters). problem cryptoexception don't understand... same kind of problem had few time ago: restricted elliptic curves in java card solution given doesn't match case (the curve defined 320bits prime).

i post corresponding code :

byte[] p = new byte[] { (byte) 0xd3, (byte) 0x5e, (byte) 0x47, (byte) 0x20,         (byte) 0x36, (byte) 0xbc, (byte) 0x4f, (byte) 0xb7,         (byte) 0xe1, (byte) 0x3c, (byte) 0x78, (byte) 0x5e,         (byte) 0xd2, (byte) 0x01, (byte) 0xe0, (byte) 0x65,         (byte) 0xf9, (byte) 0x8f, (byte) 0xcf, (byte) 0xa6,         (byte) 0xf6, (byte) 0xf4, (byte) 0x0d, (byte) 0xef,         (byte) 0x4f, (byte) 0x92, (byte) 0xb9, (byte) 0xec,         (byte) 0x78, (byte) 0x93, (byte) 0xec, (byte) 0x28,         (byte) 0xfc, (byte) 0xd4, (byte) 0x12, (byte) 0xb1,         (byte) 0xf1, (byte) 0xb3, (byte) 0x2e, (byte) 0x27 };  byte[] = new byte[] { (byte) 0x3e, (byte) 0xe3, (byte) 0x0b, (byte) 0x56,     (byte) 0x8f, (byte) 0xba, (byte) 0xb0, (byte) 0xf8,     (byte) 0x83, (byte) 0xcc, (byte) 0xeb, (byte) 0xd4,     (byte) 0x6d, (byte) 0x3f, (byte) 0x3b, (byte) 0xb8,     (byte) 0xa2, (byte) 0xa7, (byte) 0x35, (byte) 0x13,     (byte) 0xf5, (byte) 0xeb, (byte) 0x79, (byte) 0xda,     (byte) 0x66, (byte) 0x19, (byte) 0x0e, (byte) 0xb0,     (byte) 0x85, (byte) 0xff, (byte) 0xa9, (byte) 0xf4,     (byte) 0x92, (byte) 0xf3, (byte) 0x75, (byte) 0xa9,     (byte) 0x7d, (byte) 0x86, (byte) 0x0e, (byte) 0xb4 };  byte[] b = new byte[] { (byte) 0x52, (byte) 0x08, (byte) 0x83, (byte) 0x94,     (byte) 0x9d, (byte) 0xfd, (byte) 0xbc, (byte) 0x42,     (byte) 0xd3, (byte) 0xad, (byte) 0x19, (byte) 0x86,     (byte) 0x40, (byte) 0x68, (byte) 0x8a, (byte) 0x6f,     (byte) 0xe1, (byte) 0x3f, (byte) 0x41, (byte) 0x34,     (byte) 0x95, (byte) 0x54, (byte) 0xb4, (byte) 0x9a,     (byte) 0xcc, (byte) 0x31, (byte) 0xdc, (byte) 0xcd,     (byte) 0x88, (byte) 0x45, (byte) 0x39, (byte) 0x81,     (byte) 0x6f, (byte) 0x5e, (byte) 0xb4, (byte) 0xac,     (byte) 0x8f, (byte) 0xb1, (byte) 0xf1, (byte) 0xa6 };  byte[] r = new byte[] { (byte) 0xd3, (byte) 0x5e, (byte) 0x47, (byte) 0x20,     (byte) 0x36, (byte) 0xbc, (byte) 0x4f, (byte) 0xb7,     (byte) 0xe1, (byte) 0x3c, (byte) 0x78, (byte) 0x5e,     (byte) 0xd2, (byte) 0x01, (byte) 0xe0, (byte) 0x65,     (byte) 0xf9, (byte) 0x8f, (byte) 0xcf, (byte) 0xa5,     (byte) 0xb6, (byte) 0x8f, (byte) 0x12, (byte) 0xa3,     (byte) 0x2d, (byte) 0x48, (byte) 0x2e, (byte) 0xc7,     (byte) 0xee, (byte) 0x86, (byte) 0x58, (byte) 0xe9,     (byte) 0x86, (byte) 0x91, (byte) 0x55, (byte) 0x5b,     (byte) 0x44, (byte) 0xc5, (byte) 0x93, (byte) 0x11 };  byte[] g = new byte[] { (byte) 0x04, (byte) 0x43, (byte) 0xbd, (byte) 0x7e,     (byte) 0x9a, (byte) 0xfb, (byte) 0x53, (byte) 0xd8,     (byte) 0xb8, (byte) 0x52, (byte) 0x89, (byte) 0xbc,     (byte) 0xc4, (byte) 0x8e, (byte) 0xe5, (byte) 0xbf,     (byte) 0xe6, (byte) 0xf2, (byte) 0x01, (byte) 0x37,     (byte) 0xd1, (byte) 0x0a, (byte) 0x08, (byte) 0x7e,     (byte) 0xb6, (byte) 0xe7, (byte) 0x87, (byte) 0x1e,     (byte) 0x2a, (byte) 0x10, (byte) 0xa5, (byte) 0x99,     (byte) 0xc7, (byte) 0x10, (byte) 0xaf, (byte) 0x8d,     (byte) 0x0d, (byte) 0x39, (byte) 0xe2, (byte) 0x06,     (byte) 0x11, (byte) 0x14, (byte) 0xfd, (byte) 0xd0,     (byte) 0x55, (byte) 0x45, (byte) 0xec, (byte) 0x1c,     (byte) 0xc8, (byte) 0xab, (byte) 0x40, (byte) 0x93,     (byte) 0x24, (byte) 0x7f, (byte) 0x77, (byte) 0x27,     (byte) 0x5e, (byte) 0x07, (byte) 0x43, (byte) 0xff,     (byte) 0xed, (byte) 0x11, (byte) 0x71, (byte) 0x82,     (byte) 0xea, (byte) 0xa9, (byte) 0xc7, (byte) 0x78,     (byte) 0x77, (byte) 0xaa, (byte) 0xac, (byte) 0x6a,     (byte) 0xc7, (byte) 0xd3, (byte) 0x52, (byte) 0x45,     (byte) 0xd1, (byte) 0x69, (byte) 0x2e, (byte) 0x8e, (byte) 0xe1 };      ecpublickey ecdhpubkey = (ecpublickey) keybuilder.buildkey(             keybuilder.type_ec_fp_public, (short) 0x0140, false);     ecdhpubkey.setfieldfp(p, (short) 0x0000, (short) 0x0028);     ecdhpubkey.seta(a, (short) 0x0000, (short) 0x0028);     ecdhpubkey.setb(b, (short) 0x0000, (short) 0x0028);     ecdhpubkey.setr(r, (short) 0x0000, (short) 0x0028);     ecdhpubkey.setg(g, (short) 0x0000, (short) g.length);      ecprivatekey ecdhprivkey = (ecprivatekey) keybuilder.buildkey(         keybuilder.type_ec_fp_private, (short) 0x0140, false);      // generate key pair (x, xg) ecdh.     keypair keypair = new keypair(ecdhpubkey, ecdhprivkey);     keypair.genkeypair(); 

i checked step step, going right, except last line keypair.genkeypair(); raises cryptoexception.illegal_value. in java card specifications, said means values fp, a, b, r , g specified ecpublickey invalid... verified, corresponds brainpool520r1. ? doing wrong ? curve not defined ecc ? thank in advance.

as maarten bodewes said in comments above, the problem didn't set domain parameters ecprivatekey although java card specifications mentions necessary ecpublickey.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -