2
$\begingroup$

enter image description here

This is the diagram of an ecc implementation here that needs to generate the shared key, how can it be done?

$\endgroup$
  • $\begingroup$ i'm a newbie that's why posted many question mark instead of one. if you find that offensive then i'm sorry. $\endgroup$ – Dark Prince Apr 1 '17 at 13:55
  • $\begingroup$ I have removed the superfluous question marks because from what I could tell they added no value to the question as opposed to a simple question mark (and the question looks better with a single one I think). No offense was taken at all by anyone I strongly believe. $\endgroup$ – SEJPM Apr 1 '17 at 14:29
  • $\begingroup$ Shared secret is just one private key multiplied by the other's public point (public key is usually the x coordinate of that point). Since they are both starting from the same base point the result is the same for both (base point * one private key * the other private key). $\endgroup$ – user10653 Apr 19 '17 at 5:52
2
$\begingroup$

The diagram leaves out something (rather assumes it implicitly), which is that you and the recipient have agreed upon curve parameters / a standardized curve with which to perform key exchange. We can derive the shared key as follows once we agree upon parameters (this method is basically elliptic curve Diffie Hellman):

  1. Use the RNG to generate an integer $d \in \mathbb{Z}_q$ where $q$ is the order of the generator point $G$ of the curve (technically $d$ can be arbitrarily large but there's no advantage to this).
  2. Your ECC key pair is then $(d, Q)$ where $Q = d*G$. $d$ is the private key, $Q$ is the public key. Note that $Q$ is a point on the curve.
  3. Given the recipients public key $R$ (also a point on the curve) compute $S = d * R$. $S$ is the shared secret. (Note that if $e$ is the recipients private key that means $R = e * G$, and thus $S = d * e * G$, meaning if we send the recipient our public key $Q$ they can also derive the secret $S = e * Q = e * d * G$).

Now we have shared key material we can pass into a KDF to derive symmetric keys.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Isn't Q the public key? How come R became the public key? What is R? $\endgroup$ – twodee Sep 30 at 20:53
  • $\begingroup$ $Q$ is your public key, $R$ is the recipients (the person you want to create a shared key with) public key. $\endgroup$ – puzzlepalace Oct 1 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.