Security Scol plugin
|
Elliptic Curve over GF(p), where p is prime. More...
#include <ecp.h>
Public Types | |
typedef ModularArithmetic | Field |
typedef Integer | FieldElement |
typedef ECPPoint | Point |
Public Types inherited from AbstractGroup< ECPPoint > | |
typedef ECPPoint | Element |
Public Member Functions | |
ECP () | |
Construct an ECP. | |
ECP (const ECP &ecp, bool convertToMontgomeryRepresentation) | |
Construct an ECP. | |
ECP (const Integer &modulus, const FieldElement &a, const FieldElement &b) | |
Construct an ECP. | |
ECP (BufferedTransformation &bt) | |
Construct an ECP from BER encoded parameters. | |
void | DEREncode (BufferedTransformation &bt) const |
DER Encode. | |
bool | Equal (const Point &P, const Point &Q) const |
Compare two points. | |
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 |
Point | ScalarMultiply (const Point &P, const Integer &k) const |
Point | CascadeScalarMultiply (const Point &P, const Integer &k1, const Point &Q, const Integer &k2) const |
void | SimultaneousMultiply (Point *results, const Point &base, const Integer *exponents, unsigned int exponentsCount) const |
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 ECP &rhs) const |
Public Member Functions inherited from AbstractGroup< ECPPoint > | |
virtual const Element & | Double (const Element &a) const |
Doubles an element in the group. | |
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. | |
typedef ModularArithmetic ECP::Field |
typedef Integer ECP::FieldElement |
typedef ECPPoint ECP::Point |
ANONYMOUS_NAMESPACE_END ECP::ECP | ( | const ECP & | ecp, |
bool | convertToMontgomeryRepresentation | ||
) |
Construct an ECP.
ecp | the other ECP object |
convertToMontgomeryRepresentation | flag indicating if the curve should be converted to a MontgomeryRepresentation. |
Prior to Crypto++ 8.3 the default value for convertToMontgomeryRepresentation was false. it was changed due to two audit tools finding, "Signature-compatible with a copy constructor".
|
inline |
ECP::ECP | ( | BufferedTransformation & | bt | ) |
Construct an ECP from BER encoded parameters.
bt | BufferedTransformation derived object |
This constructor will decode and extract the fields fieldID and curve of the sequence ECParameters
|
virtual |
Adds elements in the group.
a | first element |
b | second element |
a
and b
Implements AbstractGroup< ECPPoint >.
|
virtual |
BER Decodes an elliptic curve point.
bt | source BufferedTransformation |
Implements EncodedPoint< ECPPoint >.
ECP::Point ECP::CascadeScalarMultiply | ( | const Point & | P, |
const Integer & | k1, | ||
const Point & | Q, | ||
const Integer & | k2 | ||
) | const |
|
virtual |
Decodes an elliptic curve point.
P | point which is decoded |
bt | source BufferedTransformation |
len | number of bytes to read from the BufferedTransformation |
Implements EncodedPoint< ECPPoint >.
|
virtual |
Decodes an elliptic curve point.
P | point which is decoded |
encodedPoint | byte array with the encoded point |
len | the size of the array |
Implements EncodedPoint< ECPPoint >.
void ECP::DEREncode | ( | BufferedTransformation & | bt | ) | const |
DER Encode.
bt | BufferedTransformation derived object |
DEREncode encode the fields fieldID and curve of the sequence ECParameters
|
virtual |
DER Encodes an elliptic curve point.
bt | target BufferedTransformation |
P | point which is encoded |
compressed | flag indicating if the point is compressed |
Implements EncodedPoint< ECPPoint >.
const ECP::Point & ECP::Double | ( | const Point & | P | ) | const |
|
inlinevirtual |
Determines encoded point size.
compressed | flag indicating if the point is compressed |
Implements EncodedPoint< ECPPoint >.
|
virtual |
Encodes an elliptic curve point.
bt | target BufferedTransformation |
P | point which is encoded |
compressed | flag indicating if the point is compressed |
Implements EncodedPoint< ECPPoint >.
Encodes an elliptic curve point.
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< ECPPoint >.
Compare two points.
P | the first point |
Q | the second point |
Implements AbstractGroup< ECPPoint >.
|
inline |
|
inline |
|
virtual |
|
virtual |
Inverts the element in the group.
a | first element |
Implements AbstractGroup< ECPPoint >.
|
inlinevirtual |
Determine if inversion is fast.
Reimplemented from AbstractGroup< ECPPoint >.
ECP::Point ECP::ScalarMultiply | ( | const Point & | P, |
const Integer & | k | ||
) | const |
void ECP::SimultaneousMultiply | ( | ECP::Point * | results, |
const Point & | base, | ||
const Integer * | exponents, | ||
unsigned int | exponentsCount | ||
) | const |
bool ECP::ValidateParameters | ( | RandomNumberGenerator & | rng, |
unsigned int | level = 3 |
||
) | const |
|
virtual |
Verifies points on elliptic curve.
P | point to verify |
Implements EncodedPoint< ECPPoint >.