Public-key cryptography

From Pulsed Media Wiki

Public-key cryptography

Public-key cryptography, also known as asymmetric cryptography, is a system of cryptography that uses pairs of mathematically related keys. Unlike symmetric-key cryptography, where the same secret key is used by both the sender and recipient for both encryption and decryption, public-key cryptography employs two different keys: a public key that can be shared openly with anyone, and a private key that must be kept secret by its owner.

This revolutionary concept, which emerged in the 1970s, solved a major challenge in traditional symmetric cryptography: the secure distribution of the secret key. Public-key cryptography allows parties who have no prior relationship or shared secrets to communicate securely over an insecure channel and verify each other's identities. Its primary uses are for ensuring confidentiality (making data unreadable to anyone except the intended recipient) and providing authentication and non-repudiation (verifying the sender's identity and the integrity of data, preventing the sender from denying they sent it) through the use of digital signatures.

Key Concepts

The foundation of public-key cryptography rests on the concept of the Key pair, a set of two mathematically linked keys that are generated together:

  • Public Key: This key is designed to be openly distributed. Anyone who wishes to send an encrypted message that only the key's owner can read, or verify a digital signature created by the owner, needs a copy of this key. In many practical applications, the public key is embedded within a Digital certificate issued by a trusted CA.
  • Private Key: This key must be kept absolutely secret and secure by its owner. It is mathematically linked to the corresponding public key but is computationally infeasible to derive from the public key. The private key is used to decrypt messages that were encrypted specifically with its paired public key, and to create digital signatures. Its security is paramount; if the private key is compromised, the security guarantees relying on that Key pair are broken.
  • Key pair: The set consisting of a public key and its corresponding private key. The mathematical relationship between them is such that operations performed with one key can only be reversed or verified by the other key in the pair.

How it Works

