I just read through the text book definition of Diffie–Hellman key exchange. And from what i understand, the public key that is shared based on the protocol is calculated from:
g^k mod p
where g is a generator in the multiplicative group, and p is a large prime and k is the private key.
My question is, are all public/private key generated to have this relationship? Or this way of generating the public key from a private key and a g
and p
is peculiar to the Diffie–Hellman key exchange construction?
I mean if I want to generate a private key pair for use other than key exchange, for example for encryption, will I use a similar construct or something different?