hammer2 - Crypto handshake work for message stream
* 'hammer2 debug' can now take a destination host argument (and will
default to localhost). This is the debug shell connection.
* Add 'hammer2 rsainit' to initialize hammer2's keys /etc/hammer2/rsa.*
* Change the 'hammer2 node' directive to 'hammer2 service'.
* Flesh out the initial public key exchange handshake. Currently the
handshake consists of a symmetric 512 byte write and 512 byte read.
The data is encrypted with our private key and the remote end's public
key.
Currently a very simple verifier has been constructed, but we will
ultimately want to use sha or md5 or something like that for the
verifier.
Since I am doing a double-encryption here the first stage encrypt
has to check that the result does not exceed the modulus (typically
bit 7 of the first byte must be zero). If it does we increment
a 32 bit quantity in our pad*[] area and retry until we get a good
result.
* The exchange is used to calculate the AES session key. Session
encryption is not yet implemented. A random session key is sent
by both ends. The actual session key will be the XOR of the one
we send and the one we receive.
* When a connection is accepted the remote end's public key is looked
up in /etc/hammer2/remotes/<IP>.pub. If this file does not exist
then the connection is not allowed.
13 files changed: