Secure communications on the Internet means protecting data from being intercepted, tampered with, or forged as it travels across networks. Without security, every HTTP request, email, and login credential is visible to anyone who can observe the network traffic between you and the server.
| Pillar | Definition | Threat if Violated | Protection |
|---|---|---|---|
| Confidentiality | Only authorised parties can read the data | Eavesdropping / sniffing | Encryption (TLS, AES) |
| Integrity | Data cannot be altered without detection | Tampering / man-in-the-middle | MACs, digital signatures, hashes |
| Availability | Services remain accessible to authorised users | DoS/DDoS attacks, crashes | Redundancy, rate limiting, firewalls |
Cryptography is the science of encoding information so that only authorised parties can read it. Modern Internet security uses a combination of symmetric encryption (same key to encrypt and decrypt), asymmetric encryption (public/private key pair), and hash functions (one-way fingerprints).
| Feature | Symmetric (AES, DES) | Asymmetric (RSA, ECC) |
|---|---|---|
| Keys | One shared key for both encrypt and decrypt | Public key (encrypt) + private key (decrypt) |
| Speed | Very fast — suitable for bulk data | Slow — only for small data / key exchange |
| Key distribution | Difficult — how do you share the key securely? | No problem — public key can be shared openly |
| Key length | 128-256 bits | 2048-4096 bits (RSA), 256 bits (ECC) |
| Used for | Encrypting the actual data stream (AES-256) | Key exchange, digital signatures, certificates |
| TLS role | Bulk encryption of data after handshake | Handshake — authenticating and exchanging session key |
Try: change one character and hash again. The entire output changes completely (avalanche effect).
| Property | Description |
|---|---|
| One-way (pre-image resistant) | Cannot compute the original input from the hash |
| Collision resistant | Infeasible to find two different inputs with the same hash |
| Deterministic | Same input always produces the same output |
| Avalanche effect | Changing one bit changes approximately 50% of the output |
| Fixed output | SHA-256 always outputs 256 bits regardless of input length |
| Used for | Password storage, file integrity, digital signatures, TLS MACs |
TLS (Transport Layer Security), the successor to SSL, is the protocol that adds security to TCP connections. It provides: confidentiality (AES encryption), integrity (HMAC), and authentication (X.509 certificates). HTTPS = HTTP + TLS. Port 443.
| Field | Content | Purpose |
|---|---|---|
| Subject | CN=navinniroula.com.np, O=Org | Identifies who this certificate belongs to |
| Issuer | CN=Let's Encrypt R3 | The Certificate Authority (CA) that signed this cert |
| Public Key | RSA 2048-bit or EC 256-bit key | Used to verify the CA's signature |
| Valid Period | Not Before / Not After dates | Certificate expires — must be renewed periodically |
| SAN | DNS:navinniroula.com.np | Additional domains this cert covers |
| Signature | CA's digital signature | Proves the CA validated the server's identity |
Public Key Infrastructure (PKI) is the system of Certificate Authorities (CAs), certificates, and trust chains that makes secure Internet communication possible. Every browser and OS ships with a list of ~150 trusted root CAs. Any certificate signed by one of these root CAs (or an intermediate CA they signed) is trusted automatically.
| Level | Example | Trust Basis |
|---|---|---|
| Root CA | DigiCert Global Root CA | Pre-installed in browsers/OS — inherently trusted |
| Intermediate CA | DigiCert TLS RSA SHA256 2020 CA1 | Signed by Root CA — trusted transitively |
| Server Certificate | CN=navinniroula.com.np | Signed by Intermediate CA — trusted transitively |
| End Entity | Your browser session | Verifies the full chain back to a trusted root |
Transport Layer Security — encrypts TCP connections. Provides confidentiality, integrity, and authentication. HTTPS = HTTP+TLS on port 443.
Digital document binding a public key to an identity, signed by a Certificate Authority (CA).
Certificate Authority — a trusted organisation that verifies identities and signs certificates.
Advanced Encryption Standard with 256-bit key — symmetric cipher used for bulk data in TLS.
Asymmetric algorithm for key exchange and digital signatures. 2048-4096 bit keys.
Hash-based Message Authentication Code — ensures data integrity and authenticity in TLS records.
- The CIA Triad: Confidentiality (encryption), Integrity (hashing/MAC), Availability (redundancy/DoS protection).
- Symmetric encryption (AES) uses one shared key — fast, for bulk data. Asymmetric (RSA/ECC) uses key pairs — slow, for key exchange and signatures.
- Hash functions (SHA-256) are one-way — same input always gives same output but cannot be reversed. Used for passwords, file integrity, and MACs.
- TLS handshake: ClientHello → ServerHello + Certificate → verify cert → key exchange (Diffie-Hellman) → encrypted session begins.
- X.509 certificates bind a public key to an identity, signed by a trusted Certificate Authority (CA).
- The chain of trust: Root CA → Intermediate CA → Server Certificate. Browser verifies the full chain.
- Digital signatures: hash the message, encrypt hash with private key. Receiver verifies by decrypting with public key.
- In Windows apps: use WinINet for automatic TLS handling, or SChannel/SSPI for raw TLS control over Winsock.