Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

Reading the Diffie-Hellman non mathematical explanation i found that some mathematical operations are performed on private-key and the recipient's public key to generate a "shared secret" on both ends of the communication; the shared-secret key is identical on both ends.

I read that the shared-secret key is asymmetrical by it's mathematical nature; so the concept of public and private keys must apply here too.

So my question is "Is the shared secret a public key or a private key" or something intermediate.

share|improve this question

2 Answers 2

up vote 9 down vote accepted

If it is public it cannot be secret...

A key is "a parameter for an algorithm, which concentrates secrecy". This means that the key is not only secret, but, normally, nothing else is (algorithms are known to everybody).

A public key is a paradoxic terminology which was coined when asymmetric cryptography was invented. The "real" key is what we call the private key. It is the secret parameter which allows for performing an operation which only the key owner should be able to do (e.g. decrypting a piece of data, computing a signature...). The magic of asymmetric cryptography is that the reverse operation (encrypting a piece of data, verifying a signature...) can be done by anybody, using a mathematical object which is linked to the private key, and which can be made public without revealing the private key. You can imagine the public key as the face of a human being: it is distinctive and can convey information, but recognizing the face does not tell you what goes inside the brain. So a "public key" is not really a "key" in the strict sense of the term; and the "private key" could be called simply "key" or "secret key" because that's what it is.

However, Tradition dictates that we say "private key" for a key of the asymmetric kind (a key with enough mathematical structure to have a public face, which can be revealed without endangering the secrecy of the private key), while keys which are just bunches of bits, for symmetric encryption and similar algorithms, are called "secret keys" (or "symmetric keys"). That's traditional, not ultimately rational; terminology is always like that.

Asymmetric cryptography is mightily cool, but it is ill-suited for bulk encryption of gigabytes of data. For that, symmetric cryptography is much better, with "secret keys" (i.e. keys which do not have a public face, they are 100% secret). Diffie-Hellman is an asymmetric key exchange algorithm, in which two parties do the mathematics of DH and end up with a shared secret, i.e. a key: they both know it (thus "shared"), but nobody else (thus "secret"). With it, they can do symmetric cryptography, which was the point.

share|improve this answer
    
a very helpful explanation thanks :) –  Ankit Sep 27 '12 at 11:56

Read Thomas Pornin's very good answer. I think there's an additional source for confusion which might have tripped you.

A Diffie-Hellman key exchange is said to be a public-key protocol because it involves a pair of values (two such pairs, in fact: one for each party), with one value in the pair remaining secret and the other sent publicly.

  • First the two parties agree on some public parameters (p, g).
  • Then each party chooses a secret value (a, b), and sends a public value (g^a mod p, g^b mod p). In principle, the secret value could be deduced from the public value, but there is no known method to do so with real-world computing power. Such pairs of values where one can easily be computed from the other but not vice versa, when the values are used to help exchange more data, are called public/private key pairs.
  • The magic of Diffie-Hellman is that at the end, even though only public values have been exchanged, the parties manage to independently compute a secret value g^{ab} (one that is only known to the two parties).

Very often, the shared secret value is itself used as a key in some second cryptographic protocol which is based on symmetric cryptography (i.e. with a shared key), for example one based on AES. More precisely, a part of that secret value is used as a key for symmetric cryptography, and that part is called a secret key because of its used as part of the second protocol.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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