mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Sign Dictionary in doNETWORK_CONFIG_REQUEST.
This commit is contained in:
parent
68b4ca9b31
commit
7036831203
3 changed files with 15 additions and 1 deletions
|
@ -454,7 +454,7 @@ public:
|
||||||
{
|
{
|
||||||
this->erase(sigKey);
|
this->erase(sigKey);
|
||||||
C25519::Signature sig(C25519::sign(kp,this->data(),this->sizeBytes()));
|
C25519::Signature sig(C25519::sign(kp,this->data(),this->sizeBytes()));
|
||||||
this->add(sigKey,sig.data,ZT_C25519_SIGNATURE_LEN);
|
this->add(sigKey,reinterpret_cast<const char *>(sig.data),ZT_C25519_SIGNATURE_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -287,6 +287,19 @@ public:
|
||||||
*/
|
*/
|
||||||
inline const C25519::Public &publicKey() const { return _publicKey; }
|
inline const C25519::Public &publicKey() const { return _publicKey; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return C25519 key pair (only returns valid pair if private key is present in this Identity object)
|
||||||
|
*/
|
||||||
|
inline const C25519::Pair privateKeyPair() const
|
||||||
|
{
|
||||||
|
C25519::Pair pair;
|
||||||
|
pair.pub = _publicKey;
|
||||||
|
if (_privateKey)
|
||||||
|
pair.priv = *_privateKey;
|
||||||
|
else memset(pair.priv.data,0,ZT_C25519_PRIVATE_KEY_LEN);
|
||||||
|
return pair;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return True if this identity contains something
|
* @return True if this identity contains something
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -749,6 +749,7 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons
|
||||||
Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> *dconf = new Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY>();
|
Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> *dconf = new Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY>();
|
||||||
try {
|
try {
|
||||||
if (netconf->toDictionary(*dconf,metaData.getUI(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_VERSION,0) < 6)) {
|
if (netconf->toDictionary(*dconf,metaData.getUI(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_VERSION,0) < 6)) {
|
||||||
|
dconf->wrapWithSignature(ZT_NETWORKCONFIG_DICT_KEY_SIGNATURE,RR->identity.privateKeyPair());
|
||||||
const unsigned int totalSize = dconf->sizeBytes();
|
const unsigned int totalSize = dconf->sizeBytes();
|
||||||
unsigned int chunkIndex = 0;
|
unsigned int chunkIndex = 0;
|
||||||
while (chunkIndex < totalSize) {
|
while (chunkIndex < totalSize) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue