Package org.bouncycastle.math.ec
Class ECPoint
java.lang.Object
org.bouncycastle.math.ec.ECPoint
- Direct Known Subclasses:
ECPoint.AbstractF2m
,ECPoint.AbstractFp
base class for points on elliptic curves.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
Elliptic curve points over F2mstatic class
Elliptic curve points over Fp -
Field Summary
Modifier and TypeFieldDescriptionprotected ECCurve
protected static final ECFieldElement[]
protected Hashtable
protected ECFieldElement
protected ECFieldElement
protected ECFieldElement[]
-
Constructor Summary
ModifierConstructorDescriptionprotected
ECPoint
(ECCurve curve, ECFieldElement x, ECFieldElement y) protected
ECPoint
(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) -
Method Summary
Modifier and TypeMethodDescriptionabstract ECPoint
protected void
protected ECPoint
protected abstract ECPoint
detach()
void
encodeTo
(boolean compressed, byte[] buf, int off) boolean
boolean
Returns the affine x-coordinate after checking that this point is normalized.Returns the affine y-coordinate after checking that this point is normalizedprotected abstract boolean
getCurve()
protected int
final ECPoint
byte[]
getEncoded
(boolean compressed) Get an encoding of the point value, optionally in compressed format.int
getEncodedLength
(boolean compressed) protected static ECFieldElement[]
getInitialZCoords
(ECCurve curve) final ECFieldElement
final ECFieldElement
protected final ECFieldElement[]
Returns the x-coordinate.Returns the y-coordinate.getZCoord
(int index) int
hashCode()
boolean
boolean
boolean
isValid()
Multiplies thisECPoint
by the given number.abstract ECPoint
negate()
Normalization ensures that any projective coordinate is 1, and therefore that the x, y coordinates reflect those of the equivalent point in an affine coordinate system.protected abstract boolean
protected boolean
scaleX
(ECFieldElement scale) scaleXNegateY
(ECFieldElement scale) scaleY
(ECFieldElement scale) scaleYNegateX
(ECFieldElement scale) abstract ECPoint
timesPow2
(int e) toString()
abstract ECPoint
twice()
-
Field Details
-
EMPTY_ZS
-
curve
-
x
-
y
-
zs
-
preCompTable
-
-
Constructor Details
-
ECPoint
-
ECPoint
-
-
Method Details
-
getInitialZCoords
-
satisfiesCurveEquation
protected abstract boolean satisfiesCurveEquation() -
satisfiesOrder
protected boolean satisfiesOrder() -
getDetachedPoint
-
getCurve
-
detach
-
getCurveCoordinateSystem
protected int getCurveCoordinateSystem() -
getAffineXCoord
Returns the affine x-coordinate after checking that this point is normalized.- Returns:
- The affine x-coordinate of this point
- Throws:
IllegalStateException
- if the point is not normalized
-
getAffineYCoord
Returns the affine y-coordinate after checking that this point is normalized- Returns:
- The affine y-coordinate of this point
- Throws:
IllegalStateException
- if the point is not normalized
-
getXCoord
Returns the x-coordinate. Caution: depending on the curve's coordinate system, this may not be the same value as in an affine coordinate system; use normalize() to get a point where the coordinates have their affine values, or use getAffineXCoord() if you expect the point to already have been normalized.- Returns:
- the x-coordinate of this point
-
getYCoord
Returns the y-coordinate. Caution: depending on the curve's coordinate system, this may not be the same value as in an affine coordinate system; use normalize() to get a point where the coordinates have their affine values, or use getAffineYCoord() if you expect the point to already have been normalized.- Returns:
- the y-coordinate of this point
-
getZCoord
-
getZCoords
-
getRawXCoord
-
getRawYCoord
-
getRawZCoords
-
checkNormalized
protected void checkNormalized() -
isNormalized
public boolean isNormalized() -
normalize
Normalization ensures that any projective coordinate is 1, and therefore that the x, y coordinates reflect those of the equivalent point in an affine coordinate system.- Returns:
- a new ECPoint instance representing the same point, but with normalized coordinates
-
createScaledPoint
-
isInfinity
public boolean isInfinity() -
isValid
public boolean isValid() -
scaleX
-
scaleXNegateY
-
scaleY
-
scaleYNegateX
-
equals
-
equals
-
hashCode
public int hashCode() -
toString
-
getEncoded
public byte[] getEncoded(boolean compressed) Get an encoding of the point value, optionally in compressed format.- Parameters:
compressed
- whether to generate a compressed point encoding.- Returns:
- the point encoding
-
getEncodedLength
public int getEncodedLength(boolean compressed) -
encodeTo
public void encodeTo(boolean compressed, byte[] buf, int off) -
getCompressionYTilde
protected abstract boolean getCompressionYTilde() -
add
-
negate
-
subtract
-
timesPow2
-
twice
-
twicePlus
-
threeTimes
-
multiply
Multiplies thisECPoint
by the given number.- Parameters:
k
- The multiplicator.- Returns:
k * this
.
-