Class ECCurve

java.lang.Object
org.bouncycastle.math.ec.ECCurve
Direct Known Subclasses:
ECCurve.AbstractF2m, ECCurve.AbstractFp

public abstract class ECCurve extends Object
base class for an elliptic curve
  • Field Details

  • Constructor Details

  • Method Details

    • getAllCoordinateSystems

      public static int[] getAllCoordinateSystems()
    • getFieldSize

      public abstract int getFieldSize()
    • fromBigInteger

      public abstract ECFieldElement fromBigInteger(BigInteger x)
    • isValidFieldElement

      public abstract boolean isValidFieldElement(BigInteger x)
    • randomFieldElement

      public abstract ECFieldElement randomFieldElement(SecureRandom r)
    • randomFieldElementMult

      public abstract ECFieldElement randomFieldElementMult(SecureRandom r)
    • configure

      public ECCurve.Config configure()
    • validatePoint

      public ECPoint validatePoint(BigInteger x, BigInteger y)
    • createPoint

      public ECPoint createPoint(BigInteger x, 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, String name)
    • precompute

      public PreCompInfo precompute(ECPoint point, String name, PreCompCallback callback)
      Compute a PreCompInfo for a point on this curve, under a given name. Used by ECMultipliers to save the precomputation for this ECPoint for use by subsequent multiplication.
      Parameters:
      point - The ECPoint to store precomputations for.
      name - A String used to index precomputations of different types.
      callback - Called to calculate the PreCompInfo.
    • importPoint

      public ECPoint importPoint(ECPoint p)
    • 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 necessary
      off - The start of the range of points to normalize
      len - The length of the range of points to normalize
      iso - 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 BigInteger getOrder()
    • getCofactor

      public BigInteger getCofactor()
    • getCoordinateSystem

      public int getCoordinateSystem()
    • decompressPoint

      protected abstract ECPoint decompressPoint(int yTilde, BigInteger X1)
    • getEndomorphism

      public ECEndomorphism getEndomorphism()
    • getMultiplier

      public ECMultiplier getMultiplier()
      Sets the default ECMultiplier, 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 for Fp (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 this ECCurve instance, 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(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object