implemented part of the ephemeral key exchange