The shared secret is either shared before parties start to communicate; in this case it can also be called a pre-shared key. Or it is created at the start of the communication session by using a key-agreement protocol, for-instance using public-key cryptography such as Diffie-Hellman or using symmetric-key cryptography such as Kerberos.