Libraries
Elliptic Source Code
 previous   up   next 

Types
ecPoint
Type to describe a point at an elliptic curve.
ellipticCurve
Type to describe the elliptic curve y**2 = x**3 + a*x + b (mod p).
jacobianPoint
Alternate type to describe a point at an elliptic curve.
eccKeyPair
Type to describe a pair of ECC keys (private key and public key).
ecdsaSignatureType
Structure to hold an ECDSA signature.

ecPoint

const type: ecPoint

Type to describe a point at an elliptic curve. A point is either the neutral element or it is defined by x and y.


ellipticCurve

const type: ellipticCurve

Type to describe the elliptic curve y**2 = x**3 + a*x + b (mod p). The value p defines the finite field F. The values a and b specify the elliptic curve.


jacobianPoint

const type: jacobianPoint

Alternate type to describe a point at an elliptic curve. The curve points are on the elliptic curve y**2 = x**3 + a*x + b (mod p). This coordinates eliminate the need for expensive inversions mod p.


eccKeyPair

const type: eccKeyPair

Type to describe a pair of ECC keys (private key and public key).


ecdsaSignatureType

const type: ecdsaSignatureType

Structure to hold an ECDSA signature. ECDSA is the Elliptic Curve Digital Signature Algorithm.


Constant Summary
ecPoint
neutralEcPoint
The neutral point of an elliptic curve.
ellipticCurve
secp192k1
The elliptical curve secp192k1.
ellipticCurve
secp192r1
The elliptical curve secp192r1.
ellipticCurve
secp224k1
The elliptical curve secp224k1.
ellipticCurve
secp224r1
The elliptical curve secp224r1.
ellipticCurve
secp256k1
The elliptical curve secp256k1.
ellipticCurve
secp256r1
The elliptical curve secp256r1.
ellipticCurve
secp384r1
The elliptical curve secp384r1.
ellipticCurve
secp521r1
The elliptical curve secp521r1.

Operator Summary
boolean
(in ecPoint: point1) = (in ecPoint: point2)
Check if two elliptic curve points are equal.
boolean
(in ecPoint: point1) <> (in ecPoint: point2)
Check if two elliptic curve points are not equal.

Function Summary
ecPoint
ecPoint (in bigInteger: x, in bigInteger: y)
Create an elliptic curve point from the given coordinates x and y.
ellipticCurve
ellipticCurve (in integer: bits, in string: name, in bigInteger: p, in bigInteger: a, in bigInteger: b, in ecPoint: g, in bigInteger: n)
Create an elliptic curve from the given parameters.
integer
getSizeInBytes (in ellipticCurve: curve)
Get the size of an elliptic curve in bytes.
boolean
element (in ecPoint: point, in ellipticCurve: curve)
Test, whether 'point' is on the given elliptic curve.
ecPoint
double (in ellipticCurve: curve, in ecPoint: p)
Double the point p over given curve.
ecPoint
add (in ellipticCurve: curve, in ecPoint: p1, in ecPoint: p2)
Add the points p1 and p2 over given curve.
ecPoint
mult (in ellipticCurve: curve, in var ecPoint: p1, in var bigInteger: c)
Multiply point p1 by scalar c over given curve.
jacobianPoint
toJacobian (in ecPoint: p)
Transform point p given as (x, y) to jacobian coordinates.
ecPoint
fromJacobian (in jacobianPoint: jp, in bigInteger: n)
Transform a point from jacobian coordinates to (x, y) mod n.
jacobianPoint
double (in ellipticCurve: curve, in jacobianPoint: jp)
Double the point jp in jacobian coordinates over given curve.
jacobianPoint
add (in ellipticCurve: curve, in jacobianPoint: jp1, in jacobianPoint: jp2)
Add the points jp1 and jp2 in jacobian coordinates over given curve.
jacobianPoint
mult (in ellipticCurve: curve, in var jacobianPoint: jp1, in var bigInteger: c)
Multiply point jp1 by scalar c in jacobian coordinates over given curve.
ecPoint
multFast (in ellipticCurve: curve, in var ecPoint: p1, in var bigInteger: c)
Multiply point p1 by scalar c over given curve.
ecPoint
multAddFast (in ellipticCurve: curve, in var ecPoint: p1, in var bigInteger: c1, in var ecPoint: p2, in var bigInteger: c2)
Compute the sum of two products (ecPoint times scalar).
string
ecPointCompress (in ellipticCurve: curve, in ecPoint: point)
Encode an ecPoint in compressed form.
string
ecPointEncode (in ellipticCurve: curve, in ecPoint: point)
Encode an ecPoint in uncompressed form.
ecPoint
ecPointDecode (in ellipticCurve: curve, in string: encoded)
ecode an ecPoint, which can be compressed or uncompressed.
bigInteger
genPrivateKey (in ellipticCurve: curve)
Generate a private key for elliptic curve cryptography (ECC).
eccKeyPair
genEccKeyPair (in ellipticCurve: curve)
Generate a new ECC keyPair (private key and public key).
boolean
verifyKeyPair (in ellipticCurve: curve, in eccKeyPair: keyPair)
Verify that public and private key of an ECC keyPair fit together.
ecdsaSignatureType
sign (in ellipticCurve: curve, in var bigInteger: message, in bigInteger: privateKey)
Compute the ECDSA signature of 'message'.
boolean
verify (in ellipticCurve: curve, in var bigInteger: message, in ecdsaSignatureType: signature, in ecPoint: publicKey)
Verify that 'signature' is a valid ECDSA signature of 'message'.

