IAIK ECC
version 2.18

iaik.security.ecc.math.ecgroup
Class ECPoint

java.lang.Object
  extended byiaik.security.ecc.math.ecgroup.ECPoint
All Implemented Interfaces:
java.lang.Cloneable

public class ECPoint
extends java.lang.Object
implements java.lang.Cloneable

A point on an elliptic curve. It consists of a reference to the elliptic curve and one to its coordinates. All the point operations are forwarded to the corresponding elliptic curve group (subclass of EllipticCurve).


Field Summary
protected  EllipticCurve curve_
          the elliptic curve (the group this point belongs to)
protected  boolean isInfinity_
          indicates whether this point is infinity
 
Constructor Summary
ECPoint(byte[] b, EllipticCurve curve)
          Creates a new point, performing the Octet-String-to-Point Conversion as specified in X9.62.
 
Method Summary
 void addPoint(ECPoint other)
          Computes this += other.
 java.lang.Object clone()
          Creates a new Point on the same curve with the same coordinates (cloned)
 void doublePoint()
          Doubles this point.
 boolean equals(java.lang.Object other)
          Checks, whether two ECPoints are equal.
 Coordinate getCoordinates()
          Returns the coordinates of the point.
 EllipticCurve getCurve()
          The group (EllipticCurve) this point belongs to.
 int hashCode()
          Returns the hash code of this ECPoint.
 void invert()
          Inverts (negates) this point.
 boolean isInfinity()
          Evaluates if this point is the point at infinity.
 void multiply(java.math.BigInteger val)
          Computes the scalar multiplication: this *= val.
 void multiply2(java.math.BigInteger k, ECPoint q, java.math.BigInteger l)
          Computes the scalar multiplication: this = k*this + l*q.
 void precomputePoints()
          This method is only called, if EllipticCurve.isPrecomputationEnabled() returns true.
 void setCoordinates(Coordinate c)
          Sets the coordinates of the ECPoint.
 void setInfinity()
          Sets the point to infinity.
 iaik.asn1.OCTET_STRING toASN1Object()
          The ASN.1 representation of this point as defined in X9.62.
 java.lang.String toString()
           
 void unsetInfinity()
          Resets the point.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

curve_

protected EllipticCurve curve_
the elliptic curve (the group this point belongs to)


isInfinity_

protected boolean isInfinity_
indicates whether this point is infinity

Constructor Detail

ECPoint

public ECPoint(byte[] b,
               EllipticCurve curve)
        throws ECCException
Creates a new point, performing the Octet-String-to-Point Conversion as specified in X9.62. It is not checked, whether the new point is indeed a point on the curve.

Parameters:
b - the octet string representation
curve - the group, the new point belongs to.
Method Detail

addPoint

public void addPoint(ECPoint other)
Computes this += other. It calls the corresponding method of the EllipticCurve class.

Parameters:
other - the point which is added to this point.
See Also:
EllipticCurve.addPoint(iaik.security.ecc.math.ecgroup.ECPoint, iaik.security.ecc.math.ecgroup.ECPoint)

clone

public java.lang.Object clone()
Creates a new Point on the same curve with the same coordinates (cloned)

Returns:
the cloned object.

doublePoint

public void doublePoint()
Doubles this point. It calls the corresponding method of the EllipticCurve class.

See Also:
EllipticCurve.doublePoint(iaik.security.ecc.math.ecgroup.ECPoint)

equals

public boolean equals(java.lang.Object other)
Checks, whether two ECPoints are equal.

Parameters:
other - the other object.

getCoordinates

public Coordinate getCoordinates()
Returns the coordinates of the point. If this point is the point at infinity, these coordinates are invalid (may be null).

Returns:
the coordinates
See Also:
isInfinity()

getCurve

public EllipticCurve getCurve()
The group (EllipticCurve) this point belongs to.

Returns:
the elliptic curve group.

hashCode

public int hashCode()
Returns the hash code of this ECPoint.

Returns:
the hash code of this ECPoint.

invert

public void invert()
Inverts (negates) this point. It calls the corresponding method of the EllipticCurve class.

See Also:
EllipticCurve.invert(iaik.security.ecc.math.ecgroup.ECPoint)

isInfinity

public boolean isInfinity()
Evaluates if this point is the point at infinity.

Returns:
true if the point is at infinity

multiply

public void multiply(java.math.BigInteger val)
Computes the scalar multiplication: this *= val. It calls the corresponding method of the EllipticCurve class.

Parameters:
val - the scalar factor.
See Also:
EllipticCurve.multiply(iaik.security.ecc.math.ecgroup.ECPoint, java.math.BigInteger)

multiply2

public void multiply2(java.math.BigInteger k,
                      ECPoint q,
                      java.math.BigInteger l)
Computes the scalar multiplication: this = k*this + l*q. If curve_ is an instance of FastPrimeCurve, arithmetic speed-ups are supported.

Parameters:
k - the first scalar factor.
q - the second ECPoint.
l - the second scalar factor.

precomputePoints

public void precomputePoints()
This method is only called, if EllipticCurve.isPrecomputationEnabled() returns true. This is only the case, if curve_ is an instance of FastPrimeCurve.


setInfinity

public void setInfinity()
Sets the point to infinity.


toASN1Object

public iaik.asn1.OCTET_STRING toASN1Object()
The ASN.1 representation of this point as defined in X9.62.

Returns:
the octet string ASN.1 object.

toString

public java.lang.String toString()
Returns:
a human readable string, containing the coordinates of the point, or "infinity".

unsetInfinity

public void unsetInfinity()
Resets the point.


setCoordinates

public void setCoordinates(Coordinate c)
Sets the coordinates of the ECPoint. Make sure the coordinate type matches the used curve type. You have to call unset infinity if the original point was the point at infinity

Parameters:
c - the new coordinates.

IAIK ECC
version 2.18

IAIK-ECC 2.18, (c) 2002 IAIK, (c) 2003 SIC