+bool send_ans_key_ecdh(node_t *to) {
+ int siglen = ecdsa_size(&myself->connection->ecdsa);
+ char key[(ECDH_SIZE + siglen) * 2 + 1];
+
+ if(!ecdh_generate_public(&to->ecdh, key))
+ return false;
+
+ if(!ecdsa_sign(&myself->connection->ecdsa, key, ECDH_SIZE, key + ECDH_SIZE))
+ return false;
+
+ b64encode(key, key, ECDH_SIZE + siglen);
+
+ char *pubkey = ecdsa_get_base64_public_key(&myself->connection->ecdsa);
+
+ if(!pubkey)
+ return false;
+
+ int result = send_request(to->nexthop->connection, "%d %s %s ECDH:%s:%s %d %d %zu %d", ANS_KEY,
+ myself->name, to->name, key, pubkey,
+ cipher_get_nid(&myself->incipher),
+ digest_get_nid(&myself->indigest),
+ digest_length(&myself->indigest),
+ myself->incompression);
+
+ free(pubkey);
+ return result;
+}
+