de.flexiprovider.common.math.ellipticcurves
Class Point

java.lang.Object
  |
  +--de.flexiprovider.common.math.ellipticcurves.Point
Direct Known Subclasses:
PointGF2n, PointGFP

public abstract class Point
extends java.lang.Object

This abstract class implements points and their arithmetic on elliptic curves over finite prime fields as well as over finite fields with characteristic 2. There is a variety of methods for point multiplication. See the references for complexity and details.

MvV97
A. J. Menezes, P. C. van Oorschot, and S. A. Vanstone. Handbook of Applied Cryptography. CRC Press, Boca Raton, Florida, 1997.
LL94
C. H. Lim and P. J Lee. More flexible exponentiation with precompu-tation. In Yvo G. Desmedt, editor, Advances in Cryptology   CRYP-TO  94, volume 839 of Lecture Notes in Computer Science, pages 108 113. Springer-Verlag, August 1994.
YLL94
S.-M. Yen, C.-S. Laih, and A. Lenstra. Multi-exponentiation. In IEE Proceedings - Computers and Digital Techniques, volume 141, pages 325 326, 1994.
MOC97
Atsuko Miyaji, Takatoshi Ono, Henri Cohen. Efficient elliptic curve exponentiation.
Moe01
Bodo Moeller. Algorithms for multi-exponentiation. In Serge Vau-denay and Amr M. Youssef, editors, Selected Areas in Cryptography - SAC 2001, pages 165 180. Springer-Verlag, 2001.
Moe04
Bodo Moeller. Fractional Windows Revisited:Improved Signed-Digit Representations for Efficient Exponentiation.
OSST04
Katsuyuki Okeya, Katja Schmidt-Samoa, Christian Spahn, Tsuyoshi Takagi. Signed Binary Representations Revisited.
DOT07
Erik Dahmen, Katsuyuki Okeya, Tsuyoshi Takagi. A new upper bound for the minimal density of joint representations in elliptic curve cryptosystems.
PRO03
John Proos. Joint Sparse Forms and Generating Zero Columns when Combing.

Author:
Birgit Henhapl
See Also:
EllipticCurve, PointGFP, PointGF2n

Field Summary
static int ENCODING_TYPE_COMPRESSED
          Encoding type 'compressed'
static int ENCODING_TYPE_HYBRID
          Encoding type 'hybrid'
static int ENCODING_TYPE_UNCOMPRESSED
          Encoding type 'uncompressed'
protected  EllipticCurve mE
          The elliptic curve this point is on.
protected  FlexiBigInt mP
          Characteristic of underlying field.
 
Constructor Summary
Point()
           
 
Method Summary
abstract  Point add(Point other)
          Adds to this point the point other.
abstract  Point addAffine(Point other)
          Adds in affine coordinates to this point the point other.
abstract  void addToThis(Point other)
          Adds to this point the point other.
abstract  java.lang.Object clone()
           
 byte[] EC2OSP(int type)
          Encode this point into a byte array (octet string) using the specified encoding format (one of ENCODING_TYPE_UNCOMPRESSED, ENCODING_TYPE_COMPRESSED, and ENCODING_TYPE_HYBRID).
(package private) abstract  byte[] encodeCompressed()
          Returns this point in affin, compressed form as a byte array.
(package private) abstract  byte[] encodeHybrid()
          Returns this point in affin, hybrid form as a byte array.
(package private) abstract  byte[] encodeUncompressed()
          Returns this point in affin, decompressed form as a byte array.
abstract  boolean equals(java.lang.Object other)
          Compare this point with another object.
abstract  Point getAffin()
          Returns this point with affin coordinates.
 EllipticCurve getE()
           
abstract  GFElement getX()
           
abstract  GFElement getXAffin()
           
abstract  GFElement getY()
           
abstract  GFElement getYAffin()
           
abstract  GFElement getZ()
           
abstract  int hashCode()
           
 boolean isNegativeOf(Point other)
          Tests whether this point is the negative of other.
abstract  boolean isZero()
          Tests, whether this point is at infinity.
abstract  Point multiplyBy2()
          Doubles this point.
abstract  Point multiplyBy2Affine()
          Doubles this point in affine coordinates.
abstract  void multiplyThisBy2()
          Doubles this point.
abstract  Point negate()
           
abstract  void negateThis()
          Additively invert this point.
abstract  boolean onCurve()
          Test whether this point is on curve E.
static Point OS2ECP(byte[] encoded, CurveParams params)
          Decode the encoded point given as byte array using the given EC domain parameters.
abstract  Point subtract(Point other)
          Subtracts the point other from this point.
abstract  void subtractFromThis(Point other)
          Subtracts the point other from this point.
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mE

protected EllipticCurve mE
The elliptic curve this point is on.
See Also:
EllipticCurve

mP

protected FlexiBigInt mP
Characteristic of underlying field.

ENCODING_TYPE_UNCOMPRESSED

public static final int ENCODING_TYPE_UNCOMPRESSED
Encoding type 'uncompressed'

ENCODING_TYPE_COMPRESSED

public static final int ENCODING_TYPE_COMPRESSED
Encoding type 'compressed'

ENCODING_TYPE_HYBRID

public static final int ENCODING_TYPE_HYBRID
Encoding type 'hybrid'
Constructor Detail

Point

public Point()
Method Detail

clone

public abstract java.lang.Object clone()
Overrides:
clone in class java.lang.Object
Returns:
a copy of this Point

equals

public abstract boolean equals(java.lang.Object other)
Compare this point with another object.
Overrides:
equals in class java.lang.Object
Parameters:
other - the other object
Returns:
the result of the comparison

hashCode

public abstract int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of this point

getE

public final EllipticCurve getE()
Returns:
the underlying elliptic curve

getX

public abstract GFElement getX()
Returns:
the x-coordinate of this point

getY

public abstract GFElement getY()
Returns:
the y-coordinate of this point

getZ

public abstract GFElement getZ()
Returns:
the z-coordinate of this point

getXAffin

public abstract GFElement getXAffin()
Returns:
the x-coordinate of this point in affine representation

getYAffin

public abstract GFElement getYAffin()
Returns:
the y-coordinate of this point in affine representation

getAffin

public abstract Point getAffin()
Returns this point with affin coordinates.
Returns:
this

onCurve

public abstract boolean onCurve()
Test whether this point is on curve E.
Returns:
true if this == O or if (mX, mY) is on mE
false if (mX, mY) is not on mE

isZero

public abstract boolean isZero()
Tests, whether this point is at infinity.
Returns:
true if this == O
false if this != O

isNegativeOf

public final boolean isNegativeOf(Point other)
Tests whether this point is the negative of other.
Parameters:
other - point to compare this point with
Returns:
true if this == -other, false otherwise.

add

public abstract Point add(Point other)
                   throws DifferentCurvesException
Adds to this point the point other.
Parameters:
other - point to add to this point
Returns:
this + other
Throws:
DifferentCurvesException - when other is defined over another curve

addToThis

public abstract void addToThis(Point other)
                        throws DifferentCurvesException
Adds to this point the point other.
Parameters:
other - point to add to this point
Throws:
DifferentCurvesException - when other is defined over another curve

addAffine

public abstract Point addAffine(Point other)
                         throws DifferentCurvesException
Adds in affine coordinates to this point the point other.
Parameters:
other - point to add to this point
Returns:
this + other in affine coordinates
Throws:
DifferentCurvesException - when other is defined over another curve

subtract

public abstract Point subtract(Point other)
                        throws DifferentCurvesException
Subtracts the point other from this point.
Parameters:
other - point to subtract from this point
Returns:
this - other
Throws:
DifferentCurvesException - if other is defined over a different curve

subtractFromThis

public abstract void subtractFromThis(Point other)
                               throws DifferentCurvesException
Subtracts the point other from this point.
Parameters:
other - point to subtract from this point
Throws:
DifferentCurvesException - if other is defined over a different curve

multiplyBy2

public abstract Point multiplyBy2()
Doubles this point.
Returns:
2*this

multiplyThisBy2

public abstract void multiplyThisBy2()
Doubles this point.

multiplyBy2Affine

public abstract Point multiplyBy2Affine()
Doubles this point in affine coordinates.
Returns:
2*this in affine coordinates

negate

public abstract Point negate()
Returns:
the inverse of this point. returns -this

negateThis

public abstract void negateThis()
Additively invert this point.

EC2OSP

public final byte[] EC2OSP(int type)
Encode this point into a byte array (octet string) using the specified encoding format (one of ENCODING_TYPE_UNCOMPRESSED, ENCODING_TYPE_COMPRESSED, and ENCODING_TYPE_HYBRID).
Parameters:
type - the encoding format
Returns:
the encoded point, or null if the encoding format is unknown.

OS2ECP

public static Point OS2ECP(byte[] encoded,
                           CurveParams params)
                    throws InvalidPointException,
                           InvalidFormatException,
                           InvalidParameterSpecException
Decode the encoded point given as byte array using the given EC domain parameters.
Parameters:
encoded - the encoded point
params - the EC domain parameters
Returns:
the decoded point
Throws:
InvalidPointException - if the point is encoded in hybrid format and the given and the decoded y-coordinates don't match.
InvalidFormatException - if the encoded point is given in an invalid encoding format.
InvalidParameterSpecException - if the parameters are defined neither over GF(2^n) nor over GF(p).

encodeUncompressed

abstract byte[] encodeUncompressed()
Returns this point in affin, decompressed form as a byte array. The first byte keeps the value 4, to indicate, that this point is stored in an uncompressed format. The rest of the returned array is split in two halves, the first holds the x-coordinate mX and the second they-coordinate mY.
Returns:
this as byte array

encodeCompressed

abstract byte[] encodeCompressed()
Returns this point in affin, compressed form as a byte array. The first byte keeps the value 2 or 3, to indicate, that this point is stored in a compressed format. The rest of the returned array is the x-coordinate mX.
Returns:
this as byte array

encodeHybrid

abstract byte[] encodeHybrid()
Returns this point in affin, hybrid form as a byte array. The first byte keeps the value 6 or 7, to indicate, that this point is stored in a hybrid format. The rest of the returned array is split in two halves, the first holds the x-coordinate mX and the second they-coordinate mY.
Returns:
this as byte array