The current implementation of ECKey.decompressKey essentially duplicates the
internal BC implementation. I suggest it is simpler (and more likely to pickup
future BC improvements) to produce a compressed point encoding and let BC
decode it, as follows:
X9IntegerConverter x9 = new X9IntegerConverter();
byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
return CURVE.getCurve().decodePoint(compEnc);
We (BC) will probably add support for doing this directly without the encoding
step, but in the meantime I think this is a better approach than the explicit
calculation.
Original issue reported on code.google.com by peter.de...@gmail.com on 6 Dec 2013 at 5:01
Original issue reported on code.google.com by
peter.de...@gmail.com
on 6 Dec 2013 at 5:01