updated for ecdh and raw keys