Nepedia
Back to Discover
Advanced Reader
💻

Key (cryptography)

technology Maturity 11-13 Next article →

In the field of cryptography, a key is a vital piece of information used to protect data. This information is usually a string of numbers or letters stored in a digital file. When this key is processed through a cryptographic algorithm, it can encode or decode data. This process turns readable plaintext into scrambled ciphertext. The strength of any encryption system relies heavily on the security of the key. This idea is known as Kerckhoff's principle. It states that the entire security of a system depends on the key remaining secret, even if the algorithm is known.

There are two primary methods for using keys to secure information. The first is symmetric cryptography, where the same key is used for both encryption and decryption. This means both the sender and the receiver must have the exact same secret. The second method is asymmetric cryptography, which uses two separate keys. These are known as the public key and the private key. In this system, the public key is used for encryption, but only the private key can perform the decryption. While the public key can be shared, the private key must be kept strictly secret to maintain confidentiality.

Key size is a critical factor in determining how strong an encryption method is. Size is measured by the number of bits in the key, which is defined by the algorithm. A larger key size creates an upper bound for the security of the algorithm. Specifically, larger keys make it much harder for a brute force attack to succeed. A brute force attack is an attempt to guess the key by trying every possible combination. In the past, keys only needed to be 40 bits long. However, as technology advanced, these smaller keys were broken more quickly, requiring larger sizes for modern security.

Different algorithms require different key lengths to achieve the same level of safety. For example, RSA is a common form of asymmetric cryptography. Currently, 2048 bit RSA is widely used and sufficient for many systems. However, researchers suggest that 3072 bits is better for systems based on factoring or integer discrete logarithms. This larger size aims to provide security equivalent to a 128 bit symmetric cipher. It is also important to note that current RSA key sizes could be cracked quickly by a powerful quantum computer. This shows that as computing power grows, our key requirements must also change.

To prevent attackers from guessing a key, it must be generated using high entropy. Entropy refers to the randomness or unpredictability of the data. One way to create these keys is by using a Random Bit Generator, or RBG. An RBG produces a sequence of unpredictable and unbiased bits. These bits can directly create a symmetric key or the output for an asymmetric key pair. Some operating systems even collect entropy from unpredictable physical events, like the timing of disk drive head movements. For very small amounts of material, even ordinary dice can provide high-quality randomness.

Moving a key from one person to another requires a secure establishment scheme. This is often called a key exchange. There are two main types of exchange: key agreement and key transport. In a key agreement scheme, parties exchange information to derive a shared secret key indirectly. In a key transport scheme, a sender chooses a key and sends it to the receiver in an encrypted form. Two of the most famous algorithms for this are Diffie–Hellman and RSA. The Diffie–Hellman algorithm, created by Whitfield Diffie and Martin Hellman in 1976, was the first public key algorithm. It allows two parties to generate a shared key even over an insecure channel.

Finally, it is important to distinguish between a cryptographic key and a password. A password is a series of characters, like letters and digits, that a human user memorizes. Because humans create passwords, they often have low entropy and are easy to guess. A cryptographic key is usually much stronger because it is generated from random data and is often unreadable to humans. In some cases, a password is the only secret available to a system. To fix this, a key derivation function, or KDF, is used. This mathematical tool takes a weak password and turns it into a strong, secure cryptographic key. This process can include methods like adding a salt or using key stretching to increase security.

729 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.