Skip to content
IT glossary
SecurityUpdated December 3, 2026

Public-key cryptography

Асимметричная криптография

A way to protect data using two related keys: a public key that can be shared and a private key that stays secret. Depending on the scheme, the pair can be used to encrypt messages, verify signatures, or establish a shared secret.

Also known as: RSA, публичный ключ

What makes it asymmetric?

Symmetric cryptography relies on a shared secret key. Public-key cryptography, also called asymmetric cryptography, gives each key pair two parts with different roles: a public key that can be distributed and a private key that must be protected. The keys are mathematically related, but recovering the private key from the public key is computationally infeasible when the scheme and its parameters are chosen correctly.

Three jobs, three different operations

  • Public-key encryption keeps data confidential. Anyone can encrypt a message using the recipient’s public key, but decrypting it requires the matching private key. Encryption alone does not identify the sender: anyone with the public key could have produced the ciphertext.
  • Digital signatures let others verify data. The signer uses a private key to create a signature. A verifier uses the corresponding public key to check that the signature matches the exact data. A signature does not hide the message, and it only tells you who signed it if you already trust the link between the public key and that signer.
  • Key agreement establishes a shared secret. In a scheme such as ephemeral Diffie–Hellman (ECDHE), both parties send public values and independently compute the same secret without sending it over the network. A protocol can derive symmetric keys from that secret. Key agreement by itself does not authenticate the parties.

RSA is not another name for public-key cryptography. It is the basis of distinct schemes such as RSA-OAEP for encryption and RSA-PSS for signatures. Other algorithms have different roles: Ed25519 is a signature scheme, not an encryption scheme.

Example: logging in with an SSH key

Suppose a server is configured to accept your public key for your account. During login, your SSH client signs data tied to that connection with your private key. The server checks the signature against the authorized public key. This proves possession of the private key without sending it to the server. The server’s own identity is a separate check: the client verifies the server’s host key. Neither of those authentication keys directly encrypts the session traffic.

Where it fits in real systems

In a typical TLS 1.3 connection, the browser validates the server’s certificate and checks a handshake signature. The client and server commonly use ephemeral key agreement to establish a shared secret, then protect application traffic with symmetric encryption. Hybrid file encryption follows the same division of labor: a symmetric key encrypts the file, and a public-key scheme protects that key for the recipient. Symmetric algorithms are better suited to protecting large amounts of data.

A public key can be shared, but it cannot simply be trusted because it arrived. Validate its identity through a trusted certificate chain, a fingerprint checked over a trusted channel, or another mechanism appropriate to the protocol. If you accept a substituted key, the cryptography may work perfectly while protecting data for the wrong party.

What interviewers ask

A common question is, “If HTTPS uses public-key cryptography, why does it also need symmetric keys?” Separate the jobs: public-key operations authenticate peers or help establish a secret, while symmetric operations protect bulk traffic efficiently. Another common trap is describing a signature as “encryption with the private key.” Signing and encryption are different operations, with different goals and security requirements.