Constant Detail

neutralEcPoint

const ecPoint: neutralEcPoint

The neutral point of an elliptic curve.


secp192k1

const ellipticCurve: secp192k1

The elliptical curve secp192k1.


secp192r1

const ellipticCurve: secp192r1

The elliptical curve secp192r1.


secp224k1

const ellipticCurve: secp224k1

The elliptical curve secp224k1.


secp224r1

const ellipticCurve: secp224r1

The elliptical curve secp224r1.


secp256k1

const ellipticCurve: secp256k1

The elliptical curve secp256k1.


secp256r1

const ellipticCurve: secp256r1

The elliptical curve secp256r1.


secp384r1

const ellipticCurve: secp384r1

The elliptical curve secp384r1.


secp521r1

const ellipticCurve: secp521r1

The elliptical curve secp521r1.


Operator Detail

=

const func boolean: (in ecPoint: point1) = (in ecPoint: point2)

Check if two elliptic curve points are equal.

Returns:
TRUE if the two points are equal, FALSE otherwise.

<>

const func boolean: (in ecPoint: point1) <> (in ecPoint: point2)

Check if two elliptic curve points are not equal.

Returns:
FALSE if both numbers are equal, TRUE otherwise.

Function Detail

ecPoint

const func ecPoint: ecPoint (in bigInteger: x, in bigInteger: y)

Create an elliptic curve point from the given coordinates x and y.


ellipticCurve

const func ellipticCurve: ellipticCurve (in integer: bits, in string: name, in bigInteger: p, in bigInteger: a, in bigInteger: b, in ecPoint: g, in bigInteger: n)

Create an elliptic curve from the given parameters. Creates the elliptic curve y**2 = x**3 + a*x + b (mod p).

Parameters:
bits - Number of bits in the elliptic curve.
name - Name of the elliptic curve.
p - In the finite field F all computations are (mod p).
a - Possible negative factor from the curve formula.
b - Possible negative constant from the curve formula.
g - Base point of the elliptic curve.
n - Order of g (mult(g, n) = neutralEcPoint).

getSizeInBytes

const func integer: getSizeInBytes (in ellipticCurve: curve)

Get the size of an elliptic curve in bytes. This is the number of bytes necessary to represent the x or y coordinate of an ecPoint.


element

const func boolean: element (in ecPoint: point, in ellipticCurve: curve)

