Security of multimedia information is used to protect the multimedia content from unauthorized access. In this paper, the authors implemented security for text and image information using a cryptographic key. Based on the session type a key is generated which is used for encrypting and decrypting the messages which are transmitted between two sides. The length of the key varies in every session according to the session type. It is a reliable and flexible way to generate the key and it is easy to implement.