Safekipedia

Key (cryptography)

Discoverer · ages 10+Adapted from Wikipedia

A key in cryptography is a piece of information, usually a string of numbers or letters stored in a file. When it is processed through a cryptographic algorithm, it can encode or decode cryptographic data. Keys can come in different sizes and types depending on the method being used.

In every case, the strength of the encryption depends on keeping the key secure. A key's security strength depends on several things: the algorithm it is used with, the size of the key, how the key is generated, and how the key is exchanged.

Scope

A key is what is used to turn data from plaintext into ciphertext, which is scrambled data that cannot be easily read. There are different ways to use keys and encryption.

Symmetric cryptography

In symmetric cryptography, the same key is used to both lock (encrypt) and unlock (decrypt) the data.

Asymmetric cryptography

Asymmetric cryptography uses two different keys: one for encrypting and one for decrypting. These are called the public key and the private key.

Purpose

A key helps keep a system private and protects it from being changed by unauthorized people, so it must be kept secret from anyone who is not allowed to see it. With public key cryptography, only the private key must be kept secret. With symmetric cryptography, the key itself must be kept private. Kerckhoff's principle states that the entire security of a cryptographic system depends on keeping the key secret.

Key sizes

Main article: Key size

A key size is the number of bits in a key, as set by the algorithm. The larger the key, the longer it takes for someone to break it by trying every possible combination. Because perfect secrecy is not practical for key algorithms, researchers now focus on computational security instead.

In the past, keys could be as small as 40 bits, but as technology improved, these keys were broken more and more quickly. In response, the rules for symmetric keys were made larger. Today, 2048-bit RSA is commonly used and is enough for current systems. However, a powerful quantum computer could break current RSA keys quickly. Public key systems need longer keys than symmetric systems to be equally secure, and 3072 bits is suggested for this purpose.

Key generation

Main article: Key generation

To keep a key from being guessed, keys need to be made randomly and have enough entropy. Figuring out how to safely make random keys is hard, and many cryptographic systems have dealt with it in different ways. A key can be made directly from the output of a Random Bit Generator (RBG), which is a system that produces a series of unpredictable, unbiased bits. An RBG can be used to make either a symmetric key or the random output for making an asymmetric key pair. A key can also be made indirectly during a key-agreement process, from another key or from a password.

Some operating systems have tools that "collect" entropy from the timing of unpredictable actions, such as disk drive head movements. For making small amounts of keying material, ordinary dice are a good source of high-quality randomness.

Establishment scheme

Main article: Key exchange

A key's security depends on how it is shared between the people or devices involved. A safe communication channel is needed so that outsiders cannot get the key. A key establishment scheme, also called a key exchange, is used to send an encryption key between parties. There are two types: key agreement, where each party exchanges shared information that lets them work out the same secret key, and key transport, where the sender chooses the keying material, encrypts it, and sends it to the receiver. Both types can use either symmetric or asymmetric key methods.

The Diffie–Hellman key exchange and Rivest-Shamir-Adleman (RSA) are the two most widely used key exchange methods. In 1976, Whitfield Diffie and Martin Hellman created the Diffie–Hellman method, which was the first public key method. It lets two parties create a shared key over an insecure channel. RSA is an asymmetric key system with three steps: key generation, encryption, and decryption. Key confirmation gives assurance to both sides that the shared keys are correct and set up, and the National Institute of Standards and Technology recommends building it into key establishment to check that the method is working properly.

Management

Main article: Key management

Key management is about making, setting up, storing, using, and replacing cryptographic keys. A key management system (KMS) usually has three steps: setting up, storing, and using keys. Keeping keys safe depends on good key management protocols that cover how keys are made, stored, shared, used, and destroyed.

Key vs password

A password is a memorized series of letters, numbers, and other symbols that is used to check who someone is. People often make passwords, or password software makes them, to protect personal information or to create cryptographic keys. Passwords are usually made so people can remember them, so they may contain ordinary words. A key can make password protection stronger by using a cryptographic method that is hard to guess, or it can replace the password completely. A key is made from random or nearly random data, and it is often unreadable to people.

A password is less safe than a cryptographic key because it is less random and easier for people to read. However, in some systems, such as ones that store information on storage devices, the password may be the only secret that the encryption can use for information security. To make up for the password's weakness, a key derivation function (KDF) uses a password to create strong keying material. This method always gives the same result for the same input. Methods such as adding a salt or key stretching may be used when creating the keys.

Quiz time!

5 questions about Key (cryptography)

Question 1 of 5

How many keys does symmetric cryptography use to lock and unlock data?

Keep exploring

This article is a child-friendly adaptation of the Wikipedia article on Key (cryptography), available under CC BY-SA 4.0.