Open zhumingu opened 6 years ago
could you be more specific, pls? What exactly causes the error and why?
When I sign()
tx with ECKey
and toByteArray()
, the result is error because of the bigIntegerToBytes
function.
public static byte[] bigIntegerToBytes(BigInteger value) {
if (value == null)
return null;
byte[] data = value.toByteArray();
if (data.length != 1 && data[0] == 0) { // when the data[0] == 0, the result is error
byte[] tmp = new byte[data.length - 1];
System.arraycopy(data, 1, tmp, 0, tmp.length);
data = tmp;
}
return data;
}
That's the way I use it.
would it be possible to share the pKey and the data you're trying to sign?
`public byte[] toByteArray() { final byte fixedV = this.v >= 27 ? (byte) (this.v - 27) :this.v;
}
public static byte[] bigIntegerToBytes(BigInteger value) { if (value == null) return null;
}
When
data[0] == 0`, the signature is error.