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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classElliptic curve points over F2mstatic classElliptic curve points over Fp -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ECCurveprotected static final ECFieldElement[]protected Map<String, PreCompInfo> protected ECFieldElementprotected ECFieldElementprotected ECFieldElement[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedECPoint(ECCurve curve, ECFieldElement x, ECFieldElement y) protectedECPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) -
Method Summary
Modifier and TypeMethodDescriptionabstract ECPointprotected voidprotected ECPointbooleanbooleanReturns the affine x-coordinate after checking that this point is normalized.Returns the affine y-coordinate after checking that this point is normalizedprotected abstract booleangetCurve()protected intbyte[]getEncoded(boolean compressed) Get an encoding of the point value, optionally in compressed format.protected static ECFieldElement[]getInitialZCoords(ECCurve curve) final ECFieldElementfinal ECFieldElementprotected final ECFieldElement[]Returns the x-coordinate.Returns the y-coordinate.getZCoord(int index) inthashCode()booleanbooleanbooleanisValid()Multiplies thisECPointby the given number.abstract ECPointnegate()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 booleanprotected booleanscaleX(ECFieldElement scale) scaleXNegateY(ECFieldElement scale) scaleY(ECFieldElement scale) scaleYNegateX(ECFieldElement scale) abstract ECPointtimesPow2(int e) toString()abstract ECPointtwice()
-
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() -
getCurve
-
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
-
getCompressionYTilde
protected abstract boolean getCompressionYTilde() -
add
-
negate
-
subtract
-
timesPow2
-
twice
-
twicePlus
-
threeTimes
-
multiply
Multiplies thisECPointby the given number.- Parameters:
k- The multiplicator.- Returns:
k * this.
-