Point Class Reference

#include <pk.h>

Collaboration diagram for Point:

Collaboration graph

Detailed Description

Data type used to represent the elements of, and abstract the operations in, various Abelian groups, including elliptic curves.

As the class name indicates, operators are defined as if the underlying group operation is written additively, though obviously if the group is more commonly written multiplicatively, the operators should be interpreted that way. For example, operator*() is decribed below as scalar multiplication, but should be thought of as exponentiation in the multiplicative setting.


Public Member Functions

Constructors and Destructors
 Point ()
 Constructor used to create an empty Point object.
 Point (const Point &a)
 Copy constructor.
 Point (const GParms *p1)
 Constructor used to create an element of the specified Abelian group.
 Point (const Point &a, const str &b)
 Constructor used to create a Point in the same Abelian group as another Point.
virtual ~Point ()
 Destructor.
Object Reuse and Initialization
void clear ()
 Clear this Point object.
int setgen (const num &g)
 Specify a generator for the underlying Abelian group.
int setcurve (const num &a, const num &b)
 Specify the coefficients in the equation of an elliptic curve:
   in char p:  y 2 = x 3 + a x + b
   in char 2:  y 2 + x y = x 3 + a x 2 + b.
void power (const Point &x, const num &y)
 Assign an (unnormalized) multiple of a given Point to this one.
int loadbin (int n, const char *b)
 Load an octet string into this Point.
void add (int n, const char *b)
 Add; a void version of loadbin().
Assignment and Arithmetic Operators
void operator= (int n)
 Assignment operator used to make this Point the identity element in the group.
void operator= (const Point &x)
 Assignment operator used to copy Points.
Point operator- () const
 Get the additive inverse of this Point.
Point operator+ (const Point &y) const
 Add another Point to this one.
Point operator- (const Point &y) const
 Subtract another Point from this one.
Point operator * (const num &x) const
 Multiply this Point by an integer.
Predicate Operators
bool operator== (int n) const
 Predicate used to test whether this Point is the identity element in the group.
bool operator!= (int n) const
 Predicate used to test whether this Point differs from the identity element.
bool operator== (const Point &x) const
 Predicate used to test the equality of this Point with another one.
bool operator!= (const Point &x) const
 Predicate used to test the inequality of this Point with another one.
Predicate Functions
bool isDef () const
 Predicate used to determine whether parameters are defined.
bool isDH () const
 Predicate used to determine whether this point is an element of (a multiplicative subgroup of) the group of nonzero integers modulo a large prime.
bool isEC () const
 Predicate used to determine whether this Point is on an elliptic curve.
bool isChar2 () const
 Predicate used to determine whether this Point is on an elliptic curve in char 2.
bool isValid () const
 Predicate used to test whether this Point lies on the underlying elliptic curve.
bool hasOrder (const num &a) const
 Predicate used to test whether this group element has a specified order.
Inspectors
int bits () const
 Get the number of bits required to represent this Point.
int length () const
 Get the size in bytes of the largest integer that can be mapped into the current Abelian group.
num modulus2 () const
 Get the order of the underlying finite field or order of the group.
Conversions
cdk::str tostr (int n=0) const
 Convert this Point into a str.
template<class T>
to (int opt=0) const
 Convert Point into an object of type T.


Constructor & Destructor Documentation

Point ( const Point a  )  [inline]

Copy constructor.

Parameters:
a the Point to copy into this Point

Point ( const GParms p1  )  [inline, explicit]

Constructor used to create an element of the specified Abelian group.

Parameters:
p1 a pointer to the group parameters (GParms) to use for this point.

Point ( const Point a,
const str b 
) [explicit]

Constructor used to create a Point in the same Abelian group as another Point.

Parameters:
a a Point from which to copy group parameters
b a value indicating which group element this new Point is to represent

virtual ~Point (  )  [inline, virtual]

Destructor.

Remarks:
Modifies: p (x, y, and z are zeroized by their destructors)


Member Function Documentation

void add ( int  n,
const char *  b 
) [inline]

Add; a void version of loadbin().

Parameters:
n length of the octet string in bytes
b pointer to the octet string

int bits (  )  const

Get the number of bits required to represent this Point.

Returns:
the number of bits in the point

void clear ( void   )  [inline]

Clear this Point object.

Remarks:
Modifies: x, y, z are zeroized; p (the parameters) is not cleared.

bool hasOrder ( const num a  )  const

Predicate used to test whether this group element has a specified order.

Parameters:
a suspected order of this group element
Returns:
true, if this element has order a
false, otherwise

