One control never suffices. E-commerce needs layers: encryption for data, signatures for integrity, certificates for identity, and perimeter controls for networks. This chapter explains each technology and maps it to the dimensions it protects.

Learning Objectives

By the end of this chapter, you will be able to:

  • Distinguish symmetric and public key encryption and state when to use each.
  • Explain hash digests, digital signatures, and digital envelopes.
  • Explain digital certificates and PKI.
  • Describe TLS, HTTPS, and VPNs.
  • Explain firewalls, proxies, IDS/IPS, anti-malware, and multi-factor authentication.

1. Encryption

Encryption converts plaintext to ciphertext with a key. Decryption restores it. It protects data in transit and at rest.

Symmetric encryption

One shared secret key encrypts and decrypts. AES is the current standard. It is fast, so it handles bulk data. It needs secure key distribution: both sides must share the secret without exposing it. One key per peer multiplies key management.

Public key encryption

Each party holds a key pair: a public key anyone may know and a private key only the owner holds. What one key locks, only the other unlocks. To send confidentially to a shop, encrypt with the shop’s public key; only its private key decrypts. Key distribution simplifies because the public key can publish. Public key operations are slow, so systems use them to exchange a symmetric session key and then use symmetric encryption for the rest.

Feature Symmetric Public key
Keys One shared secret Public plus private pair
Speed Fast Slow
Distribution Must share secret privately Publish public key openly
Use Bulk data Key exchange, signatures
flowchart LR
  A[Sender] -->|Encrypt with receiver public key| C[Ciphertext]
  C -->|Decrypt with receiver private key| B[Receiver]
  A -->|Sign hash with sender private key| S[Signature]
  S -->|Verify with sender public key| B

Figure 1: Confidentiality via public key and authenticity via signature

2. Hash digests and digital signatures

A hash function maps any message to a short fixed digest. Change one character and the digest changes completely. SHA-256 is a common choice.

A digital signature proves integrity, authenticity, and nonrepudiation:

  1. Sender hashes the message to a digest.
  2. Sender encrypts the digest with the sender’s private key. That is the signature.
  3. Receiver decrypts the signature with the sender’s public key to recover the digest.
  4. Receiver hashes the received message and compares digests. Match means unchanged and from the claimed sender.

A digital envelope combines both goals: encrypt the message with a random symmetric key, encrypt that key with the receiver’s public key, and sign the hash with the sender’s private key. The receiver reverses the steps.

3. Certificates and PKI

A public key alone does not prove ownership. A digital certificate binds a public key to an identity. A certification authority (CA) verifies the organization and domain and issues the certificate with its own signature. The certificate contains subject name, public key, validity dates, serial number, and CA signature.

PKI manages CAs and revocation. Browsers validate via trusted roots. In Nepal, ETA licenses CAs.

4. TLS and HTTPS

TLS (Transport Layer Security, successor to SSL) secures browser to server traffic. HTTPS is HTTP over TLS. The padlock signals an active TLS session.

Handshake: browser validates certificate, parties negotiate a session key, data flows encrypted.

TLS provides confidentiality and integrity on the channel. It does not secure data after it reaches the server. Database encryption and access control must still protect stored orders.

5. VPNs and wireless security

A virtual private network (VPN) creates an encrypted tunnel between a device and a VPN server. A company can use one to let remote staff access its internal network. A commercial VPN can protect traffic from observers on an untrusted local network, but the provider can see traffic after it leaves the tunnel. HTTPS is still needed to protect the connection to the destination.

For Wi-Fi, use WPA3 where supported, or WPA2 with a strong password when it is not. Change default router credentials, install security updates, and separate guest access from business devices. Avoid obsolete WEP; on public Wi-Fi, check the website address and certificate before signing in.

6. Firewalls and proxies

A firewall filters traffic by rules.

  • Packet filter. Checks source, destination, port, and protocol. Fast, coarse.
  • Application gateway and Web Application Firewall (WAF). Inspects HTTP content and blocks patterns such as SQL injection and cross site scripting.

A proxy sits between users and the Internet, forwards requests, hides internal addresses, enforces policy, and caches content. A reverse proxy in front of a shop terminates TLS, balances load, and filters requests before they reach the application.

7. IDS, IPS, and anti-malware

