A generalization of the original Diffie-Hellman key exchange in Fp found a new depth when Miller (1986) and Koblitz (1987) suggested that such a protocol could be used with the group over an elliptic curve. In the present article, we extend such a generalization to the setting of a semigroup action (G-action) on a finite set. We define this extended protocol, show how it is related to the general Diffie-Hellman key exchange and give some examples. The interesting thing is that every action by an abelian semigroup gives rise to a Diffie-Hellman key exchange. With an additional assumption it is also possible to extend the ElGamal protocol.