Fatskills
Practice. Master. Repeat.
Study Guide: Principles of Information Security: Asymmetric Encryption (RSA, ECC, Diffie‑Hellman)
Source: https://www.fatskills.com/information-security/chapter/information-security-asymmetric-encryption-rsa-ecc-diffiehellman

Principles of Information Security: Asymmetric Encryption (RSA, ECC, Diffie‑Hellman)

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~7 min read

Asymmetric Encryption (RSA, ECC, Diffie‑Hellman)


Asymmetric Encryption (RSA, ECC, Diffie-Hellman) – Exam-Ready Study Guide



What This Is

Asymmetric encryption (also called public-key cryptography) uses two mathematically linked keys—a public key (shared openly) and a private key (kept secret)—to secure data, verify identities, and establish secure communications. Unlike symmetric encryption (which uses the same key for encryption/decryption), asymmetric encryption solves the key distribution problem and enables digital signatures, secure key exchange, and authentication.

Why it matters:
- Real-world incident: In 2014, the Heartbleed bug (CVE-2014-0160) exploited a flaw in OpenSSL’s implementation of the Diffie-Hellman key exchange, allowing attackers to steal private keys, passwords, and session cookies from vulnerable servers. This led to widespread breaches, including the compromise of Canada Revenue Agency’s tax data (900+ Social Insurance Numbers stolen).
- Everyday use: Asymmetric encryption secures HTTPS (TLS/SSL), VPNs, SSH, PGP/GPG email encryption, and blockchain transactions.


Key Terms & Concepts

  • Asymmetric Encryption: A cryptographic system using public/private key pairs (e.g., RSA, ECC). The public key encrypts data; the private key decrypts it. Slower than symmetric encryption but enables secure key exchange and digital signatures.
  • Standards: NIST SP 800-56 (Recommendation for Pair-Wise Key Establishment), FIPS 186-5 (Digital Signature Standard).

  • RSA (Rivest-Shamir-Adleman): The most widely used asymmetric algorithm, based on the mathematical difficulty of factoring large prime numbers. Key sizes: 2048-bit (minimum secure), 3072-bit (recommended), 4096-bit (future-proof).

  • Tools: OpenSSL (openssl genrsa -out private.key 2048), GPG (gpg --gen-key).

  • ECC (Elliptic Curve Cryptography): Uses elliptic curve mathematics over finite fields for stronger security with smaller keys (e.g., 256-bit ECC ≈ 3072-bit RSA). Faster and more efficient for mobile/IoT devices.

  • Standards: NIST SP 800-186 (Recommended Elliptic Curves), NSA Suite B (deprecated in favor of CNSA).
  • Curves: secp256r1 (NIST P-256), Curve25519 (used in Signal, SSH), secp384r1 (NIST P-384).

  • Diffie-Hellman (DH) / ECDH (Elliptic Curve DH): A key exchange protocol that allows two parties to securely derive a shared secret over an insecure channel (e.g., the internet). DH uses modular arithmetic; ECDH uses elliptic curves.

  • Attack example: Logjam (CVE-2015-4000) – Weak DH parameters (e.g., 512-bit) were downgraded to export-grade cryptography, allowing MITM attacks.
  • Tools: OpenSSL (openssl dhparam -out dhparams.pem 2048), WireGuard (uses Curve25519 for key exchange).

  • Digital Signature: A cryptographic proof that a message was created by a known sender (authentication) and not altered (integrity). Uses the sender’s private key to sign and the public key to verify.

  • Standards: DSA (Digital Signature Algorithm), ECDSA (Elliptic Curve DSA), EdDSA (Edwards-curve DSA, e.g., Ed25519).
  • Real-world use: Code signing (e.g., Microsoft Authenticode), TLS certificates, Bitcoin transactions.

  • PKI (Public Key Infrastructure): A framework for issuing, managing, and revoking digital certificates (e.g., X.509). Includes CAs (Certificate Authorities), RAs (Registration Authorities), CRLs (Certificate Revocation Lists), and OCSP (Online Certificate Status Protocol).

  • Tools: OpenSSL, Microsoft Active Directory Certificate Services (AD CS), Let’s Encrypt.

  • Forward Secrecy (PFS): A property where compromising a long-term private key does not compromise past session keys. Achieved using ephemeral keys (e.g., ECDHE in TLS).

  • Example: TLS 1.3 enforces PFS by default (no static RSA key exchange).

  • Hybrid Encryption: Combines asymmetric + symmetric encryption for efficiency. Example:

  • Asymmetric: Encrypt a symmetric key (e.g., AES-256) with the recipient’s public key.
  • Symmetric: Encrypt the actual data with the symmetric key.
  • Used in: PGP, TLS, Signal Protocol.

  • Man-in-the-Middle (MITM) Attack: An attacker intercepts and alters communications between two parties. Asymmetric encryption prevents MITM if public keys are trusted (e.g., via PKI).

  • Defense: Certificate pinning (HPKP), TOFU (Trust On First Use, e.g., SSH), DNSSEC.

  • Quantum Computing Threat: Shor’s algorithm can break RSA and ECC by efficiently factoring large numbers or solving discrete logarithms. Post-quantum cryptography (PQC) (e.g., Kyber, Dilithium) is being standardized by NIST.

  • NIST PQC Standards: NIST PQC Project.

  • Key Escrow: A system where a third party holds copies of private keys (e.g., for law enforcement access). Controversial due to privacy risks (e.g., Clipper Chip, NSA’s PRISM).

  • Alternative: Key splitting (Shamir’s Secret Sharing).


Step-by-Step / Process Flow


How to Implement Asymmetric Encryption in a Real-World Scenario

Scenario: Securing a web application with HTTPS (TLS 1.3).


  1. Generate a Key Pair
  2. Use OpenSSL to create an RSA or ECC key pair:
    ```bash
    # RSA 2048-bit
    openssl genpkey -algorithm RSA -out private.key -pkeyopt rsa_keygen_bits:2048

    # ECC (Curve25519) openssl genpkey -algorithm EC -out private.key -pkeyopt ec_paramgen_curve:prime256v1 ```
    - Best practice: Use ECC (e.g., secp256r1 or Curve25519) for better performance.

  3. Create a Certificate Signing Request (CSR)

  4. Generate a CSR to submit to a CA (Certificate Authority):
    bash
    openssl req -new -key private.key -out request.csr -subj "/CN=example.com"
  5. Exam tip: The CN (Common Name) must match the domain name (e.g., example.com).

  6. Obtain a Digital Certificate from a CA

  7. Submit the CSR to a trusted CA (e.g., Let’s Encrypt, DigiCert) to get a signed certificate (e.g., certificate.crt).
  8. Free option: Use Let’s Encrypt with Certbot:
    bash
    certbot certonly --webroot -w /var/www/html -d example.com

  9. Configure TLS on the Web Server

  10. Install the certificate and private key on the server (e.g., Apache/Nginx).
  11. Example (Nginx):
    nginx
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_protocols TLSv1.3 TLSv1.2;
    ssl_ciphers 'TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES256-GCM-SHA384';
  12. Best practice: Enforce TLS 1.2+, disable weak ciphers (e.g., RC4, DES, 3DES), and enable HSTS (HTTP Strict Transport Security).

  13. Enable Forward Secrecy (PFS)

  14. Use ephemeral key exchange (e.g., ECDHE in TLS 1.3) to ensure session keys are not compromised if the private key is leaked.
  15. Example cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384.

  16. Monitor and Rotate Keys

  17. Key rotation: Replace keys/certificates periodically (e.g., every 1-2 years).
  18. Certificate revocation: Use OCSP stapling to check revocation status in real time.
  19. Tools: OpenSSL (openssl ocsp), Qualys SSL Labs (for testing).

Common Mistakes

Mistake Correction
Using RSA 1024-bit keys RSA 1024-bit is broken (NIST deprecated it in 2013). Use 2048-bit (minimum) or 3072/4096-bit.
Reusing the same key pair for encryption and signing Never reuse keys for different purposes (e.g., TLS encryption vs. code signing). Use separate key pairs to limit exposure.
Ignoring key expiration Certificates and keys must expire (e.g., 1-2 years for TLS). Use automated renewal (e.g., Certbot).
Storing private keys in plaintext Private keys should be encrypted with a passphrase (e.g., openssl rsa -in private.key -out encrypted.key -aes256) and stored in a HSM (Hardware Security Module) or secure key vault (e.g., AWS KMS, HashiCorp Vault).
Assuming all ECC curves are equal Avoid weak curves (e.g., NIST P-256 is secure; avoid NSA’s Dual_EC_DRBG backdoor). Prefer Curve25519 or secp384r1.


Certification Exam Tips


CISSP

  • Management vs. Technical: CISSP focuses on risk management, PKI governance, and compliance (e.g., "Which PKI component ensures non-repudiation?"). Know CAs, RAs, CRLs, and OCSP.
  • Key Sizes & Algorithms: Memorize minimum secure key sizes (e.g., RSA 2048-bit, ECC 256-bit) and NIST/FIPS standards.
  • Quantum Threat: Expect questions on post-quantum cryptography (PQC) and Shor’s algorithm.

Security+

  • Acronyms & Definitions: Know RSA, ECC, DH, ECDH, DSA, ECDSA, PKI, CA, CSR, CRL, OCSP.
  • TLS/SSL: Understand handshake process, cipher suites, and forward secrecy.
  • Attack Scenarios: Be ready for MITM, downgrade attacks (e.g., POODLE), and Heartbleed.

CEH

  • Practical Attacks: Know how to exploit weak implementations (e.g., Logjam, ROBOT attack on RSA PKCS#1 v1.5).
  • Tools: Be familiar with OpenSSL, Wireshark (for TLS inspection), and John the Ripper (for cracking weak keys).
  • Key Recovery: Understand side-channel attacks (e.g., timing attacks, power analysis) on RSA/ECC.


Quick Check Questions

  1. A company wants to secure email communications between employees. Which asymmetric encryption method is most suitable for digital signatures in this scenario?
  2. A) AES-256
  3. B) RSA-2048 with SHA-256
  4. C) Diffie-Hellman
  5. D) 3DES
    ✅ Correct Answer: B
    Explanation: RSA with SHA-256 is commonly used for digital signatures (authentication + integrity). AES/3DES are symmetric, and DH is for key exchange.

  6. During a TLS handshake, a server and client negotiate a cipher suite using ECDHE_ECDSA_WITH_AES_256_GCM_SHA384. What security property does this provide?

  7. A) Confidentiality only
  8. B) Confidentiality and integrity
  9. C) Forward secrecy and authentication
  10. D) Non-repudiation
    ✅ Correct Answer: C
    Explanation: ECDHE provides forward secrecy (ephemeral keys), and ECDSA provides authentication (digital signature). AES-GCM provides confidentiality + integrity, but the question focuses on the key exchange/signature.

  11. An attacker intercepts a Diffie-Hellman key exchange and forces the use of weak 512-bit parameters. Which attack is this?

  12. A) Heartbleed
  13. B) Logjam
  14. C) POODLE
  15. D) BEAST
    ✅ Correct Answer: B
    Explanation: Logjam exploits weak DH parameters (e.g., 512-bit) by downgrading to export-grade cryptography.

Last-Minute Cram Sheet

  1. RSA: Factoring large primes; 2048-bit minimum, 3072-bit recommended.
  2. ECC: Elliptic curves; 256-bit ECC ≈ 3072-bit RSA (faster, better for mobile).
  3. Diffie-Hellman (DH): Key exchange; ECDH (elliptic curve variant) is preferred.
  4. Digital Signature: DSA, ECDSA, EdDSA (Ed25519 is fastest).
  5. PKI Components: CA (issues certs), RA (verifies identity), CRL/OCSP (revocation).
  6. Forward Secrecy (PFS): Ephemeral keys (ECDHE) prevent past session decryption.
  7. TLS 1.3: Mandates PFS, removes weak ciphers (e.g., RSA key exchange).
  8. Quantum Threat: Shor’s algorithm breaks RSA/ECC; NIST PQC (Kyber, Dilithium) is the future.
  9. ⚠️ Common Trap: RSA 1024-bit is insecure (NIST deprecated in 2013).
  10. ⚠️ Common Trap: ECC is not always secure—avoid weak curves (e.g., Dual_EC_DRBG).


ADVERTISEMENT