EC2N Class Reference

Elliptic Curve over GF(2^n) More...

`#include <ec2n.h>`

Inheritance diagram for EC2N:

## Public Types

typedef GF2NP | Field
typedef Field::Element | FieldElement
typedef EC2NPoint | Point
Public Types inherited from AbstractGroup< EC2NPoint >
typedef EC2NPoint | Element

## Public Member Functions

| EC2N ()
| Construct an EC2N.
| EC2N (const Field &field, const Field::Element &a, const Field::Element &b)
| Construct an EC2N.
| EC2N (BufferedTransformation &bt)
| Construct an EC2N from BER encoded parameters.
void | DEREncode (BufferedTransformation &bt) const
| Encode the fields fieldID and curve of the sequence ECParameters.
bool | Equal (const Point &P, const Point &Q) const
| Compare two elements for equality.
const Point & | Identity () const
| Provides the Identity element.
const Point & | Inverse (const Point &P) const
| Inverts the element in the group.
bool | InversionIsFast () const
| Determine if inversion is fast.
const Point & | Add (const Point &P, const Point &Q) const
| Adds elements in the group.
const Point & | Double (const Point &P) const
| Doubles an element in the group.
Point | Multiply (const Integer &k, const Point &P) const
Point | CascadeMultiply (const Integer &k1, const Point &P, const Integer &k2, const Point &Q) const
bool | ValidateParameters (RandomNumberGenerator &rng, unsigned int level=3) const
bool | VerifyPoint (const Point &P) const
| Verifies points on elliptic curve.
unsigned int | EncodedPointSize (bool compressed=false) const
| Determines encoded point size.
bool | DecodePoint (Point &P, BufferedTransformation &bt, size_t len) const
| Decodes an elliptic curve point.
bool | DecodePoint (Point &P, const byte *encodedPoint, size_t len) const
| Decodes an elliptic curve point.
void | EncodePoint (byte *encodedPoint, const Point &P, bool compressed) const
| Encodes an elliptic curve point.
void | EncodePoint (BufferedTransformation &bt, const Point &P, bool compressed) const
| Encodes an elliptic curve point.
Point | BERDecodePoint (BufferedTransformation &bt) const
| BER Decodes an elliptic curve point.
void | DEREncodePoint (BufferedTransformation &bt, const Point &P, bool compressed) const
| DER Encodes an elliptic curve point.
Integer | FieldSize () const
const Field & | GetField () const
const FieldElement & | GetA () const
const FieldElement & | GetB () const
bool | operator== (const EC2N &rhs) const
Public Member Functions inherited from AbstractGroup< EC2NPoint >
virtual const Element & | Subtract (const Element &a, const Element &b) const
| Subtracts elements in the group.
virtual Element & | Accumulate (Element &a, const Element &b) const
| TODO.
virtual Element & | Reduce (Element &a, const Element &b) const
| Reduces an element in the congruence class.
virtual Element | ScalarMultiply (const Element &a, const Integer &e) const
| Performs a scalar multiplication.
virtual Element | CascadeScalarMultiply (const Element &x, const Integer &e1, const Element &y, const Integer &e2) const
| TODO.
virtual void | SimultaneousMultiply (Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const
| Multiplies a base to multiple exponents in a group.

## Detailed Description

Elliptic Curve over GF(2^n)

Definition at line 26 of file ec2n.h.

## Member Typedef Documentation

## Field

typedef GF2NP EC2N::Field

Definition at line 29 of file ec2n.h.

## FieldElement

typedef Field::Element EC2N::FieldElement

Definition at line 30 of file ec2n.h.

## Point

typedef EC2NPoint EC2N::Point

Definition at line 31 of file ec2n.h.

## Constructor & Destructor Documentation

## ~EC2N()

virtual EC2N::~EC2N | ( |  | ) |

inline virtual

Definition at line 33 of file ec2n.h.

## EC2N() [1/3]

EC2N::EC2N | ( |  | ) |

inline

Construct an EC2N.

Definition at line 36 of file ec2n.h.

## EC2N() [2/3]

EC2N::EC2N | ( | const Field & | field,
|  | const Field::Element & | a,
|  | const Field::Element & | b
| ) |  |

inline

Construct an EC2N.

Parameters

  field | Field, GF2NP derived class
  a | Field::Element
  b | Field::Element

Definition at line 42 of file ec2n.h.

## EC2N() [3/3]

EC2N::EC2N | ( | BufferedTransformation & | bt | ) |

Construct an EC2N from BER encoded parameters.

Parameters

  bt | BufferedTransformation derived object

This constructor will decode and extract the fields fieldID and curve of the sequence ECParameters

## Member Function Documentation

## DEREncode()

void EC2N::DEREncode | ( | BufferedTransformation & | bt | ) | const

Encode the fields fieldID and curve of the sequence ECParameters.

Parameters

  bt | BufferedTransformation derived object

## Equal()

bool EC2N::Equal | ( | const Point & | a,
|  | const Point & | b
| ) |  | const

virtual

Compare two elements for equality.

Parameters

  a | first element
  b | second element

Returns
  true if the elements are equal, false otherwise

Equal() tests the elements for equality using `a==b`

Implements AbstractGroup< EC2NPoint >.

## Identity()

const Point & EC2N::Identity | ( |  | ) | const

virtual

Provides the Identity element.

Returns
  the Identity element

Implements AbstractGroup< EC2NPoint >.

## Inverse()

const Point & EC2N::Inverse | ( | const Point & | a | ) | const

virtual

Inverts the element in the group.

Parameters

  a | first element

Returns
  the inverse of the element

Implements AbstractGroup< EC2NPoint >.

## InversionIsFast()

bool EC2N::InversionIsFast | ( |  | ) | const

inline virtual

Determine if inversion is fast.

Returns
  true if inversion is fast, false otherwise

Reimplemented from AbstractGroup< EC2NPoint >.

Definition at line 57 of file ec2n.h.

## Add()

const Point & EC2N::Add | ( | const Point & | a,
|  | const Point & | b
| ) |  | const

virtual

Adds elements in the group.

Parameters

  a | first element
  b | second element

Returns
  the sum of `a` and `b`

Implements AbstractGroup< EC2NPoint >.

## Double()

const Point & EC2N::Double | ( | const Point & | a | ) | const

virtual

Doubles an element in the group.

Parameters

  a | the element

Returns
  the element doubled

Reimplemented from AbstractGroup< EC2NPoint >.

## Multiply()

Point EC2N::Multiply | ( | const Integer & | k,
|  | const Point & | P
| ) |  | const

inline

Definition at line 61 of file ec2n.h.

## CascadeMultiply()

Point EC2N::CascadeMultiply | ( | const Integer & | k1,
|  | const Point & | P,
|  | const Integer & | k2,
|  | const Point & | Q
| ) |  | const

inline

Definition at line 63 of file ec2n.h.

## VerifyPoint()

bool EC2N::VerifyPoint | ( | const Point & | P | ) | const

virtual

Verifies points on elliptic curve.

Parameters

  P | point to verify

Returns
  true if the point is valid, false otherwise

Implements EncodedPoint< EC2NPoint >.

## EncodedPointSize()

unsigned int EC2N::EncodedPointSize | ( | bool | compressed = `false` | ) | const

inline virtual

Determines encoded point size.

Parameters

  compressed | flag indicating if the point is compressed

Returns
  the minimum number of bytes required to encode the point

Implements EncodedPoint< EC2NPoint >.

Definition at line 69 of file ec2n.h.

## DecodePoint() [1/2]

bool EC2N::DecodePoint | ( | Point & | P,
|  | BufferedTransformation & | bt,
|  | size_t | len
| ) |  | const

virtual

Decodes an elliptic curve point.

Parameters

  P | point which is decoded
  bt | source BufferedTransformation
  len | number of bytes to read from the BufferedTransformation

Returns
  true if a point was decoded, false otherwise

Implements EncodedPoint< EC2NPoint >.

## DecodePoint() [2/2]

bool EC2N::DecodePoint | ( | Point & | P,
|  | const byte * | encodedPoint,
|  | size_t | len
| ) |  | const

virtual

Decodes an elliptic curve point.

Parameters

  P | point which is decoded
  encodedPoint | byte array with the encoded point
  len | the size of the array

Returns
  true if a point was decoded, false otherwise

Implements EncodedPoint< EC2NPoint >.

## EncodePoint() [1/2]

void EC2N::EncodePoint | ( | byte * | encodedPoint,
|  | const Point & | P,
|  | bool | compressed
| ) |  | const

virtual

Encodes an elliptic curve point.

Parameters

  P | point which is decoded
  encodedPoint | byte array for the encoded point
  compressed | flag indicating if the point is compressed

`encodedPoint` must be at least EncodedPointSize() in length

Implements EncodedPoint< EC2NPoint >.

## EncodePoint() [2/2]

void EC2N::EncodePoint | ( | BufferedTransformation & | bt,
|  | const Point & | P,
|  | bool | compressed
| ) |  | const

virtual

Encodes an elliptic curve point.

Parameters

  bt | target BufferedTransformation
  P | point which is encoded
  compressed | flag indicating if the point is compressed

Implements EncodedPoint< EC2NPoint >.

## BERDecodePoint()

Point EC2N::BERDecodePoint | ( | BufferedTransformation & | bt | ) | const

virtual

BER Decodes an elliptic curve point.

Parameters

  bt | source BufferedTransformation

Returns
  the decoded elliptic curve point

Implements EncodedPoint< EC2NPoint >.

## DEREncodePoint()

void EC2N::DEREncodePoint | ( | BufferedTransformation & | bt,
|  | const Point & | P,
|  | bool | compressed
| ) |  | const

virtual

DER Encodes an elliptic curve point.

Parameters

  bt | target BufferedTransformation
  P | point which is encoded
  compressed | flag indicating if the point is compressed

Implements EncodedPoint< EC2NPoint >.

## FieldSize()

Integer EC2N::FieldSize | ( |  | ) | const

inline

Definition at line 80 of file ec2n.h.

## GetField()

const Field & EC2N::GetField | ( |  | ) | const

inline

Definition at line 81 of file ec2n.h.

## GetA()

const FieldElement & EC2N::GetA | ( |  | ) | const

inline

Definition at line 82 of file ec2n.h.

## GetB()

const FieldElement & EC2N::GetB | ( |  | ) | const

inline

Definition at line 83 of file ec2n.h.

## operator==()

bool EC2N::operator== | ( | const EC2N & | rhs | ) | const

inline

Definition at line 85 of file ec2n.h.

The documentation for this class was generated from the following file:

- ec2n.h