Test, whether 'point' is on the given elliptic curve.


double

const func ecPoint: double (in ellipticCurve: curve, in ecPoint: p)

Double the point p over given curve. Double point in y**2 = x**3 + a*x + b (mod p).


add

const func ecPoint: add (in ellipticCurve: curve, in ecPoint: p1, in ecPoint: p2)

Add the points p1 and p2 over given curve. Addition of points in y**2 = x**3 + a*x + b (mod p).


mult

const func ecPoint: mult (in ellipticCurve: curve, in var ecPoint: p1, in var bigInteger: c)

Multiply point p1 by scalar c over given curve. Scalar multiplication p1 * c = p1 + p1 + ... + p1 (c times).


toJacobian

const func jacobianPoint: toJacobian (in ecPoint: p)

Transform point p given as (x, y) to jacobian coordinates.


fromJacobian

const func ecPoint: fromJacobian (in jacobianPoint: jp, in bigInteger: n)

Transform a point from jacobian coordinates to (x, y) mod n.


double

const func jacobianPoint: double (in ellipticCurve: curve, in jacobianPoint: jp)

Double the point jp in jacobian coordinates over given curve. Double point in y**2 = x**3 + a*x + b (mod p).


add

const func jacobianPoint: add (in ellipticCurve: curve, in jacobianPoint: jp1, in jacobianPoint: jp2)

Add the points jp1 and jp2 in jacobian coordinates over given curve. Addition of points in y**2 = x**3 + a*x + b (mod p).


mult

const func jacobianPoint: mult (in ellipticCurve: curve, in var jacobianPoint: jp1, in var bigInteger: c)

Multiply point jp1 by scalar c in jacobian coordinates over given curve. Scalar multiplication jp1 * c = jp1 + jp1 + ... + jp1 (c times).


multFast

const func ecPoint: multFast (in ellipticCurve: curve, in var ecPoint: p1, in var bigInteger: c)

Multiply point p1 by scalar c over given curve. Scalar multiplication p1 * c = p1 + p1 + ... + p1 (c times). Encapsulates the multiplication that is done with jacobian coordinates.


multAddFast

const func ecPoint: multAddFast (in ellipticCurve: curve, in var ecPoint: p1, in var bigInteger: c1, in var ecPoint: p2, in var bigInteger: c2)

Compute the sum of two products (ecPoint times scalar). Encapsulates the computation that is done with jacobian coordinates.


ecPointCompress

const func string: ecPointCompress (in ellipticCurve: curve, in ecPoint: point)

Encode an ecPoint in compressed form.


ecPointEncode

const func string: ecPointEncode (in ellipticCurve: curve, in ecPoint: point)

Encode an ecPoint in uncompressed form.


ecPointDecode

const func ecPoint: ecPointDecode (in ellipticCurve: curve, in string: encoded)

ecode an ecPoint, which can be compressed or uncompressed.


genPrivateKey

const func bigInteger: genPrivateKey (in ellipticCurve: curve)

Generate a private key for elliptic curve cryptography (ECC).


genEccKeyPair

const func eccKeyPair: genEccKeyPair (in ellipticCurve: curve)

Generate a new ECC keyPair (private key and public key).


verifyKeyPair

const func boolean: verifyKeyPair (in ellipticCurve: curve, in eccKeyPair: keyPair)

Verify that public and private key of an ECC keyPair fit together.


sign

const func ecdsaSignatureType: sign (in ellipticCurve: curve, in var bigInteger: message, in bigInteger: privateKey)

Compute the ECDSA signature of 'message'. ECDSA is the Elliptic Curve Digital Signature Algorithm.


verify

const func boolean: verify (in ellipticCurve: curve, in var bigInteger: message, in ecdsaSignatureType: signature, in ecPoint: publicKey)

Verify that 'signature' is a valid ECDSA signature of 'message'. ECDSA is the Elliptic Curve Digital Signature Algorithm.



 previous   up   next