Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Security in pervasive computing

Security in pervasive computing: definitions of security properties and adversary models, cryptographic and privacy controls adapted for resource-constrained, mobile, context-aware devices, with formulas and worked examples for brute-force, hash collisions and differential privacy.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Pervasive computing systems (smart environments, wearables, IoT) collect private data and act on the physical world. An engineer uses security principles to design authentication, confidentiality, integrity and privacy controls that work under severe constraints (battery, CPU, intermittent connectivity) while supporting context-aware services.

Key ideas

  • Integrity: the guarantee that data has not been altered by unauthorized parties. In practice, integrity for adversarial settings is provided by message authentication codes (MACs) or digital signatures; bare cryptographic hash functions alone do not provide authenticity.
  • Availability: the property that authorized users can access services when needed; threats include resource exhaustion (DoS) and wireless jamming.
  • Authentication: the process of ensuring an entity is who it claims to be; methods include passwords, symmetric-key challenge–response, public-key signatures.
  • Authorization and access control: deciding what an authenticated entity is allowed to do; models include RBAC (roles) and ABAC (attributes), enforced via access control lists or capability tokens.
  • Non-repudiation: preventing parties from denying actions (often via digital signatures).
  • Privacy: control over personal information; distinct from confidentiality because privacy includes data minimisation, purpose limitation and user consent.

Definitions and models (exact university-style statements):

  • Definition (Threat, Vulnerability, Risk): A threat is a potential cause of an unwanted incident; a vulnerability is a weakness that can be exploited by a threat; risk is the product of likelihood and impact under a chosen threat model.
  • Adversary model: Adversaries are classified as passive (only observe communications) or active (can inject/modify messages), insiders (have legitimate credentials) or outsiders, and computationally bounded (they cannot break primitives faster than exhaustive search given current resources). State assumptions explicitly in any derivation (e.g., adversary cannot factor 3072-bit RSA within assumed time). In pervasive settings, also consider device capture, physical tampering, and side-channel attacks.
  • Kerckhoffs's principle (precise statement): A cryptosystem should be secure even if everything about the system, except the key, is public knowledge.

Cryptographic building blocks (definitions):

  • Symmetric encryption: encryption where sender and receiver share the same secret key K; defined by two functions Enc_K(·) and Dec_K(·) with Dec_K(Enc_K(M)) = M.
  • Asymmetric (public-key) encryption: pair of keys (pk, sk) where pk is public, sk is private; Enc_pk(·) and Dec_sk(·) satisfy Dec_sk(Enc_pk(M)) = M.
  • Hash function: a deterministic function H: {0,1}* → {0,1}^k. A hash is collision-resistant if it is computationally infeasible to find distinct x,y with H(x)=H(y).
  • MAC (message authentication code): a short tag computed with a secret key to ensure message integrity and authenticity.

Pervasive-specific constraints and their security implications:

  • Devices are resource-constrained: low CPU, small memory, limited battery. Choose lightweight primitives (e.g., AES, ChaCha20, ECC rather than large RSA) and energy-efficient protocols (avoid heavy handshakes). Prefer AEAD modes (AES-CCM/AES-GCM, ChaCha20-Poly1305) to combine confidentiality and integrity efficiently.
  • Networks may be broadcast and wireless: adversary can eavesdrop or inject; always assume open-medium attacks and use link-layer security plus end-to-end crypto. Common choices include TLS/DTLS for transport or OSCORE/COSE/EDHOC for constrained IoT.
  • Mobility and context: keys and policies may need re-negotiation as devices join/leave contexts; design for secure, fast re-authentication (e.g., session resumption with short-lived keys). Also deploy secure boot, signed firmware updates, and (where supported) remote attestation to preserve device trust.

Privacy techniques (definitions and formal statement):

  • Anonymization: removing identifiers; often insufficient against linkage attacks.
  • k-anonymity: dataset satisfies k-anonymity if for every record there are at least k−1 other records indistinguishable on quasi-identifiers.
  • Differential privacy (DP) (exact definition): A randomized mechanism M gives ε-differential privacy if for all datasets D and D' differing in at most one record, and for all measurable subsets S of outputs, P[M(D) ∈ S] ≤ exp(ε) · P[M(D') ∈ S]. (Smaller ε means stronger privacy.)
  • Laplace mechanism (statement): To release a numeric query f with global sensitivity Δf, add noise drawn from Laplace(0, b) with b = Δf / ε to achieve ε-differential privacy.

Diagrams to draw (exam):

  • Protocol trace of a symmetric challenge–response authentication: draw three boxes labelled Client, Network, Server. Draw arrows: Client → Server: ID, Server → Client: nonce R, Client → Server: MAC_K(R||ID). Label each arrow and show verification step on Server.
  • System diagram showing wearable device, gateway, cloud: show where confidentiality, integrity and privacy controls are applied (device encrypts, gateway authenticates, cloud stores anonymised data).

