#include <cECPGroupParams.h>
Define EC params similar to SpecifiedECDomain (SEC 1 C.2) For any ECP_CurveType_t https://tools.ietf.org/html/draft-ietf-pkix-ecc-pkalgs-01
◆ cECPGroupParams()
GrayLib::cECPGroupParams::cECPGroupParams |
( |
| ) |
|
|
inline |
◆ DoModPHi()
void GrayLib::cECPGroupParams::DoModPHi |
( |
OUT cBigInteger & |
N | ) |
const |
|
inline |
Reduce a cBigInteger mod m_P in-place, to use after InitAdd and OpMultiply. We known P, N and the result are positive, so InitSubU is correct, and a bit faster.
◆ DoModPLo()
void GrayLib::cECPGroupParams::DoModPLo |
( |
OUT cBigInteger & |
N | ) |
const |
|
inline |
Reduce a cBigInteger mod m_P in-place, to use after InitSubtract N.s < 0 is a very fast test, which fails only if N is 0
◆ get_ECP_CurveType()
Get the type of a curve. ECP_CurveType_t
◆ get_SizeP()
size_t GrayLib::cECPGroupParams::get_SizeP |
( |
| ) |
const |
|
inline |
◆ InjectCommon()
void GrayLib::cECPGroupParams::InjectCommon |
( |
| ) |
|
Assume p,n,a,b,g are all set.
◆ IsMatchECPParams()
bool GrayLib::cECPGroupParams::IsMatchECPParams |
( |
const cECPGroupParams & |
ref | ) |
const |
Compare to the group we were given, starting with easy tests
◆ IsValidPrivateKey()
Check that an cBigInteger is a valid private key for this curve type.
- d = Integer to check
- Returns
- 0 if point is a valid private key, NTE_BAD_KEY otherwise.
◆ ReadBigIntECDSA()
HRESULT GrayLib::cECPGroupParams::ReadBigIntECDSA |
( |
OUT cBigInteger & |
x, |
|
|
const BYTE * |
buf, |
|
|
size_t |
nSizeBuffer |
|
) |
| const |
Derive a suitable integer for group pGroup from a buffer of length nSizeBuffer SEC1 4.1.3 step 5 aka SEC1 4.1.4 step 3
◆ ReadSpecifiedECDomain()
Parse a SpecifiedECDomain (SEC 1 C.2) and (mostly) fill the group with it. WARNING: the resulting group should only be used with put_ECPGroupId(), since its base point may not be set correctly if it was encoded compressed.
SpecifiedECDomain ::= SEQUENCE { version SpecifiedECDomainVersion(ecdpVer1 | ecdpVer2 | ecdpVer3, ...), fieldID FieldID {{FieldTypes}}, curve Curve, base ECPoint, order INTEGER, cofactor INTEGER OPTIONAL, hash HashAlgorithm OPTIONAL, ... }
We only support prime-field as field type, and ignore hash and cofactor.
◆ SetCopyECP()
HRESULT GrayLib::cECPGroupParams::SetCopyECP |
( |
const THIS_t & |
rSrc | ) |
|
Copy custom params. not used for predefined curve.
- Todo:
- SetCopyECP
◆ SetECPGroupFromStr()
HRESULT GrayLib::cECPGroupParams::SetECPGroupFromStr |
( |
RADIX_t |
radix, |
|
|
const char * |
p, |
|
|
const char * |
b, |
|
|
const char * |
gx, |
|
|
const char * |
gy, |
|
|
const char * |
n |
|
) |
| |
Import an ECP group from ASCII strings, case A == -3
- radix = Input numeric base
- p = Prime modulus of the base field
- b = Constant term in the equation
- gx = The generator's X coordinate
- gy = The generator's Y coordinate
- n = The generator's order
- Returns
- 0 if successful, or <0 = error
- Note
- Sets all fields except modp. m_pECPGroupDef is now wrong ??
◆ SetEmptyECPGroup()
void GrayLib::cECPGroupParams::SetEmptyECPGroup |
( |
| ) |
|
like cMem::ZeroSecure(this, sizeof(cECPGroup));
◆ UpdateBits()
void GrayLib::cECPGroupParams::UpdateBits |
( |
| ) |
|
Always call this after loading or changing values.
◆ k_COMB_MAX_D
const WORD GrayLib::cECPGroupParams::k_COMB_MAX_D = (k_ECP_MAX_BITS + 1) / 2 |
|
static |
◆ k_ECP_MAX_BITS
const WORD GrayLib::cECPGroupParams::k_ECP_MAX_BITS = 521 |
|
static |
Maximum bit size of groups (that is, of N and P)
◆ k_ECP_MAX_BYTES
◆ k_pszPEM
const char * GrayLib::cECPGroupParams::k_pszPEM = "EC PARAMETERS" |
|
static |
◆ m_A
- A in the equation, or 2. (A + 2) / 4. (Set to -3 if not used?)
◆ m_B
- B in the equation, or 2. unused
◆ m_G
generator of the (sub)group used
◆ m_N
- the order of G, or 2. unused
◆ m_nNBits
number of used bits get_Highest1Bit() in 1. m_N, or 2. private keys
◆ m_nPBits
number of used bits in P. m_P.get_Highest1Bit();
◆ m_P
prime modulus of the base field
The documentation for this class was generated from the following files: