SECURITY / A CONCEPT NOTE

Public-key Cryptography

the math behind SSH and TLS

~65 sec read

Overview · mechanism
pitfall · examples

01 / THE SHORT VERSION

The idea in a few sentences.

A cryptographic model using a public key (shareable) to encrypt data and a private key (secret) to decrypt it. Data encrypted with your public key can only be decrypted by your private key.

02 / FOLLOW THE MECHANISM

How asymmetric key crypto works

  1. Key pair generation

    user runs algorithm generating public and private key files.

  2. Encryption

    sender uses recipient's public key to encrypt a secret message.

  3. Decryption

    recipient uses their secret private key to decrypt the ciphertext back to plaintext.

04 / COMMAND NOTES

Read the command, then the result.

Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.

EXAMPLE 01 · REFERENCE

generate a secure public/private key pair

ssh-keygen -t rsa -b 4096

Explore command anatomy in the CLI lab