Formulas

T_expected = 2^(k-1) / R — expected time to brute-force a key of k bits if adversary tries R attempts per second; T in seconds. k: key length (bits); R: attempts/sec (s^−1). Applies to exhaustive search assuming uniform key distribution.

p_collision ≈ 1 - exp(-n(n-1)/(2·2^k)) ≈ n^2/(2·2^k) — approximate probability of at least one collision among n hashed items for k-bit hash. n: number of items (unitless); k: hash length in bits. Applies when n ≪ 2^(k/2) for approximation.

b = Δf / ε — Laplace noise scale for ε-differential privacy. b: scale (same units as query output); Δf: global sensitivity (maximum change in f when one record changes); ε: privacy parameter (unitless).

SD_Laplace = sqrt(2) · b — standard deviation of Laplace(b).

security_bits_equiv_RSA — Use NIST equivalence to map RSA modulus to symmetric security bits: RSA-2048 ≈ 112-bit, RSA-3072 ≈ 128-bit, RSA-7680 ≈ 192-bit, RSA-15360 ≈ 256-bit (per NIST SP 800-57/131A). Avoid ad‑hoc formulas; cite the table rather than log2 of attack complexity.

Worked examples

  1. Brute-force time for a 128-bit key. Given: k = 128 bits, assume attacker rate R = 10^12 attempts/s (one trillion/s). Use formula T_expected = 2^(k-1)/R. Step 1: 2^(k-1) = 2^127 ≈ 1.7014118×10^38. Step 2: T_expected = 1.7014118×10^38 / 10^12 = 1.7014118×10^26 s. Step 3: Convert to years: 1 year ≈ 3.1536×10^7 s. Years = 1.7014118×10^26 / 3.1536×10^7 ≈ 5.395×10^18 years. Final answer: ≈ 5.4×10^18 years (far longer than the age of the universe). (Shows 128-bit is practically safe against brute-force at this attack rate.)

  2. Differential privacy: Laplace mechanism for counting query. Given: f(D) = count of users with property P. Δf = 1 (adding/removing one record changes count by at most 1). Choose ε = 0.5. Step 1: Compute b = Δf / ε = 1 / 0.5 = 2. Step 2: Standard deviation = SD_Laplace = sqrt(2)·b ≈ 1.4142·2 = 2.8284. Step 3: If true count is 100, the mechanism releases 100 + noise where noise ∼ Laplace(0,2). Typical noise magnitude (one SD) ≈ 2.83, so reported number likely within about ±5–10 for sensible confidence. For 95% probability, |noise| ≤ b·ln 20 ≈ 6. Final answer: Laplace scale b = 2 and SD ≈ 2.83.

  3. Hash collision sizing (exam-style derivation): Suppose we want collision probability p ≈ 0.5 when storing n items. From the birthday approximation n ≈ 1.1774·2^(k/2). Derive k for given n: k ≈ 2·log2(n) − log2(2·ln 2) ≈ 2·log2(n) − 0.471. (In exam give steps from formula above.)

Common mistakes

  • Forgetting to state adversary model or computational bounds in derivations (every security proof requires assumptions).
  • Misusing birthday paradox: mixing 2^k (space of hash values) with 2^(k/2) (collision scale) incorrectly.
  • Omitting units when computing times (seconds vs years).
  • Assuming anonymization is sufficient for privacy; linkage attacks often re-identify records.

For your exam

Question types you will get: definitions (e.g., define differential privacy), short notes (e.g., challenges of secure pervasive systems), derivations (e.g., birthday paradox collision probability), numericals (brute-force time, Laplace scale), protocol traces (draw and explain challenge–response), and design questions (choose protocol for wearable + gateway + cloud and justify choices). What a full-marks answer includes:

  • Clear definitions with bold terms (state assumptions). For derivations, show every algebra step and units. For protocols, draw the trace and label messages, keys and nonces. For design questions, discuss constraints (battery, latency), pick appropriate primitives (symmetric vs asymmetric), and argue threat model and trade-offs.

Quick check

  1. State the Laplace mechanism scale for ε-DP given sensitivity Δf.
  2. Approximate expected brute-force time in seconds for a 64-bit key if R = 10^9 attempts/s.
  3. What does Kerckhoffs's principle say about the secrecy of algorithms vs keys? Answers: b = Δf/ε; T_expected = 2^(63)/10^9 ≈ 9.22×10^9 s (≈ 292 years); Kerckhoffs: system should remain secure if everything except the key is public.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?