QA
Beginner LevelWeb Security & Cyber Defense

What is the difference between Symmetric Encryption (AES) and Asymmetric Encryption (RSA/ECC)?

❓ Interview Prompt: Compare Symmetric Encryption (shared key, AES-256, fast bulk data) vs Asymmetric Encryption (public/private key pair, RSA/ECC, key exchange).

Encryption protects data confidentiality by transforming plaintext into ciphertext:

| Feature | Symmetric Encryption (AES-256-GCM) | Asymmetric Encryption (RSA / ECC) |

|---|---|---|

| Keys | Single shared secret key for encryption & decryption | Public Key (encrypts) + Private Key (decrypts) |

| Speed | Extremely fast (hardware SIMD accelerated) | Slower (computationally expensive math) |

| Use Case | Bulk data storage encryption & TLS payload session stream | Key exchange, digital signatures, JWT signing |

| Key Sharing | Key must be shared securely beforehand | Public key shared freely; Private key kept secret |

Code Implementation Example

typescript
import crypto from 'crypto';

// Symmetric AES-256-GCM Encryption
const key = crypto.randomBytes(32);
const iv = crypto.randomBytes(12);
const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);
let encrypted = cipher.update('Sensitive Payload', 'utf8', 'hex');
encrypted += cipher.final('hex');
const authTag = cipher.getAuthTag().toString('hex');
💡Encrypting data with symmetric AES-256-GCM in Node.js.
🎯 Interview Key Takeaway

Symmetric encryption (AES) uses one shared key for fast bulk data; asymmetric (RSA/ECC) uses public/private key pairs for key exchange.

#Cryptography#AES#RSA#Symmetric vs Asymmetric#Beginner
Back to all Web Security & Cyber Defense Questions→

More Web Security & Cyber Defense Interview Questions

Beginner LevelSecurity & Web Security

Explain OWASP Top 10 vulnerabilities (XSS, CSRF, SQL Injection) and their defenses.

Beginner LevelSecurity & Web Security

What are the 3 types of XSS (Stored, Reflected, DOM-based) and how do they differ?

Beginner LevelSecurity & Web Security

How do Parameterized Queries (Prepared Statements) prevent SQL Injection attacks?