Symmetric key management is the key management of cryptographic symmetric encryption keys. In a symmetric key algorithm the keys involved are identical for both encrypting and decrypting a message. Such keys must be chosen carefully, and distributed and stored securely. In any system there may be multiple keys for various purposes. Accordingly, key management is central to the successful and secure use of symmetric key algorithms.
The main characteristics of symmetric key management are:
- key generation
- key exchange
- key storage
- key usage
Key generation is part of key management. It is important, for some algorithms have weak keys which make cryptanalysis easier, even much easier. DES, the US Government approved cipher standard has, for instance, four known weak keys. These keys must be known, if they exist, and eliminated from the pool of possible keys. Otherwise, the chief requirement of a key for symmetric cipher use is unpredictability, specifically to any potential attacker. This is somewhat like the case of passwords. Because this is equivalent to high entropy, and because keys can be thought of as a string of bits, the usual technique for generating a key is to select one from a pool of binary random numbers.
Equivalently, one may say that the output of a key generating function should not support a conclusion about the input.
In either case, the quality of the random number generator used should be as high as possible. This is difficult to achieve in practice. Many key derivation functions use a mathematical one way function, such as a cryptographic hash functions like MD5 or SHA 1. If used carefully these prevent an attacker from learning the input to the KDF and from guessing it with any better likelihood of getting it correct than chance. Hash function outputs are not random, being deterministically dependent on their inputs, and so their inputs should have high entropy.
Keys are often derived from a password, or more satisfactorily (passwords being unlikely to be randomly chosen) from pseudo random number generator, some of which are also cryptographically secure. Many pseudo random number generators are entirely unsuitable for such a use however, as they are not in fact random, and so do not have high entropy.
Prior to any communication protected by a symmetric key encryption algorithm, both parties (and no one else) must possess the same properly generated key. Formerly, exchange of such a key was extremely troublesome, and was greatly eased by access to secure communications such as a diplomatic bag. Clear text exchange is quite impractical as any interceptor will immediately learn the key to be used and so will be able to decrypt messages they weren't intended to have access to.
Since the Diffie-Hellman key exchange protocol was published in 1975, it has become possible to exchange a key over an insecure communications channel, which has very substantially reduced the risk of key disclosure during distribution. It is possible, using something akin to a book code, to include key indicators as clear text attached to an encrypted message. The encryption technique used by Richard Sorge's code clerk was of this type, referring to a page in a statistical manual, though it was in fact a code. The German Army Enigma symmetric encryption key was a mixed type early in its use; the key was a combination of secretly distributed key schedules and a user chosen session key component for each message.
In more modern systems, such as Open PGP compatible systems, a session key for a symmetric key algorithm is distributed encrypted by an asymmetric key algorithm. This approach avoids even the necessity for using a key exchange protocol like Diffie-Hellman key exchange.
A more complex method of key exchange involves encapsulating one key within another. It's not clear that this increase security for if one key can be securely exchanged (the encapsulating key), the encapsulated key can presumably be as well. This technique is usually termed Key Wrap. A common technique uses Block ciphers and cryptographic hash functions.
A related method, also more complicated, is to exchange a master key (sometimes termed a root key), and, as needed, derive subsidiary keys, possible for each session, from that key. As with the key wrapping scheme above, this scheme also offers no obvious benefit, for if the master key can be distributed securely, so might the subsidiary keys. When the availability of secure exchange is intermittent, or when keys must be related to each other (i.e., departmental keys are tied to divisional keys, and individual keys tied to departmental keys) this technique may be useful. However, tying keys to each other increase the damage which may result from a security breach as attackers will learn something about more than one key. This reduces entropy, with regard to an attacker, for each key involved.
However distributed, symmetric keys must be stored securely to maintain communications security. There are various techniques in use to assist with this. Likely the most common is that an encryption application manages keys for the user and depends on an access password to control use of the key. It is rare to use keys in 'raw' form, that is as a string of bits, most probably because such strings often generate mistakes when handled by humans.
The major issue is length of key use, and therefore frequency of replacement. Because it increases any attackers required effort, keys should be frequently changed. This also limits loss of information, as the number of stored encrypted messages which will become readable when a key is found will be decrease as the frequency of key change increases. Historically, symmetric keys have been used for long periods in situations in which key exchange was very difficult or only possible intermittently. Ideally, the symmetric key should change with each message or interaction, so that only that message will become readable if the key is learned (e.g., stolen, cryptanalyzed, or social engineered).