add bip32 pub key serialization

90604f16af
This commit is contained in:
lateminer
2018-01-02 13:01:45 +03:00
parent f528f99d4c
commit 09176edb18
6 changed files with 63 additions and 12 deletions

View File

@@ -164,11 +164,20 @@ struct CExtKey {
a.chaincode == b.chaincode && a.key == b.key;
}
void Encode(unsigned char code[74]) const;
void Decode(const unsigned char code[74]);
void Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const;
void Decode(const unsigned char code[BIP32_EXTKEY_SIZE]);
bool Derive(CExtKey& out, unsigned int nChild) const;
CExtPubKey Neuter() const;
void SetMaster(const unsigned char* seed, unsigned int nSeedLen);
template <typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const
{
unsigned int len = BIP32_EXTKEY_SIZE;
::WriteCompactSize(s, len);
unsigned char code[BIP32_EXTKEY_SIZE];
Encode(code);
s.write((const char *)&code[0], len);
}
};
/** Initialize the elliptic curve support. May not be called twice without calling ECC_Stop first. */