The Many cryptographic protocols require random or pseudorandom inputs at various points, e.g., for auxiliary quantities used in generating digital signatures, or for generating challenges in authentication protocols. Security of an algorithm rests in keys. If cryptographically weak process is used to generate keys then the whole system will be weak. Only the key should be secret. Cryptographic mechanisms depend on the confidentiality of keys as algorithms are in the public domain. To engage in secure communications there is a need to securely distribute a secret key or public key. Keys should be dynamic Hence a cryptographically strong key must be generated, and thus the key management becomes the major issue in cryptography. In this paper the ant colony based NP problem solving technique is used along with some random functions to ensure that a strong and efficient key management is achieved for symmetric key cryptography that can be employed in the symmetric key algorithms.