+bool send_ans_key(node_t *to) {
+ if(to->status.ecdh)
+ return send_ans_key_ecdh(to);
+
+ size_t keylen = cipher_keylength(&myself->incipher);
+ char key[keylen * 2 + 1];
+
+ cipher_open_by_nid(&to->incipher, cipher_get_nid(&myself->incipher));
+ digest_open_by_nid(&to->indigest, digest_get_nid(&myself->indigest), digest_length(&myself->indigest));
+ to->incompression = myself->incompression;
+
+ randomize(key, keylen);
+ cipher_set_key(&to->incipher, key, true);
+ digest_set_key(&to->indigest, key, keylen);
+
+ bin2hex(key, key, keylen);
+ key[keylen * 2] = '\0';
+
+ // Reset sequence number and late packet window
+ mykeyused = true;
+ to->received_seqno = 0;
+ if(replaywin) memset(to->late, 0, replaywin);
+
+ return send_request(to->nexthop->connection, "%d %s %s %s %d %d %zu %d", ANS_KEY,
+ myself->name, to->name, key,
+ cipher_get_nid(&to->incipher),
+ digest_get_nid(&to->indigest),
+ digest_length(&to->indigest),
+ to->incompression);
+}
+
+bool ans_key_h(connection_t *c, char *request) {