I have read and (believe) I understand the basics of key exchange / creation over a public channel of communication from this diagram Diffie–Hellman key exchange.

Now, a fair bit of the online documentation states what has been produced by this process is a "shared secret" not a "shared secret key", nor any references to keys. The documentation does indicate what has been produced can be used as a (shared private?) key. But is the "shared secret" ever used for anything other than a key - I can't think what, but that's why I am asking the question. It was just the term "shared secret" without reference to "key" that prompts this question.


This has been answered (but I can't find a way to indicate that on this post), so see comments below and : How to encrypt a symmetric key with a shared secret?

  • 3
    $\begingroup$ The main reason for this is that you will never use the actual shared secret itself as key directly, because it is not a uniformly random string. $\endgroup$
    – SEJPM
    Commented Jul 22, 2017 at 8:47
  • $\begingroup$ it is also not of the same byte length as required for your symmetric cipher - you need to transform this secret into a key, using some KDF. $\endgroup$ Commented Jul 22, 2017 at 10:01
  • $\begingroup$ This has been answered (but I can't find a way to indicate that on this post) — To indicate your question has been answered to your satisfaction, you only need to click the checkmark next to the related answer you like best. When done, the checkmark turns green and the system as well as the users will know your question has been answered. Hope that helps… $\endgroup$
    – e-sushi
    Commented Jul 23, 2017 at 1:36
  • $\begingroup$ door keys are keys, the pin height combos they encode are shared secrets, if that helps... $\endgroup$
    – dandavis
    Commented Jul 24, 2017 at 5:03
  • 1
    $\begingroup$ Does this answer your question? How to encrypt a symmetric key with a shared secret? $\endgroup$
    – apaderno
    Commented Sep 3, 2021 at 12:22

1 Answer 1


Shared secrets can also be used for authentication. He who knows the shared secret, is trusted. For instance, this is used in IoT scenarios, where nodes communicate via DTLS and use the secret as a PSK instead of a certificate and a keypair.

Of course, this only makes sense if the shared secret has been preshared or calculated via some algorithm. The result of an online key agreement like DH cannot be used for that.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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