![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cKeyECPPair.h>
Public Member Functions | |
| cKeyECPPair () noexcept | |
| virtual | ~cKeyECPPair () |
| virtual size_t | get_KeySize () const override |
| Get key size in bytes. More... | |
| virtual int | GetKeyValues (cValue *items) const override |
| Interface with the debug module. get debug values. More... | |
| virtual void | SetZeroKey () override |
| Secure zero the key. More... | |
| void | SetCopyKey (const cKeyECPPair &key) |
| virtual HRESULT | CheckPublicPrivatePair (const cKeyBase *pKeyPrivate) const override |
| Check public-private key pair. More... | |
| virtual HRESULT | VerifySignature (SSL_Hash_TYPE eHashType, const BYTE *pHash, size_t nSizeHash, const BYTE *pSig, size_t nSizeSig) const override |
| Verify Key signature. Make const ?? More... | |
| virtual HRESULT | MakeSignature (BYTE *pSig, SSL_Hash_TYPE eHashType, const BYTE *pHash, size_t nSizeHash, IRandomNoise *pRandom) const override |
| Make signature From Key. Make const ?? More... | |
| HRESULT | GenerateKeys (ECPGroup_TYPE eECPGroupId, IRandomNoise *pRandom) |
| HRESULT | WriteECParameters (cASNWriterRev &w) const |
| virtual HRESULT | ReadPrivateKey (cASNReader &r, cASNBuf *pAlgParams) override |
| Read not encrypted. (already decrypted) More... | |
| virtual HRESULT | ReadPublicKey (cASNReader &r, cASNBuf *pAlgParams) override |
| virtual HRESULT | WritePrivateKey (cASNWriterRev &w) const override |
| Write not encrypted. (may be encrypted/secured later) More... | |
| virtual HRESULT | WritePublicKey (cASNWriterRev &w) const override |
| UNITTEST_FRIEND (cKeyECPPair) | |
Public Member Functions inherited from GrayLib::cKeyBase | |
| virtual | ~cKeyBase () |
Public Member Functions inherited from Gray::cRefBase | |
| cRefBase (int iRefCount=0) noexcept | |
| virtual | ~cRefBase () |
| int | get_RefCount () const noexcept |
| HASHCODE_t | get_HashCode () const noexcept |
| STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept | |
| virtual void | onFinalRelease () |
| bool | isValidObj () const noexcept |
| STDMETHOD_ (ULONG, AddRef)(void) override | |
| STDMETHOD_ (ULONG, Release)(void) override | |
| STDMETHOD() | QueryInterface (const IID &riid, void __RPC_FAR *__RPC_FAR *ppvObject) override |
| void | IncRefCount () |
| void | DecRefCount () |
| bool | isStaticConstruct () const noexcept |
| void | StaticConstruct () |
| void | StaticDestruct () |
| bool | isDestructing () noexcept |
| void | SetDestructing () |
Public Member Functions inherited from Gray::CObject | |
| virtual | ~CObject () |
| virtual bool | isValidCheck () const noexcept |
| < memory allocation and structure definitions are valid. More... | |
| virtual void | AssertValid () const |
| < memory allocation and structure definitions are valid. More... | |
| virtual void | Serialize (cArchive &a) |
Public Attributes | |
| cECPGroup | m_grp |
| Elliptic curve and base point. More... | |
| cBigInteger | m_d |
| our secret value More... | |
| cECPPoint | m_Q |
| our public value More... | |
Protected Member Functions | |
| HRESULT | MakeSignatureSeed (BYTE *pOut, const cBigInteger &d, const BYTE *buf, size_t nSizeBuf) const |
| HRESULT | MakeSignatureDer (cASNWriterRev &w, const cBigInteger &r, const cBigInteger &s) const |
Static Protected Member Functions | |
| static HRESULT GRAYCALL | ReadECParameters (cASNReader &r, OUT cASNBuf ¶ms) |
Additional Inherited Members | |
Public Types inherited from GrayLib::cKeyBase | |
| enum | VALTYPE_TYPE { VALTYPE_NONE = 0 , VALTYPE_RSA = 1 , VALTYPE_ECP = 2 } |
Static Public Attributes inherited from GrayLib::cKeyBase | |
| static const int | k_MAX_VALUES = 2 |
| Maximum number of cValue sent for debugging. More... | |
ECP key pair structure. SSL_Key_ECKEY or SSL_Key_ECKEY_DH A generic key pair that could be used for ECDSA, fixed ECDH, etc. base for class cKeyECDSA.
|
inlinenoexcept |
|
inlinevirtual |
|
overridevirtual |
Check public-private key pair.
Check a public-private key pair
Implements GrayLib::cKeyBase.
| HRESULT GrayLib::cKeyECPPair::GenerateKeys | ( | ECPGroup_TYPE | eECPGroupId, |
| IRandomNoise * | pRandom | ||
| ) |
Generate a keypair
|
inlineoverridevirtual |
Get key size in bytes.
Implements GrayLib::cKeyBase.
|
inlineoverridevirtual |
Interface with the debug module. get debug values.
Implements GrayLib::cKeyBase.
|
overridevirtual |
Make signature From Key. Make const ??
< first integer from signature
< second integer from signature
Implements GrayLib::cKeyBase.
Reimplemented in GrayLib::cKeyECDSA.
|
protected |
Convert a signature (given by context) to ASN.1 RFC 4492 page 20: Ecdsa-Sig-Value ::= SEQUENCE { r INTEGER, s INTEGER }
|
protected |
Compute ECDSA signature of a previously hashed message (deterministic version)
|
staticprotected |
Minimally parse an ECParameters buffer to and cASNBuf
ECParameters ::= CHOICE { namedCurve OBJECT IDENTIFIER specifiedCurve SpecifiedECDomain – = SEQUENCE { ... } – implicitCurve nullptr }
|
overridevirtual |
Read not encrypted. (already decrypted)
Parse a SEC1 (DER) encoded private EC key RFC 5915, or SEC1 Appendix C.4
Implements GrayLib::cKeyBase.
|
overridevirtual |
EC public key is an EC point The caller is responsible for clearing the structure upon failure if desired. Take care to pass along the possible E_NOTIMPL return code of ReadPointBinary() and leave p in a usable state.
Implements GrayLib::cKeyBase.
|
inline |
Set an ECDSA context from a cKeyECPPair
|
inlineoverridevirtual |
| GrayLib::cKeyECPPair::UNITTEST_FRIEND | ( | cKeyECPPair | ) |
|
overridevirtual |
Verify Key signature. Make const ??
Read and check signature
< first integer from signature
< second integer from signature
Implements GrayLib::cKeyBase.
| HRESULT GrayLib::cKeyECPPair::WriteECParameters | ( | cASNWriterRev & | w | ) | const |
ECParameters ::= CHOICE { namedCurve OBJECT IDENTIFIER }
|
overridevirtual |
Write not encrypted. (may be encrypted/secured later)
RFC 5915, or SEC1 Appendix C.4
ECPrivateKey ::= SEQUENCE { version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1), privateKey OCTET STRING, parameters [0] ECParameters {{ NamedCurve }} OPTIONAL, publicKey [1] BIT STRING OPTIONAL }
Implements GrayLib::cKeyBase.
|
overridevirtual |
EC public key is an EC point
Implements GrayLib::cKeyBase.
| cBigInteger GrayLib::cKeyECPPair::m_d |
our secret value
| cECPGroup GrayLib::cKeyECPPair::m_grp |
Elliptic curve and base point.
| cECPPoint GrayLib::cKeyECPPair::m_Q |
our public value