Public and Private Keys: How Encryption and Signatures Work
Public-key cryptography uses a mathematically related pair: the public key can be distributed for encryption or verification, while the private key must remain controlled because it can decrypt, sign or establish secrets depending on the algorithm.
Timeline
- Generate: A trusted cryptographic implementation creates a related public and private key pair for a defined algorithm and purpose.
- Distribute and verify: Share the public key through a certificate or another authenticated channel while keeping the private key secret.
- Protect and rotate: Store the private key in an appropriate protected system and revoke or replace credentials if compromise is suspected.
Public-key, or asymmetric, cryptography uses two related keys. NIST defines the public part as shareable and the private part as secret; deriving the private key from the public key should be computationally infeasible for an approved system. What each key does depends on the algorithm. A key pair may support encryption and decryption, signature generation and verification, or an agreement process that lets parties derive a shared secret. [1][2]
For confidentiality, a sender can use the recipient's authenticated public key so that only the holder of the corresponding private key can recover the protected information. In deployed systems, public-key operations commonly establish or protect a temporary symmetric session key, while faster symmetric encryption carries the bulk data. The simple phrase 'encrypt with the public key' is therefore a useful model, but not a complete description of every protocol. [1][2][3]
Digital signatures reverse the purpose, not merely the arrows in an encryption diagram. The signer uses a private signing key to create a signature, and others use the public key to verify it. NIST says signatures can detect unauthorized modification and authenticate the claimed signatory. They do not conceal the signed data. It is more accurate to discuss signature algorithms directly than to say a document was 'encrypted with a private key.' [2][4]
A public key is useful only when a recipient knows whose key it is. A public-key certificate binds an identifier and public key through a certification authority's signature and includes information such as a validity period. Other systems use fingerprints, safety numbers or a trusted directory. If an attacker substitutes a different public key before verification, strong cryptography can still create a secure connection to the wrong party. [3][5]
The private key must remain under the authorized holder's control. Depending on its role, theft can let an attacker impersonate the owner, decrypt protected keys or participate in key agreement. Suitable protection may include an operating-system key store, hardware security module, security key, access controls and reliable recovery planning. Never paste a private key or seed phrase into an unsolicited form, message or support conversation. [2][3]
Different keys should have defined purposes and lifetimes. Certificates expire, systems rotate keys, and compromised credentials may need revocation. A backup can prevent permanent loss of an encryption key, but copying private material also creates another place to defend. Signature keys may deliberately avoid escrow because an extra copy could enable impersonation. Follow the product or organization's key-management policy rather than inventing a manual storage scheme. [3][4][5]
For users, the visible lesson is to verify public-key identity and guard private-key control. Check certificate warnings instead of bypassing them, compare fingerprints for sensitive exchanges, protect security keys and recovery codes, and respond quickly to loss. Public-key cryptography provides powerful building blocks, but a protocol must also choose sound algorithms, validate certificates or identities, generate keys securely and protect the endpoints where plaintext is used. [1][3][4][5]
Sources
- National Institute of Standards and Technology — Public-Key Cryptography Glossary
- National Institute of Standards and Technology — Private Key Glossary
- National Institute of Standards and Technology — Recommendation for Key Management, Part 1
- National Institute of Standards and Technology — Digital Signature Standard
- National Institute of Standards and Technology — Public Key Certificate Glossary