IDS monitors and alerts. IPS blocks. Place firewall at perimeter and IDS/IPS behind it.

8. Authentication

  • Passwords. Weak when short or reused. Enforce length, check against breached lists, and hash with a strong algorithm.
  • Multi-factor authentication. Combines something known, something possessed, and something inherent. In Nepal, banks and wallets combine password or PIN with SMS OTP or app approval plus biometrics.
  • Biometrics. Fingerprint and face unlock on phones provide possession plus inherence with good usability.
  • Tokenization. Replaces a card number with a token. The shop never stores the real number, which reduces PCI scope.
Technology Dimensions protected
Symmetric encryption, TLS, VPN, tokenization Confidentiality, privacy
Hash, signature, certificate, PKI Integrity, authenticity, nonrepudiation
Firewall, proxy, IDS/IPS Integrity, availability, confidentiality
Anti-malware, patching Integrity, availability
MFA, biometrics Authenticity

Nepal Adoption and gaps

Most Nepali banks and wallets use TLS and OTP. Gaps include untuned firewalls, basic antivirus, cost, and unpatched software. Hosted checkout sidesteps much cost.

Worked Example: Cost of TLS coverage for a small store in 2081 BS

A boutique in Bhaktapur runs three hosts: shop, blog, and admin. Options for Kartik 2081:

  • Free domain validated certificates: NPR 0 issuance, 30 minutes per host per quarter for renewal automation. Labour NPR 1,200 per hour. Annual cost = 3 hosts x 4 renewals x 0.5 hr x 1,200 = NPR 7,200.
  • Paid wildcard with support: NPR 12,000 per year plus 1 hour setup = NPR 13,200 year one.

Free certificates save NPR 6,000 and automate renewal. The paid option helps only if the shop needs organizational validation or dedicated support. In both cases, redirect HTTP to HTTPS and enable HSTS.

Self-Check State one sentence each for: what symmetric encryption solves, what public key encryption solves, what a signature proves, and what a certificate proves.

Self-check

What is a key difference between symmetric and public-key encryption?

Try This Assume a 5 MB checkout bundle means 5,000,000 bytes and that TLS adds 3 percent overhead. Calculate bytes added. A WAF blocks 12 SQL injection attempts per day; assume each would otherwise have a 5 percent chance of causing NPR 18,000 in loss. Calculate the expected daily loss avoided.

Answer sketch The assumed overhead is 5,000,000 × 0.03 = 150,000 bytes. Expected daily loss avoided is 12 × 0.05 × 18,000 = NPR 10,800, assuming all 12 blocked attempts would otherwise reach the vulnerable application. Actual TLS overhead and attack outcomes vary.

Summary

Encryption protects secrecy, with symmetric for speed and public key for key distribution. Hash digests detect alteration. Digital signatures add authenticity and nonrepudiation. Certificates inside PKI bind keys to identities. TLS combines these to secure the channel as HTTPS. VPNs protect remote access. Firewalls and proxies filter at the edge. IDS/IPS detects and blocks intrusions. Anti-malware and patching protect endpoints. MFA and tokenization protect accounts and reduce card data scope. Together they provide layered defence across client, channel, and server.

Key Takeaways

  • One shared key is fast; a key pair solves distribution and enables signatures.
  • A signature is a hash encrypted with the sender’s private key.
  • Certificates make public keys trustworthy via a CA chain.
  • TLS secures the channel; server-side controls must still protect stored data.
  • MFA and tokenization protect identity and limit what an attacker can steal.

Discussion

  1. Why does a shop need access controls and backups even when its website uses HTTPS?
  2. Compare symmetric encryption, public key encryption, and hashing. What problem does each solve?
  3. A seller works from a public Wi-Fi hotspot. How do HTTPS and a VPN protect different parts of the connection?

Exercises

Short answer

  1. Contrast symmetric and public key encryption.
  2. What does a hash digest provide?
  3. What is a digital certificate and who issues it?
  4. Name two firewall types and their filter basis.
  5. Define MFA with an example used by Nepali wallets.

Long answer

  1. Show how public key encryption, signatures, and certificates work together to secure a checkout, step by step.
  2. Describe network defences from firewall to WAF to IDS/IPS and when to use each.
  3. Assess adoption of security technologies in Nepal and propose a low cost layered plan for a small shop that uses hosted checkout.