Application 2026-06-25 โฑ 4 min read

Three Uses of a Public Key: Signing, Encryption, and Key Exchange

A public key has just three uses: signing, encryption, and key exchange. This article sorts real-world applications such as SSH public-key auth, WebAuthn, mTLS, private_key_jwt, code signing, and container signing into these three, and clarifies how they differ from shared-key schemes such as HMAC, with primary sources.

Read in: ja
Three Uses of a Public Key: Signing, Encryption, and Key Exchange

Introduction

Modern authentication and security, including HTTPS, SSH, JWT, and passkeys, rest on public-key cryptography.

These technologies look scattered, yet through one lens, the use of a public key (a key pair), they reduce to three:

Almost every application combines these three. This article sorts real technologies into the three.

The series runs as follows, and this article is the practical part.

It surveys applications by use.

The Three Uses of a Public Key

Here is the overview.

Use Operation What it protects
Signing the private key signs, the public key verifies authenticity, authentication, tamper detection
Encryption the public key encrypts, the private key decrypts confidentiality
Key exchange exchange public values to derive a symmetric key safe sharing of a symmetric key

Signing and encryption run the keys in opposite directions, as the fundamentals article explained.

Next, we walk through applications use by use.

Signing: Authenticity and Authentication

Signing has the widest reach.

Only the holder of the private key signs, and anyone with the public key verifies. This asymmetry serves authentication, authenticity, and tamper detection.

The table sorts common applications by signer (private-key side) and verifier (public-key side).

Pattern Signer (private key) Verifier (public key) Main use
SSH public-key auth client server (authorized_keys) remote login
WebAuthn / passkeys user device service (RP) passwordless auth
mTLS both client and server the peer M2M mutual auth
private_key_jwt client authorization server OAuth client auth
service-account JWT workload IdP / token endpoint M2M token retrieval
SAML / OIDC IdP signature IdP SP / RP federation
code signing publisher OS / user tamper detection
container signing (cosign) publisher deploy side supply-chain protection
Git commit/tag signing committer reviewer / GitHub authenticity
crypto wallet owner the network transaction signing

Each follows the same shape: the private key signs, the public key verifies.

For example, SSH public-key auth has the client sign with its private key, and the server verify with the public key in authorized_keys.

OAuth's private_key_jwt works the same way. The client signs a JWT with its private key, and the authorization server verifies it with a registered public key. This beats sending a client_secret.

Encryption: Confidentiality

The public key encrypts, and the private key decrypts. This mirrors signing.

Because anyone uses the public key, you craft a message that only the holder of the private key reads.

Common applications:

Communication rarely uses encryption directly, though. Public-key operations run slow, so a key exchange derives a symmetric key, and symmetric encryption carries the payload. Encryption shines for stored data or asynchronous messages, where the parties cannot exchange keys in real time.

Key Exchange: Sharing a Symmetric Key Safely

Rather than send the symmetric key, both sides exchange public values and derive the same symmetric key locally.

Diffie-Hellman (DH) and its elliptic-curve form ECDHE handle this. The Key Exchange and PKI article covers the mechanism.

Common applications:

Communication uses key exchange rather than encryption for forward secrecy. A throwaway key per connection keeps past traffic safe even after a later key leak.

The Foundation of Trust: PKI

All three uses assume the peer's public key is genuine.

PKI guarantees that assumption. A Certificate Authority (CA) issues a certificate that signs the statement "this public key belongs to this subject."

PKI itself applies signing. The Key Exchange and PKI article covers it.

A Caution: What Is Not Public-Key Cryptography

Finally, note the shared-key schemes that people confuse with public-key cryptography.

The following use a shared secret key between sender and receiver, not a key pair:

People call these "signatures" too, but whoever holds the key forges the same value. That breaks the asymmetry of a public-key signature.

A JWT's alg tells them apart:

Summary

A public key (a key pair) has, at its core, three uses:

From SSH and WebAuthn to mTLS, JWT, code signing, and crypto wallets, applications read as combinations of these three. When you meet a new technology, ask what the private key does and what the public key verifies, and the structure appears.

References

Tags: Public Key Cryptography Digital Signature Authentication Security JWT WebAuthn OAuth PKI
Share: ๐• Post Facebook Hatena
โœ๏ธ View source / Discuss on GitHub
โ˜• Support

If you enjoy this blog, consider supporting it. Every bit helps keep it running!


Related Articles