I try to use an ECKey (http://www.win.tue.nl/pinpasjc/docs/apis/jc222/javacard/security/ECKey.html) with the P-256 curve defined by NIST on a Java Card:
Curve P-256
p = 115792089210356248762697446949407573530086143415290314195533631308867097853951
r = 115792089210356248762697446949407573529996955224135760342422259061068512044369
s = c49d3608 86e70493 6a6678e1 139d26b7 819f7e90
c = 7efba166 2985be94 03cb055c 75d4f7e0 ce8d84a9 c5114abc af317768 0104fa0d
b = 5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b
Gx = 6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296
Gy = 4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5
with y²= x³ -3x + b (mod p)
As far as I understand it I use
- p for setFieldFP(), prime p corresponding to the field GF(p)
- r for setR(), order of the fixed point G of the curve,
- b for setB(), second coefficient of the curve,
- Gx and Gy for setG(), fixed point of the curve (after encoding them as ANSI X9.62),
- cofactor of the order of the fixed point G is 1, so setK(1)
The coefficient A is -3 (according to the definition of the curve). But how do I have to encode -3 (as a byte[]), so that I can set it with setA()?