4 Public-Key Cryptography and Digital Signatures
Understand how public and private keys support encryption, key establishment, and digital signatures, and how authentication and careful key handling affect their security.
Public and private keys
Public-key cryptography, also called asymmetric cryptography, uses a mathematically related : a public key that may be shared and a private key that must be protected. Although the keys are related, deriving the private key from the public key should be computationally infeasible. Public-key algorithms support different operations, so a for signing is not automatically suitable for encryption or .
Encryption and
In public-key encryption, a sender encrypts information with the recipient’s public key, and the corresponding private key is needed to decrypt it. For example, if Alex wants to send Priya a confidential message, Alex uses Priya’s public encryption key and Priya decrypts it with her private key. This protects confidentiality only if Alex has Priya’s authentic public key and Priya keeps her private key secret.
Public-key operations are generally not used to encrypt large amounts of data directly. With , the sender creates a fresh symmetric key, encrypts the data with that key, and uses a public-key mechanism to protect or establish the symmetric key. The recipient obtains the symmetric key with a private-key operation and then decrypts the data. This combines the convenience of public-key techniques with the efficiency of symmetric encryption.
is the process by which parties obtain shared secret material for later cryptographic use. In , each party contributes information. For example, in Diffie–Hellman, each party creates a private value and shares a corresponding public value. Each combines their own private value with the other party’s public value to obtain the same shared secret.
Alice and Bob can, for example, exchange X25519 public values and independently compute the same shared secret; the secret itself is not sent over the network. A key-derivation function then turns the shared secret into keys suitable for symmetric encryption and .
In , by contrast, one party generates secret key material and securely sends it using the recipient’s public key or a .
Authenticating key exchange
A key exchange by itself does not prove who is on the other end. An attacker could intercept and replace unauthenticated public values, creating separate secrets with each participant. Protocols therefore authenticate the exchange, often with digital signatures and certificates.
Fresh, temporary key-agreement values can help limit the damage if a long-term key is later compromised.
Digital signatures
A is produced by a signer using a private signing key and is associated with a message. A verifier uses the corresponding public key and the message to check whether the signature is valid. Signature algorithms commonly incorporate hashing, so the signature is tied to the message’s contents; changing the message should cause verification to fail.
A valid signature supports —the signed data has not changed since it was signed—and : the signature was produced by someone controlling the corresponding private key. A signature does not encrypt the message, so anyone with access to the message and public key may be able to read it.
A valid signature alone does not establish the signer’s real-world identity. The verifier needs a trustworthy way to bind the public key to that identity, such as a valid certificate and a trusted certification path. Signatures can support evidence of origin, but claims of legal non-repudiation depend on surrounding procedures and context as well as the cryptography.
For example, a software publisher can sign a release. A user verifies the signature with the publisher’s trusted public key before installing it. Verification helps detect altered software and confirms that the signing key produced the signature; it does not conceal the software.
Safe key use
Keep private keys secret and limit who or what can use them. Use vetted protocols and implementations rather than designing a cryptographic scheme yourself. Verify public keys or certificates before relying on them, use algorithms and key sizes appropriate to current guidance, and replace or revoke keys when they are compromised or no longer trusted. Use keys only for their intended purpose.