Package org.bouncycastle.math.ec
Class ECCurve
- java.lang.Object
 - 
- org.bouncycastle.math.ec.ECCurve
 
 
- 
- Direct Known Subclasses:
 ECCurve.AbstractF2m,ECCurve.AbstractFp
public abstract class ECCurve extends java.lang.Objectbase class for an elliptic curve 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classECCurve.AbstractF2mstatic classECCurve.AbstractFpclassECCurve.Configstatic classECCurve.F2mElliptic curves over F2m.static classECCurve.FpElliptic curve over Fp 
- 
Field Summary
Fields Modifier and Type Field Description protected ECFieldElementaprotected ECFieldElementbprotected java.math.BigIntegercofactorprotected intcoordstatic intCOORD_AFFINEstatic intCOORD_HOMOGENEOUSstatic intCOORD_JACOBIANstatic intCOORD_JACOBIAN_CHUDNOVSKYstatic intCOORD_JACOBIAN_MODIFIEDstatic intCOORD_LAMBDA_AFFINEstatic intCOORD_LAMBDA_PROJECTIVEstatic intCOORD_SKEWEDprotected ECEndomorphismendomorphismprotected FiniteFieldfieldprotected ECMultipliermultiplierprotected java.math.BigIntegerorder 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedECCurve(FiniteField field) 
- 
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckPoint(ECPoint point)protected voidcheckPoints(ECPoint[] points)protected voidcheckPoints(ECPoint[] points, int off, int len)protected abstract ECCurvecloneCurve()ECCurve.Configconfigure()ECLookupTablecreateCacheSafeLookupTable(ECPoint[] points, int off, int len)Create a cache-safe lookup table for the specified sequence of points.protected ECMultipliercreateDefaultMultiplier()ECPointcreatePoint(java.math.BigInteger x, java.math.BigInteger y)protected abstract ECPointcreateRawPoint(ECFieldElement x, ECFieldElement y)protected abstract ECPointcreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs)ECPointdecodePoint(byte[] encoded)Decode a point on this curve from its ASN.1 encoding.protected abstract ECPointdecompressPoint(int yTilde, java.math.BigInteger X1)booleanequals(java.lang.Object obj)booleanequals(ECCurve other)abstract ECFieldElementfromBigInteger(java.math.BigInteger x)ECFieldElementgetA()static int[]getAllCoordinateSystems()ECFieldElementgetB()java.math.BigIntegergetCofactor()intgetCoordinateSystem()ECEndomorphismgetEndomorphism()FiniteFieldgetField()abstract intgetFieldSize()abstract ECPointgetInfinity()ECMultipliergetMultiplier()Sets the defaultECMultiplier, unless already set.java.math.BigIntegergetOrder()PreCompInfogetPreCompInfo(ECPoint point, java.lang.String name)inthashCode()ECPointimportPoint(ECPoint p)abstract booleanisValidFieldElement(java.math.BigInteger x)voidnormalizeAll(ECPoint[] points)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.voidnormalizeAll(ECPoint[] points, int off, int len, ECFieldElement iso)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.PreCompInfoprecompute(ECPoint point, java.lang.String name, PreCompCallback callback)Compute aPreCompInfofor a point on this curve, under a given name.abstract ECFieldElementrandomFieldElement(java.security.SecureRandom r)abstract ECFieldElementrandomFieldElementMult(java.security.SecureRandom r)booleansupportsCoordinateSystem(int coord)ECPointvalidatePoint(java.math.BigInteger x, java.math.BigInteger y) 
 - 
 
- 
- 
Field Detail
- 
COORD_AFFINE
public static final int COORD_AFFINE
- See Also:
 - Constant Field Values
 
 
- 
COORD_HOMOGENEOUS
public static final int COORD_HOMOGENEOUS
- See Also:
 - Constant Field Values
 
 
- 
COORD_JACOBIAN
public static final int COORD_JACOBIAN
- See Also:
 - Constant Field Values
 
 
- 
COORD_JACOBIAN_CHUDNOVSKY
public static final int COORD_JACOBIAN_CHUDNOVSKY
- See Also:
 - Constant Field Values
 
 
- 
COORD_JACOBIAN_MODIFIED
public static final int COORD_JACOBIAN_MODIFIED
- See Also:
 - Constant Field Values
 
 
- 
COORD_LAMBDA_AFFINE
public static final int COORD_LAMBDA_AFFINE
- See Also:
 - Constant Field Values
 
 
- 
COORD_LAMBDA_PROJECTIVE
public static final int COORD_LAMBDA_PROJECTIVE
- See Also:
 - Constant Field Values
 
 
- 
COORD_SKEWED
public static final int COORD_SKEWED
- See Also:
 - Constant Field Values
 
 
- 
field
protected FiniteField field
 
- 
a
protected ECFieldElement a
 
- 
b
protected ECFieldElement b
 
- 
order
protected java.math.BigInteger order
 
