Handshake improvements; encrypt-decrypt helpers