bool isChar2 (  )  const [inline]

Predicate used to determine whether this Point is on an elliptic curve in char 2.

Returns:
true, if this Point's parameters are those for an elliptic curve over a finite field of char 2
false, otherwise

bool isDef (  )  const [inline]

Predicate used to determine whether parameters are defined.

Returns:
true, if the parameters are defined
false, otherwise

bool isDH (  )  const [inline]

Predicate used to determine whether this point is an element of (a multiplicative subgroup of) the group of nonzero integers modulo a large prime.

Returns:
true, if this Point's parameters are those for (a multiplicative subgroup of) Zp*
false, otherwise

bool isEC (  )  const [inline]

Predicate used to determine whether this Point is on an elliptic curve.

Returns:
true, if this Point's parameters are those for an elliptic curve
false, otherwise

bool isValid (  )  const

Predicate used to test whether this Point lies on the underlying elliptic curve.

Returns:
true, if this Point is on the underlying curve
false, otherwise

int length (  )  const [inline]

Get the size in bytes of the largest integer that can be mapped into the current Abelian group.

Returns:
the maximum number of *bytes* that can be in a number as represented in the current field/group/curve
Remarks:
This function is useful when you want to know how large a random number to generate for certain cryptographic protocols (e.g., ECDSA signature generation).

int loadbin ( int  n,
const char *  b 
)

Load an octet string into this Point.

Parameters:
n length of the octet string in bytes
b pointer to the octet string
Returns:
the number of bytes used

num modulus2 (  )  const [inline]

Get the order of the underlying finite field or order of the group.

Returns:
the modulus of the underlying finite field or order of the group

Point operator * ( const num x  )  const

Multiply this Point by an integer.

Parameters:
x the multiple
Returns:
the specified multiple of this Point

bool operator!= ( const Point x  )  const [inline]

Predicate used to test the inequality of this Point with another one.

Parameters:
x the Point (i.e., group element) to which this one is to be compared
Returns:
true, if the two group elements disagree
false, if the two Points are equal

bool operator!= ( int  n  )  const [inline]

Predicate used to test whether this Point differs from the identity element.

Parameters:
n = must be 0 or method asserts
Returns:
true, if this Point is not the identify element
false, otherwise

Point operator+ ( const Point y  )  const

Add another Point to this one.

Parameters:
y the Point to be added to this point
Returns:
the sum of this Point and y

Point operator- ( const Point y  )  const

Subtract another Point from this one.

Parameters:
y the Point to subtract from this point
Returns:
the difference of this Point and y

Point operator- (  )  const

Get the additive inverse of this Point.

Returns:
the additive inverse of this Point

void operator= ( const Point x  )  [inline]

Assignment operator used to copy Points.

Parameters:
x the Point to copy into this one

void operator= ( int  n  ) 

Assignment operator used to make this Point the identity element in the group.

Parameters:
n must be 0 (any other value will trigger an exception)

bool operator== ( const Point x  )  const [inline]

Predicate used to test the equality of this Point with another one.

Parameters:
x the Point (i.e., group element) to which this one is to be compared
Returns:
true, if the two group elements are equal
false, if the two group elements disagree

bool operator== ( int  n  )  const

Predicate used to test whether this Point is the identity element in the group.

Parameters:
n must be 0 or method asserts
Returns:
true, if this Point is the identity element in its Abelian group
false, otherwise

void power ( const Point x,
const num y 
)

Assign an (unnormalized) multiple of a given Point to this one.

Parameters:
x the base Point
y the multiple of x to be assigned to this Point

int setcurve ( const num a,
const num b 
)

Specify the coefficients in the equation of an elliptic curve:
   in char p:  y 2 = x 3 + a x + b
   in char 2:  y 2 + x y = x 3 + a x 2 + b.

Parameters:
a the first coefficient
b the second coefficient
Returns:
0

int setgen ( const num g  ) 

Specify a generator for the underlying Abelian group.

Parameters:
g a new generator for the underlying group
Returns:
0

T to ( int  opt = 0  )  const

Convert Point into an object of type T.

Parameters:
opt compression indicator: 0 = compressed, 1 = uncompressed
Returns:
an object of type T representing this Point

cdk::str tostr ( int  n = 0  )  const

Convert this Point into a str.

Parameters:
n a compression indicator: 0 = compressed, 1 = uncompressed
Returns:
a str representation of this Point


The documentation for this class was generated from the following file:
ISC Cryptographic Development Kit - User's Guide
ISC website
Questions? E-mail ISC technical support
Copyright© 2002-2006 Information Security Corp. All rights reserved.