Public-key cryptography
Public-key cryptography, also called asymmetric cryptography, is a field of cryptographic systems that use pairs of related keys. Each key pair has a public key and a private key that belong together.
Key pairs are created with algorithms based on mathematical problems called one-way functions. The private key must stay secret, but the public key can be shared openly without harming security.
There are many kinds of public-key cryptosystems, and each has different security goals. These include digital signature, Diffie–Hellman key exchange, public-key key encapsulation, and public-key encryption.
Public key algorithms are basic building blocks of modern security. They help protect the privacy and authenticity of electronic communications and data storage. They also support Internet standards such as Transport Layer Security (TLS), SSH, S/MIME, and PGP.
Compared with symmetric cryptography, public-key cryptography can be too slow for many purposes. For this reason, these protocols often combine the two methods in hybrid cryptosystems.
Description
Before the mid-1970s, all cipher systems used symmetric key algorithms. In these systems, the sender and the receiver use the same cryptographic key, so both must keep it secret. The key had to be shared safely before use, for example through a secure channel. This becomes hard when many people take part, when no secure channel is available, or when keys are changed often. If messages must be kept from other users, each pair of users needs its own key. In a public-key system, the public keys can be shared widely, and only the matching private keys are kept secret.
The two best-known types are digital signature and public-key encryption. In a digital signature system, a sender uses a private key to make a signature for a message. Anyone with the public key can check the signature, but a forger without the private key cannot create one that passes the check. In public-key encryption, anyone with the public key can scramble a message, but only the person with the private key can unscramble it. Public-key cryptography is used for TLS on web servers, digital cash, password-authenticated key agreement, email with OpenPGP or S/MIME, time-stamping services, and non-repudiation. A key issue is proving that a public key really belongs to the right person. One approach is a public key infrastructure, where certificate authorities confirm ownership. Another is a web of trust, which uses personal endorsements, along with the domain name system. DKIM also uses this approach.
Hybrid cryptosystems
Asymmetric key methods need much more computing work than symmetric ones. So it is common to use a public/private key-exchange algorithm to encrypt and share a symmetric key. That shared key is then used by symmetric-key cryptography to send data. PGP, SSH, and the SSL/TLS family of schemes all use this method, so they are called hybrid cryptosystems.
The first step, sharing a key with asymmetric cryptography, means the symmetric key does not have to be shared by hand, such as on printed paper or discs carried by a courier. For the rest of the connection, symmetric cryptography moves data faster than asymmetric cryptography would.
Weaknesses
Like all security systems, public-key cryptography has weak spots. The biggest risk is that a private key becomes known, because then all the messages and security checks protected by it are lost. Newer systems, such as recent TLS schemes, reduce this risk with forward secrecy, which creates temporary keys during each conversation. With quantum computing, many asymmetric key methods are considered open to attack, so new quantum-resistant methods are being developed. Advances in AI math have also led researchers to warn of a possible widespread threat. Some studies have found that when private key control is handed to trust service providers, as in Uruguay's system under Law 18.600, secrecy may weaken and the risk of man-in-the-middle attacks may grow.
Some methods can be attacked by trying every possible key, called a brute-force key search attack. This is impractical when the work needed is out of reach. Claude Shannon called this amount of work the work factor, and a longer key can often raise it. Faster special attacks exist against RSA and ElGamal encryption, but none are practical yet. Some once-promising methods, such as the "knapsack packing" algorithm, were found to be insecure. Attackers may also use side-channel attacks to learn from information that leaks out of a system. In a "man-in-the-middle" attack, a third party intercepts public keys and changes them, which is easier on insecure media. Sometimes an attacker can even reach messages through sniffing or an Internet service provider. A public key infrastructure (PKI) tries to prevent this with digital certificates, but it depends on trusted authorities that must check identities and revoke certificates when needed. Web browsers come with lists of trusted certificates. Even so, PKI is widely used. TLS and its predecessor SSL help secure most HTTPS websites. The security of the whole hierarchy of public key digital certificates matters too. Message headers can also reveal metadata about who is talking, although newer experimental systems try to hide it.
History
Long ago, people who wanted to send secret messages through history of cryptography had to share a key in a safe way, such as meeting face to face or using a trusted courier. Both people then had to keep the key secret. This made distributing keys difficult. In 1874, William Stanley Jevons described how a number like 8,616,460,799 could be hard to break apart, an idea linked to one-way functions, factorization, and a trapdoor function. In 1970, James H. Ellis, a British cryptographer at Government Communications Headquarters (GCHQ), thought of "non-secret encryption," now called public key cryptography, but could not see how to make it work. In 1973, his colleague Clifford Cocks created the RSA encryption algorithm. In 1974, Malcolm J. Williamson developed what is now known as Diffie–Hellman key exchange. The National Security Agency also received the idea. These discoveries stayed secret until the British government made them public in 1997.
In 1976, Whitfield Diffie and Martin Hellman, influenced by Ralph Merkle's work, published a way for people to agree on a shared key using exponentiation in a finite field. This became known as Diffie–Hellman key exchange, and it was the first published practical method for creating a shared secret key without sharing one first. Merkle's idea became known as Merkle's Puzzles. In 1977, Ron Rivest, Adi Shamir, and Leonard Adleman, all at MIT, invented a general version of Cocks's scheme. They published it in 1978 in Martin Gardner's column in Scientific American, and it became known as RSA, from their initials. Its security depends on the difficulty of factoring large integers. Since the 1970s, many other techniques have been developed, including the Rabin signature, ElGamal encryption, DSA, and ECC. Several countries have also created their own standards, including SM2 and SM9 in China, GOST R 34.10-2012 in Russia, EC-KCDSA in South Korea, and DSTU 4145 in Ukraine.
Examples
Here are some well-known examples of public-key methods used for different purposes:
- Diffie–Hellman key exchange protocol
- DSS (Digital Signature Standard), which incorporates the Digital Signature Algorithm
- ElGamal
- Elliptic-curve cryptography
- Elliptic Curve Digital Signature Algorithm (ECDSA)
- Elliptic-curve Diffie–Hellman (ECDH)
- Ed25519 and Ed448 (EdDSA)
- X25519 and X448 (ECDH/EdDH)
- Various password-authenticated key agreement techniques
- Paillier cryptosystem
- RSA encryption algorithm (PKCS#1)
- Cramer–Shoup cryptosystem
- YAK authenticated key agreement protocol
Some methods are not yet widely used:
- NTRUEncrypt cryptosystem
- Kyber
- McEliece cryptosystem
One well-known method is not safe:
These protocols use public-key methods:
- S/MIME
- GPG, an implementation of OpenPGP, and an Internet Standard
- EMV, EMV Certificate Authority
- IPsec
- PGP
- ZRTP, a secure VoIP protocol
- Transport Layer Security standardized by IETF and its predecessor Secure Socket Layer
- SILC
- SSH
- Bitcoin
- Off-the-Record Messaging
- SM2 (China, elliptic curve)
- SM9 (China, identity-based)
- GOST R 34.10-2012 (Russia, elliptic curve signatures)
- EC-KCDSA (South Korea, elliptic curve signatures)
- DSTU 4145 (Ukraine, elliptic curve)
Keep exploring
This article is a child-friendly adaptation of the Wikipedia article on Public-key cryptography, available under CC BY-SA 4.0.
Images from Wikimedia Commons. Tap any image to view credits and license.