Public-key cryptography enables two fundamental secure operations based on the unique properties of the Key pair:

  • Encryption for Confidentiality (Ensuring Privacy):
   * If User A wants to send a confidential message to User B, User A first obtains User B's public key. This key is typically available publicly or provided by User B via a trusted channel, often within a Digital certificate.
   * User A then uses User B's public key and a public-key encryption algorithm (RSA, ECC, etc.) to transform the readable message (plaintext) into an unreadable form called Ciphertext. The algorithm is designed so that this encryption can only be effectively reversed by the corresponding private key.
   * User A sends the Ciphertext message to User B over any communication channel, whether secure or insecure.
   * User B receives the Ciphertext and uses their own secret private key and the same public-key encryption algorithm to decrypt the Ciphertext back into the original readable message (plaintext).
   * Because only User B possesses the unique private key corresponding to the public key used for encryption, only User B can successfully decrypt and read the message. This process ensures the confidentiality of the communication.
  • Digital Signatures for Authentication, Integrity, and Non-repudiation (Verifying Identity and Data):
   * If User A wants to send a message to User B and needs User B to verify that the message genuinely originated from User A and has not been altered since it was sent, User A first computes a cryptographic hash of the message content. This hash is a unique, fixed-size fingerprint of the message.
   * User A then uses their own secret private key and a digital signature algorithm (such as RSA's signing function or ECDSA for ECC) to "sign" this hash value, creating a digital signature. This signature is mathematically linked to the hash and the specific private key used.
   * User A sends the original message along with this digital signature to User B.
   * User B receives the message and the digital signature. User B independently computes a cryptographic hash of the received message using the same hash algorithm that User A used.
   * User B then uses User A's publicly available public key (obtained from a trusted source like a Digital certificate) and the corresponding digital signature algorithm's verification function to check if the received digital signature is valid for the hash that User B just computed from the message.
   * If the verification is successful, it mathematically confirms that the signature was created using the private key corresponding to the public key used for verification. Since only User A is supposed to possess that secret private key, User B is assured that the message originated from User A (authentication). Furthermore, if the message had been altered even slightly after User A signed it, the hash computed by User B would be different, causing the signature verification to fail. This failure confirms the message's integrity has been compromised. This successful verification process also provides non-repudiation; User A cannot credibly deny having signed the message later, as only their private key could have created a signature that verifies with their public key.

History

The fundamental concept of public-key cryptography was a significant breakthrough independently discovered by multiple parties in the 1970s. The first public description came from American cryptographers Whitfield Diffie and Martin Hellman in their 1976 paper, "New Directions in Cryptography." This paper introduced the core ideas of asymmetric cryptography and described the Diffie–Hellman key exchange protocol, which allowed two parties to securely establish a shared secret symmetric key over an insecure channel without any prior shared secrets.

Following this, in 1977, Ron Rivest, Adi Shamir, and Leonard Adleman at MIT developed the first widely practical public-key encryption and digital signature algorithm, known as RSA, based on the mathematical properties of factoring large prime numbers.

Later, it was revealed that similar concepts and equivalent algorithms had been developed earlier, in the late 1960s and early 1970s, by researchers working in secrecy at the British intelligence agency GCHQ, including James Ellis, Clifford Cocks, and Malcolm Williamson. However, this pioneering work remained classified for several decades and did not influence the public development of the field.

Common Algorithms

Several mathematical algorithms are used to implement public-key cryptography. These differ in their underlying mathematical problems, performance characteristics, and typical applications:

Applications

Public-key cryptography is a cornerstone of modern information security and is integral to numerous applications, particularly in networking and system administration:

  • Securing Web Traffic (HTTPS): The TLS (Transport Layer Security) protocol, which succeeded SSL, is used to secure communication between web browsers and web servers over the Internet, resulting in HTTPS. TLS uses public-key cryptography during the initial handshake to authenticate the server (using its Digital certificate signed by a Certificate Authority) and to securely exchange a secret symmetric session key. Once the symmetric key is established, the bulk of the data transfer is encrypted using a much faster symmetric algorithm like AES.
  • Secure Shell (SSH): SSH is a widely used protocol for secure remote command-line access to servers. While it supports password authentication, public-key authentication is considered more secure. Users generate a Key pair on their local machine, install the public key on the remote server, and then authenticate by proving possession of the local private key without transmitting it over the network.
  • VPNs: VPNs create secure, encrypted tunnels over public networks. Public-key cryptography is often used within VPN protocols (such as OpenVPN or WireGuard) for initial authentication of the endpoints and for the secure Key exchange needed to establish the encrypted tunnel's symmetric key.
  • Secure Email (PGP, S/MIME): Standards and software like PGP (Pretty Good Privacy) and S/MIME use public-key cryptography to provide end-to-end email security. They allow users to encrypt email content for confidentiality using the recipient's public key and digitally sign emails using their own private key to verify the sender's identity and the message's integrity.
  • Digital Signatures (Code Signing, Package Verification): Digital signatures are used to verify the authenticity and integrity of software code (known as Code signing), documents, and data files. System administrators frequently encounter these when verifying the integrity of downloaded software packages (e.g., checking package signatures for `.deb` or `.rpm` files using GPG) or confirming the source of a software update.
  • Cryptocurrencies: Public-key cryptography is a foundational technology for most cryptocurrencies, including Bitcoin. User wallets are essentially key pairs: the public key is used to generate a public address where funds can be received, and the private key is used to create digital signatures to authorize transactions (spending funds), proving ownership without revealing the private key.
  • API Security: Public-key cryptography can be used to secure API communications, for example, by requiring clients to sign requests to authenticate themselves or by using TLS to encrypt the channel over which API calls are made.

Advantages

Public-key cryptography offers significant advantages, particularly in distributed systems and open networks:

  • Secure Key exchange: It elegantly solves the problem of securely exchanging symmetric secret keys over insecure channels, which is a critical step in establishing secure communication sessions like TLS connections.
  • Authentication and Non-repudiation: The ability to create digital signatures provides strong methods for verifying the identity of a sender and ensuring data integrity, preventing a party from legitimately denying having sent or signed a piece of data.
  • Scalability of Key Management: For a group of N users who need to communicate securely, a symmetric system requires a unique secret key for every pair of users, leading to a large number of keys ($N \times (N-1)/2$). In a public-key system, each user only needs one Key pair, significantly simplifying key management in large networks, although managing trust in public keys through a PKI introduces its own complexity.

Disadvantages and Challenges

Despite its power, public-key cryptography also has drawbacks and faces ongoing challenges:

Relation to Symmetric Cryptography (Hybrid Cryptography)

Due to the significant performance difference between public-key and symmetric-key operations, they are almost always used together in practice within a hybrid cryptosystem. In this approach, public-key cryptography is used for the initial setup of a secure communication session: it authenticates the parties (especially servers via Digital certificates and digital signatures) and enables the secure exchange of a secret, single-use symmetric session key over an insecure channel (e.g., using Diffie–Hellman key exchange or RSA key transport). Once this symmetric key is securely established, the bulk of the actual data transfer for that session is encrypted and decrypted using the much faster symmetric algorithm (such as AES). This effectively combines the key establishment and authentication benefits of public-key cryptography with the speed and efficiency of symmetric encryption for data transfer.

See Also

References