- 
cofactor
protected java.math.BigInteger cofactor
 
- 
coord
protected int coord
 
- 
endomorphism
protected ECEndomorphism endomorphism
 
- 
multiplier
protected ECMultiplier multiplier
 
 - 
 
- 
Constructor Detail
- 
ECCurve
protected ECCurve(FiniteField field)
 
 - 
 
- 
Method Detail
- 
getAllCoordinateSystems
public static int[] getAllCoordinateSystems()
 
- 
getFieldSize
public abstract int getFieldSize()
 
- 
fromBigInteger
public abstract ECFieldElement fromBigInteger(java.math.BigInteger x)
 
- 
isValidFieldElement
public abstract boolean isValidFieldElement(java.math.BigInteger x)
 
- 
randomFieldElement
public abstract ECFieldElement randomFieldElement(java.security.SecureRandom r)
 
- 
randomFieldElementMult
public abstract ECFieldElement randomFieldElementMult(java.security.SecureRandom r)
 
- 
configure
public ECCurve.Config configure()
 
- 
validatePoint
public ECPoint validatePoint(java.math.BigInteger x, java.math.BigInteger y)
 
- 
createPoint
public ECPoint createPoint(java.math.BigInteger x, java.math.BigInteger y)
 
- 
cloneCurve
protected abstract ECCurve cloneCurve()
 
- 
createRawPoint
protected abstract ECPoint createRawPoint(ECFieldElement x, ECFieldElement y)
 
- 
createRawPoint
protected abstract ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs)
 
- 
createDefaultMultiplier
protected ECMultiplier createDefaultMultiplier()
 
- 
supportsCoordinateSystem
public boolean supportsCoordinateSystem(int coord)
 
- 
getPreCompInfo
public PreCompInfo getPreCompInfo(ECPoint point, java.lang.String name)
 
- 
precompute
public PreCompInfo precompute(ECPoint point, java.lang.String name, PreCompCallback callback)
Compute aPreCompInfofor a point on this curve, under a given name. Used byECMultipliers to save the precomputation for thisECPointfor use by subsequent multiplication.- Parameters:
 point- TheECPointto store precomputations for.name- AStringused to index precomputations of different types.callback- Called to calculate thePreCompInfo.
 
- 
normalizeAll
public void normalizeAll(ECPoint[] points)
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. Where more than one point is to be normalized, this method will generally be more efficient than normalizing each point separately.- Parameters:
 points- An array of points that will be updated in place with their normalized versions, where necessary
 
- 
normalizeAll
public void normalizeAll(ECPoint[] points, int off, int len, ECFieldElement iso)
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. Where more than one point is to be normalized, this method will generally be more efficient than normalizing each point separately. An (optional) z-scaling factor can be applied; effectively each z coordinate is scaled by this value prior to normalization (but only one actual multiplication is needed).- Parameters:
 points- An array of points that will be updated in place with their normalized versions, where necessaryoff- The start of the range of points to normalizelen- The length of the range of points to normalizeiso- The (optional) z-scaling factor - can be null
 
- 
getInfinity
public abstract ECPoint getInfinity()
 
- 
getField
public FiniteField getField()
 
- 
getA
public ECFieldElement getA()
 
- 
getB
public ECFieldElement getB()
 
- 
getOrder
public java.math.BigInteger getOrder()
 
- 
getCofactor
public java.math.BigInteger getCofactor()
 
- 
getCoordinateSystem
public int getCoordinateSystem()
 
- 
decompressPoint
protected abstract ECPoint decompressPoint(int yTilde, java.math.BigInteger X1)
 
- 
getEndomorphism
public ECEndomorphism getEndomorphism()
 
- 
getMultiplier
public ECMultiplier getMultiplier()
Sets the defaultECMultiplier, unless already set. We avoid synchronizing for performance reasons, so there is no uniqueness guarantee. 
- 
decodePoint
public ECPoint decodePoint(byte[] encoded)
Decode a point on this curve from its ASN.1 encoding. The different encodings are taken account of, including point compression forFp(X9.62 s 4.2.1 pg 17).- Returns:
 - The decoded point.
 
 
- 
createCacheSafeLookupTable
public ECLookupTable createCacheSafeLookupTable(ECPoint[] points, int off, int len)
Create a cache-safe lookup table for the specified sequence of points. All the points MUST belong to thisECCurveinstance, and MUST already be normalized. 
- 
checkPoint
protected void checkPoint(ECPoint point)
 
- 
checkPoints
protected void checkPoints(ECPoint[] points)
 
- 
checkPoints
protected void checkPoints(ECPoint[] points, int off, int len)
 
- 
equals
public boolean equals(ECCurve other)
 
- 
equals
public boolean equals(java.lang.Object obj)
- Overrides:
 equalsin classjava.lang.Object
 
- 
hashCode
public int hashCode()
- Overrides:
 hashCodein classjava.lang.Object
 
 - 
 
 -