use of org.bouncycastle.asn1.x9.X9IntegerConverter in project xdagj by XDagger.
the class Sign method decompressKey.
/**
* Decompress a compressed public key (x co-ord and low-bit of y-coord).
*/
public static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
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);
}
use of org.bouncycastle.asn1.x9.X9IntegerConverter in project Elastos.DID.Java.SDK by elastos.
the class ECKey method decompressKey.
/**
* Decompress a compressed public key (x co-ord and low-bit of y-coord).
*/
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
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);
}
use of org.bouncycastle.asn1.x9.X9IntegerConverter in project digital-asset-wallet by dingan-work.
the class SECP256K1 method decompressKey.
/**
* Decompress a compressed public key (x co-ord and low-bit of y-coord).
*/
private static ECPoint decompressKey(final BigInteger xBN, final boolean yBit) {
final X9IntegerConverter x9 = new X9IntegerConverter();
final byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
compEnc[0] = (byte) (yBit ? 0x03 : 0x02);
// Currently ECCurve#decodePoint throws an IllegalArgumentException.
return CURVE.getCurve().decodePoint(compEnc);
}
Aggregations