0Pricing
Cyber Security Academy · Lesson

Asymmetric Encryption: RSA and Elliptic Curves

Understand public/private key pairs, how RSA works conceptually, and why ECC is more efficient.

Asymmetric Encryption: RSA and Elliptic Curves is a free Cyber Security Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cyber Security Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What is Asymmetric Encryption?

Asymmetric encryption uses a mathematically linked key pair: a public key (shared freely) and a private key (kept secret). Data encrypted with the public key can only be decrypted with the private key, and vice versa.

RSA: The Foundation

RSA (Rivest–Shamir–Adleman, 1977) is based on the difficulty of factoring large prime numbers. Security depends on key size: RSA-2048 is current minimum; RSA-4096 for high-security use. RSA is slower than symmetric encryption — used for key exchange, not bulk data.

RSA Key Generation

RSA key generation:

# Generate 4096-bit RSA key pair:
openssl genrsa -out private.pem 4096
openssl rsa -in private.pem -pubout -out public.pem

# View key details:
openssl rsa -in private.pem -text -noout

Elliptic Curve Cryptography (ECC)

ECC provides equivalent security to RSA with much smaller key sizes. A 256-bit ECC key is comparable to a 3072-bit RSA key. Smaller keys mean faster operations and less bandwidth — critical for TLS handshakes and mobile devices.

Common Elliptic Curves

Widely used curves:

  • P-256 (secp256r1) — NIST standard, used in TLS
  • X25519 — designed by Bernstein, efficient key exchange, no patent concerns
  • Ed25519 — EdDSA signature scheme, used in SSH keys

Hybrid Encryption

In practice, asymmetric and symmetric encryption are combined:

  1. Asymmetric: encrypt a random symmetric key with recipient's public key
  2. Symmetric: encrypt the actual data with that key

This is how TLS works: RSA/ECDH negotiates session keys; AES encrypts the session data.

Diffie-Hellman Key Exchange

Diffie-Hellman (DH) allows two parties to establish a shared secret over an insecure channel without exchanging a key. The shared secret is used to derive a symmetric session key. ECDH (Elliptic Curve DH) is the modern variant used in TLS 1.3.

Forward Secrecy

Perfect Forward Secrecy (PFS): each session uses ephemeral DH keys that are discarded after use. Even if the server's private key is later compromised, past recorded sessions cannot be decrypted. TLS 1.3 mandates PFS; look for ECDHE cipher suites in TLS 1.2.

RSA for Encryption vs Signing

RSA serves two purposes:

  • Encryption: encrypt with public key → only private key holder can decrypt
  • Signing: sign with private key → anyone with public key can verify authenticity

Use OAEP padding for encryption; PSS padding for signatures. Never use PKCS#1 v1.5 for encryption.

Post-Quantum Threat

Quantum computers running Shor's algorithm could break RSA and ECC. NIST is standardizing post-quantum cryptography algorithms (CRYSTALS-Kyber for key exchange, CRYSTALS-Dilithium for signatures). Migration will take years — start inventorying crypto-dependent systems now.

Key Management

Asymmetric keys require secure management: generate on trusted hardware, protect private keys with passphrase or HSM, rotate keys periodically, revoke compromised keys via CRL/OCSP. Lost private keys mean losing access to all encrypted data.

Quick Check: Asymmetric Encryption

Which approach combines asymmetric and symmetric encryption, using asymmetric to exchange a key and symmetric to encrypt data?

Lesson Recap

Asymmetric encryption uses public/private key pairs. RSA is proven but slow; ECC provides equivalent security with smaller keys. Hybrid encryption combines both for practical use. Diffie-Hellman enables secure key exchange; ECDHE provides forward secrecy. Quantum threats loom — watch NIST PQC standardization.

Frequently asked questions

Is the “Asymmetric Encryption: RSA and Elliptic Curves” lesson free?

Yes — the full text of “Asymmetric Encryption: RSA and Elliptic Curves” is free to read here on the web, and the Cyber Security Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cyber Security Academy course, upgrade to CoddyKit PRO.

What will I learn in “Asymmetric Encryption: RSA and Elliptic Curves”?

Understand public/private key pairs, how RSA works conceptually, and why ECC is more efficient. You practise Cyber Security Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cyber Security Academy?

No prior experience is required. Cyber Security Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Asymmetric Encryption: RSA and Elliptic Curves” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cyber Security Academy lesson?

Yes. Every Cyber Security Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Symmetric Encryption: AES and Stream Ciphers
  2. Asymmetric Encryption: RSA and Elliptic Curves
  3. Hash Functions: SHA-256 and Beyond
  4. Digital Signatures and Certificates
← Back to Cyber Security Academy