Add support for key exchange

First commit refactors the existing key stuff, which was broken for queries with whomever one does not share a channel with. 
Second commit adds support for DH1080 key exchange.