Understand symmetric and asymmetric encryption methods

IGCSE Computer Science (0478) – Complete Revision Notes

1. Computer Systems (Topics 1‑6)

Assessment ObjectiveWhat the section covers
AO1Recall of facts, terminology and concepts (e.g., binary arithmetic, hardware components).
AO2Application of knowledge to solve problems (e.g., converting numbers, calculating file sizes, analysing packet structures).
AO3Analysis, design and evaluation (e.g., comparing storage types, choosing error‑detection methods, evaluating security measures).

1.1 Number Systems & Binary Arithmetic

  • Bases: binary (base‑2), decimal (base‑10), hexadecimal (base‑16).
  • Conversions
    • Binary → Decimal: add 2ⁿ for each ‘1’ bit.
    • Decimal → Binary: divide by 2, record remainders (bottom‑up).
    • Binary ↔ Hexadecimal: group bits in sets of 4 (e.g., 1010₂ = A₁₆).
  • Two’s‑complement (signed integers)
    • Invert all bits, add 1 → negative representation.
    • Range for n‑bit word: –2ⁿ⁻¹ to 2ⁿ⁻¹ – 1.
    • Overflow detection: if the carry into the sign‑bit differs from the carry out, overflow has occurred.
  • Common operations – addition, subtraction, left/right shift (×2, ÷2).

1.2 Data Representation

Data typeTypical representationKey points
TextASCII (7 bits) or Unicode (UTF‑8/16)1 byte per ASCII character; Unicode can be 1–4 bytes.
ImagesBitmap – pixel matrix; colour depth (e.g., 24 bits = 8 bits per RGB channel)Size ≈ (width × height × bits per pixel)/8 bytes.
SoundPulse‑Code Modulation (PCM); sample rate × bit depthFile size = duration × sample‑rate × bit‑depth × channels ÷ 8.
VideoFrames per second × image size × colour depth (often compressed, e.g., H.264)Lossless vs lossy compression; key‑frame vs. inter‑frame.

1.3 Storage & File Sizes

  • Primary storage: RAM (volatile), cache (very fast, sits between CPU & RAM).
  • Secondary storage: HDD, SSD, optical disc, magnetic tape (non‑volatile).
  • Binary prefixes: 1 KB = 2¹⁰ bytes, 1 MB = 2²⁰ bytes, 1 GB = 2³⁰ bytes, etc.
  • Example calculation – 5‑minute stereo audio, 44.1 kHz, 16‑bit:
    Size = 5 min × 60 s × 44 100 samples × 16 bits × 2 channels ÷ 8 ≈ 105 MB

1.4 Data Transmission

  • Analogue vs. Digital: Analogue varies continuously; digital uses discrete voltage levels (0 or 1).
  • Key terms
    • Bandwidth – maximum theoretical data rate (bits s⁻¹).
    • Latency – time taken for a single bit to travel from source to destination.
    • Throughput – actual data rate achieved (affected by errors, congestion).
  • Packet structure (simplified)
    +----------+----------+----------+
    | Header   | Payload  | Trailer  |
    +----------+----------+----------+
    Header fields: source IP, dest IP, length, protocol, checksum
    Payload: user data (e.g., part of a file)
    Trailer: CRC or other error‑check code
            
  • Packet switching – data is divided into packets; each packet may travel a different route to the destination, allowing efficient use of network resources.
  • USB interface
    • Serial bus, up to 5 Gb s⁻¹ (USB 3.0).
    • Four wires: VBUS (+5 V), D‑, D+, GND.
    • Supports hot‑plugging and power delivery.
  • Error‑detection methods
    • Parity bit – detects an odd number of bit errors.
    • Checksum – sum of data words (used in TCP/UDP).
    • CRC (Cyclic Redundancy Check) – polynomial division; more robust than checksum.
    • ARQ (Automatic Repeat reQuest) – acknowledges received packets; on missing/erroneous ACK a timeout triggers retransmission (positive/negative ACK).

1.5 Hardware Overview

  • CPU – Control Unit, ALU, registers, clock (frequency in MHz/GHz).
  • Memory hierarchy – Registers → Cache → Main RAM → Secondary storage (speed ↓, capacity ↑).
  • I/O devices
    • Input: keyboard, mouse, scanner, microphone.
    • Output: monitor, printer, speaker, projector.
    • Storage: USB flash drive, external HDD/SSD.
  • Network hardware
    ComponentFunctionKey details
    NIC (Network Interface Card)Connects a computer to a network.Contains a MAC address (48‑bit unique identifier).
    RouterForwards packets between different networks; performs IP routing.Can perform NAT (Network Address Translation) to map private IPv4 addresses to a public address.
    SwitchConnects multiple devices within the same LAN; uses MAC addresses to forward frames.Operates at Layer 2 (Data Link).
    HubRepeats incoming signals to all ports; no address filtering.Obsolete – replaced by switches.
    ModemModulates/demodulates signals for transmission over telephone or cable lines.Provides Internet connectivity.
  • IP addressing
    VersionFormatNumber of addresses
    IPv44 octets (e.g., 192.168.1.5)≈ 4.3 billion
    IPv68 hex groups (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334)≈ 3.4 × 10³⁸

1.6 Software Overview

  • System software – Operating System (OS) manages hardware, provides a user interface, file system, and security services.
  • Application software – Word processors, web browsers, games, specialised programmes (e.g., CAD).
  • Utility programmes – Antivirus, backup, disk defragmenter, file compression.
  • Interrupts – Signals (hardware or software) that pause the CPU’s current task to service an event; after handling, execution resumes.

1.7 The Internet & World‑Wide Web

  • IP address – unique identifier for a device on a network (IPv4/IPv6).
  • Domain Name System (DNS) – translates human‑readable domain names to IP addresses.
  • URL structureprotocol://host[:port]/path?query#fragment
  • HTTP vs. HTTPS
    • HTTP (port 80) – unencrypted.
    • HTTPS (port 443) – uses TLS/SSL to encrypt the connection.
  • Cookies – small data files stored on the client; used for session management, preferences, tracking.
  • Firewalls – filter traffic based on rules (IP, port, protocol); can be hardware‑ or software‑based.
  • Cyber‑security threats & counter‑measures
    ThreatTypical defence
    Malware (virus, worm, trojan)Antivirus, regular updates, sandboxing.
    PhishingEmail filtering, user education, two‑factor authentication.
    DDoS attackNetwork‑level filtering, rate‑limiting, CDN services.
    Unauthorised accessStrong passwords, account lockout, encryption.
    Data interceptionUse of HTTPS/TLS, VPNs, end‑to‑end encryption.

1.8 Automated & Emerging Technologies

  • Sensors & Actuators – convert physical quantities to digital signals (sensors) and vice‑versa (actuators).
  • Robotics – combine sensors, actuators, control algorithms and often AI for autonomous behaviour.
  • Artificial Intelligence (AI) – machine learning, expert systems, natural language processing.
  • Internet of Things (IoT)
    • Networked everyday objects (smart thermostats, wearables, connected cars).
    • Typically use low‑power wireless protocols (Bluetooth Low Energy, Zigbee, LoRa).
  • 3‑D printing – additive manufacturing; builds objects layer‑by‑layer from digital models (STL files).
  • Drones & autonomous vehicles – rely on GPS, sensors, and AI for navigation and obstacle avoidance.
  • Digital currency & blockchain
    • Digital currency (e.g., Bitcoin) exists only electronically; no physical notes or coins.
    • Blockchain – a distributed ledger of blocks; each block contains a list of transactions and the hash of the previous block, providing immutability and decentralised trust.

2. Algorithms, Programming & Logic (Topics 7‑10)

Assessment ObjectiveCoverage
AO1Terminology (algorithm, flowchart, pseudocode, array, file handling, Boolean logic).
AO2Applying concepts to write/trace algorithms, convert between flowchart and pseudocode, use data structures.
AO3Testing, debugging, evaluating algorithm efficiency, choosing appropriate data structures.

2.1 Algorithm Design

  • Flowchart symbols
    • Start/Stop – oval.
    • Process – rectangle.
    • Decision – diamond.
    • Input/Output – parallelogram.
    • Connector – small circle (used to avoid crossing lines).
  • Pseudocode conventions
    • Keywords in CAPITAL letters (IF, WHILE, FOR, END IF).
    • Indentation shows nesting.
    • Comments preceded by // or #.
  • Trace tables – record variable values after each step to verify correctness.

2.2 Basic Programming Concepts

ConceptDescriptionExample (Python‑like pseudocode)
Variables & Data TypesStore values; common types: integer, real, character, string, Boolean.age = 15
Input / OutputRead from keyboard, display on screen.name = input("Enter name: ")print("Hello", name)
SelectionIF…ELSE decision making.IF score >= 50 THEN grade = "Pass"ELSE grade = "Fail"END IF
RepetitionLOOP structures – WHILE, FOR.sum = 0FOR i FROM 1 TO 10 DO sum = sum + iEND FOR
ArraysOrdered collection of same‑type items; indexed from 0 or 1 depending on language.marks = [78, 85, 62, 90, 71]
File handlingOPEN, READ/WRITE, CLOSE.file = open("data.txt","r")line = file.readline()file.close()

2.3 Standard Algorithms

  • Totalling / Averaging – loop through list, accumulate sum, divide by count.
  • Counting / Min‑Max – initialise counters/min‑max, update while scanning.
  • Search
    • Linear search – compare each element (unsorted data).
    • Binary search – repeatedly halve the range (sorted data); O(log n) time.
  • Sort (simple)
    • Bubble sort – repeatedly swap adjacent out‑of‑order items; O(n²) worst‑case.
    • Selection sort – repeatedly select the smallest remaining element.

2.4 Testing, Validation & Debugging

  • Validation checks – range checks, type checks, sentinel values (e.g., -1 to end input).
  • Test data selection
    • Normal cases – typical expected values.
    • Boundary cases – values at the limits of allowed ranges.
    • Extreme cases – far beyond normal limits.
    • Error‑inducing inputs – non‑numeric where numbers are expected.
  • Debugging strategies
    • Print/trace statements.
    • Step‑through execution (IDE debugger).
    • Binary search for faults – isolate the part of code causing the error by repeatedly halving the program.

2.5 Databases (Single‑Table Design)

  • Fields (columns) & Records (rows).
  • Primary key – unique identifier (e.g., StudentID).
  • Basic SQL statements
    SELECT Name, Age FROM Students WHERE Age > 15;
    INSERT INTO Students (StudentID, Name, Age) VALUES (101, 'Ali', 14);
    UPDATE Students SET Age = 15 WHERE StudentID = 101;
    DELETE FROM Students WHERE StudentID = 101;
            

2.6 Boolean Logic & Digital Circuits

GateSymbolTruth Table
AND1 & 1 → 1; otherwise 0
OR0 | 0 → 0; otherwise 1
NOT¬0 → 1; 1 → 0
NANDinverse of AND
NORinverse of OR
XOR1 when inputs differ
  • Boolean expression simplification – use algebraic rules (identity, null, idempotent, complement) and De Morgan’s laws.
  • Combinational circuits – output depends only on current inputs (e.g., adders, multiplexers).
  • Sequential circuits – contain memory elements (flip‑flops); output depends on current inputs **and** previous states (e.g., counters, registers).

3. Encryption – Symmetric & Asymmetric Methods

Assessment ObjectiveFocus
AO1Define encryption, key, plaintext, ciphertext; distinguish symmetric vs. asymmetric.
AO2Apply algorithms (AES, RSA) to simple numeric examples; explain key‑distribution mechanisms.
AO3Evaluate strengths/weaknesses, choose appropriate method for a given scenario, discuss security implications.

3.1 Symmetric Encryption

  • Principle – the same secret key (K) encrypts and decrypts data.
    C = Encrypt_K(P)  P = Decrypt_K(C)
  • Key properties
    • Both sender and receiver must possess K and keep it confidential.
    • Key length determines security – longer keys are harder to brute‑force.
  • Common algorithms
    • DES – 56‑bit key, now considered insecure.
    • Triple‑DES – applies DES three times; effective key ≈ 112 bits.
    • Blowfish – variable key (32‑448 bits), fast software implementation.
    • RC4 – stream cipher, historically used in SSL/TLS (now deprecated).
    • AES (Advanced Encryption Standard) – block cipher, 128‑bit block size, key sizes 128, 192, 256 bits; current standard for most applications.
  • Advantages
    • Very fast – suitable for encrypting large files, disk volumes, VPN tunnels.
    • Simple to implement in both hardware and software.
  • Disadvantages
    • Key distribution problem – the secret key must be exchanged over a secure channel.
    • If the key is compromised, all data encrypted with it is exposed.
  • Numeric example – AES‑128 (simplified)
    1. Plaintext block (hex): 00112233445566778899AABBCCDDEEFF
    2. Key (hex, 128‑bit): 000102030405060708090A0B0C0D0E0F
    3. After the first round (AddRoundKey + SubBytes + ShiftRows + MixColumns) the ciphertext becomes 69C4E0D86A7B0430D8CDB78070B4C55A (actual AES uses 10 rounds; this is the final result).
    Note: In exams you will not be required to perform the full AES steps – just understand that the same key is used for both directions.

3.2 Asymmetric (Public‑Key) Encryption

  • Principle – each user has a mathematically linked key pair:
    K_pub  – public, shared openly
    K_priv – private, kept secret
    Encryption with one key can only be decrypted with the other.
  • Typical uses
    • Secure key exchange – send a symmetric key encrypted with the recipient’s public key.
    • Digital signatures – encrypt a hash of a message with the sender’s private key; anyone can verify with the public key.
  • Common algorithms
    • RSA – based on the difficulty of factoring large primes; key sizes 1024 bits (minimum) to 4096 bits.
    • Diffie‑Hellman – key‑exchange protocol; establishes a shared secret over an insecure channel.
    • ECC (Elliptic Curve Cryptography) – provides comparable security with shorter keys (e.g., 256‑bit ECC ≈ 3072‑bit RSA).
  • Advantages
    • Solves the key distribution problem – public keys can be distributed openly (e.g., via a certificate authority).
    • Provides non‑repudiation through digital signatures.
  • Disadvantages
    • Much slower than symmetric algorithms – unsuitable for encrypting large amounts of data directly.
    • Requires a trusted infrastructure (PKI) to verify public keys.
  • Numeric example – RSA (very small numbers for illustration)
    1. Choose two primes: p = 61, q = 53.
    2. Compute n = p × q = 3233 (modulus) and φ(n) = (p‑1)(q‑1) = 3120.
    3. Pick public exponent e = 17 (coprime to 3120).
    4. Find private exponent d such that e·d ≡ 1 (mod φ(n)). Here, d = 2753.
    5. Public key = (e, n) = (17, 3233); Private key = (d, n) = (2753, 3233).
    6. Encrypt message m = 65:
      C = m^e mod n = 65^17 mod 3233 = 2790
    7. Decrypt:
      m = C^d mod n = 2790^2753 mod 3233 = 65
    In real systems the numbers are hundreds of digits long, making brute‑force infeasible.

3.3 Hybrid Encryption in Practice

  • Because symmetric encryption is fast and asymmetric encryption solves the key‑distribution problem, most real‑world systems use a **hybrid** approach:
    1. Sender generates a random symmetric session key (e.g., AES‑256).
    2. Session key is encrypted with the receiver’s public key (RSA/ECC) and sent.
    3. Both parties then use the session key to encrypt/decrypt the actual data with a symmetric algorithm.
  • Examples: TLS/HTTPS, PGP email encryption, VPN protocols.

3.4 Evaluating Encryption Choices

ScenarioRecommended methodReasoning
Encrypting a 2 GB video file for storage on a USB driveAES‑256 (symmetric)Fast, strong security; key can be stored locally.
Sending a confidential email to a new business partnerRSA/ECC to encrypt a session key, then AES for the message (hybrid)Secure key exchange without prior shared secret.
Signing software updates to prove authenticityDigital signature using RSA/ECC private keyProvides non‑repudiation; public key can be published.
Protecting data on a public Wi‑Fi hotspotVPN using IPSec or TLS (uses both asymmetric and symmetric)Establishes a secure tunnel; protects all traffic.

3.5 Key Management & Security Practices

  • Never store private keys in plain text; use password‑protected keystores or hardware tokens.
  • Rotate symmetric keys regularly (e.g., every 90 days) to limit exposure.
  • Use strong, random key generation (cryptographically secure PRNG).
  • Maintain a Public Key Infrastructure (PKI) for certificate issuance and revocation.
  • Apply defence‑in‑depth: combine encryption with firewalls, intrusion detection, and regular updates.

Create an account or Login to take a Quiz

47 views
0 improvement suggestions

Log in to suggest improvements to this note.