Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cECPPoint Class Reference

#include <cECPGroupParams.h>

Public Member Functions

 cECPPoint ()
 
 ~cECPPoint ()
 
void SetEmptyPoint ()
 
bool IsEqualPoint (const cECPPoint &ref) const
 
bool isZeroPoint () const
 
bool IsMatchParams (const cECPPoint &ref) const
 
void SetPointNormal ()
 
void SetCopyPoint (const cECPPoint &Q)
 
bool SetPointFromStr (RADIX_t radix, const char *x, const char *y)
 
HRESULT WritePointBinary (BYTE *pBuf, size_t nSizeBuffer, size_t nSizeP, bool bCompressed) const
 
HRESULT WritePointLen (BYTE *pBuf, size_t nSizeBuffer, size_t nSizeP, bool bCompressed) const
 
HRESULT ReadPointBinary (size_t nSizeP, const BYTE *pBuf, size_t nSizeBuffer)
 
HRESULT ReadPointLen (size_t nSizeP, const BYTE *pBuf, size_t nSizeBuffer)
 
HRESULT ReadPointASN (size_t nSizeP, cASNReader &r0)
 

Public Attributes

cBigInteger m_X
 the point's X coordinate More...
 
cBigInteger m_Y
 the point's Y coordinate More...
 
cBigInteger m_Z
 the point's Z coordinate. Z == 0 or Z == 1 More...
 

Detailed Description

ECP point structure for Jacobian coordinates.

Note
All functions expect and return points satisfying the following condition: Z == 0 or Z == 1. (Other values of Z are used by internal functions only.) The point is zero, or "at infinity", if Z == 0. Otherwise, X and Y are its standard (affine) coordinates.

Constructor & Destructor Documentation

◆ cECPPoint()

GrayLib::cECPPoint::cECPPoint ( )
inline

◆ ~cECPPoint()

GrayLib::cECPPoint::~cECPPoint ( )
inline

Member Function Documentation

◆ IsEqualPoint()

bool GrayLib::cECPPoint::IsEqualPoint ( const cECPPoint ref) const
inline

◆ IsMatchParams()

bool GrayLib::cECPPoint::IsMatchParams ( const cECPPoint ref) const

For Y we may only know the parity bit, so compare only that

◆ isZeroPoint()

bool GrayLib::cECPPoint::isZeroPoint ( ) const
inline

is a point is zero?

◆ ReadPointASN()

HRESULT GrayLib::cECPPoint::ReadPointASN ( size_t  nSizeP,
cASNReader r0 
)

◆ ReadPointBinary()

HRESULT GrayLib::cECPPoint::ReadPointBinary ( size_t  nSizeP,
const BYTE *  pBuf,
size_t  nSizeBuffer 
)

Import a point from unsigned binary data (SEC1 2.3.4) http://www.secg.org/sec1-v2.pdf

  • nSizeP = Point to import
  • pBuffer = Input buffer
  • nSizeBuffer = Actual length of input
    Returns
    0 if successful, E_OUTOFMEMORY if memory allocation failed, E_NOTIMPL if the point format is not implemented.
    Note
    This function does NOT check that the point actually belongs to the given group, see IsValidPublicKey() for that.

◆ ReadPointLen()

HRESULT GrayLib::cECPPoint::ReadPointLen ( size_t  nSizeP,
const BYTE *  pBuf,
size_t  nSizeBuffer 
)

Import a point from a TLS ECPoint record (RFC 4492)

  • nSizeP = Destination point
  • pBuf = Start of input buffer
  • nSizeBuffer = Buffer length
    Note
    pBuf is updated to point right after the ECPoint on exit
    Returns
    length if successful, <0 = error. struct { opaque point <1..2^8-1>; } ECPoint;
    We must have at least two bytes (1 for length, at least one for data)

◆ SetCopyPoint()

void GrayLib::cECPPoint::SetCopyPoint ( const cECPPoint Q)

Copy the contents of point Q

◆ SetEmptyPoint()

void GrayLib::cECPPoint::SetEmptyPoint ( )
inline

◆ SetPointFromStr()

bool GrayLib::cECPPoint::SetPointFromStr ( RADIX_t  radix,
const char *  x,
const char *  y 
)

Import a non-zero point from two ASCII strings

  • radix = Input numeric base
  • x = First affine coordinate as a null-terminated string
  • y = Second affine coordinate as a null-terminated string

◆ SetPointNormal()

void GrayLib::cECPPoint::SetPointNormal ( )

Set point to zero

◆ WritePointBinary()

HRESULT GrayLib::cECPPoint::WritePointBinary ( BYTE *  pBuf,
size_t  nSizeBuffer,
size_t  nSizeP,
bool  bCompressed 
) const

Export a point into unsigned binary data (SEC1 2.3.3)

  • pBuffer = Output buffer
  • nSizeBuffer = Length of the output buffer
  • nSizeP = Point to export
  • bCompressed = Point format, should be a TLS_ECP_PF_XXX macro
    Returns
    0 if successful, or DISP_E_BUFFERTOOSMALL
    size

◆ WritePointLen()

HRESULT GrayLib::cECPPoint::WritePointLen ( BYTE *  pBuf,
size_t  nSizeBuffer,
size_t  nSizeP,
bool  bCompressed 
) const

Export a point as a TLS ECPoint record (RFC 4492)

  • pBuffer = Buffer to write to
  • nSizeBuffer = Buffer length
  • nSizeP = Point to export
  • bCompressed = Export format
    Returns
    0 if successful, or DISP_E_BUFFERTOOSMALL
    struct {
        opaque point <1..2^8-1>;
    } ECPoint;
    
    buffer length must be at least one, for our length byte
    length

Member Data Documentation

◆ m_X

cBigInteger GrayLib::cECPPoint::m_X

the point's X coordinate

◆ m_Y

cBigInteger GrayLib::cECPPoint::m_Y

the point's Y coordinate

◆ m_Z

cBigInteger GrayLib::cECPPoint::m_Z

the point's Z coordinate. Z == 0 or Z == 1


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