Cryptography, Certificates, and Secure CommunicationsIntroductionModern networks carry credentials, financial transactions, health information, industrial commands, and personal communications across infrastructure that users do not control. The security of these communications depends on cryptography: the disciplined use of algorithms, keys, protocols, and governance processes to protect information and establish trust. Cryptography does not mean simply “scrambling data.” Different mechanisms provide different security properties. Encryption primarily provides confidentiality; hashing supports integrity and fingerprinting; digital signatures provide integrity, authentication, and non-repudiation; certificates bind identities to public keys; and protocols such as TLS, IPsec, SSH, and VPNs combine these mechanisms into operational systems. This chapter develops the foundations required to distinguish these technologies and select appropriate controls in practice. Learning ObjectivesBy the end of this chapter, you should be able to: - Distinguish encryption, hashing, message authentication codes, and digital signatures.
- Compare symmetric and asymmetric cryptography and explain how they are combined.
- Describe public-key infrastructure (PKI), certificates, certificate authorities, and trust chains.
- Explain key generation, storage, rotation, revocation, and destruction.
- Describe the security purposes and basic operation of TLS, IPsec, SSH, and VPNs.
- Identify common implementation weaknesses and recommend secure practices.
1. Security Services and the Cryptographic ToolkitA security design should begin with the required service rather than with a favourite algorithm. The principal services are: - Confidentiality: preventing unauthorized disclosure.
- Integrity: detecting unauthorized modification.
- Authentication: establishing the identity of a communicating party or the origin of a message.
- Non-repudiation: providing evidence that supports attribution of an action, subject to legal and operational conditions.
- Availability: ensuring that authorized users can access services. Cryptography contributes to availability indirectly but cannot by itself prevent denial-of-service attacks.
EncryptionEncryption transforms readable plaintext into ciphertext using an algorithm and a key. Decryption reverses the transformation for an authorized party. C = EncK(P) P = DecK(C) Here, P is plaintext, C is ciphertext, K is a key, and Enc and Dec are encryption and decryption algorithms. The equations describe the intended correctness of a cryptosystem; security depends on the secrecy or protection of the key, not on keeping a sound algorithm secret. Encryption alone does not necessarily provide integrity. An attacker might alter ciphertext, causing corrupted plaintext or, in poorly designed systems, a meaningful malicious change. Authenticated encryption, such as AES-GCM or ChaCha20-Poly1305, combines confidentiality with integrity and authentication of the ciphertext. HashingA cryptographic hash function maps input of arbitrary length to a fixed-length digest: h = H(M) M is the message, H is the hash function, and h is the digest. A secure hash should make it computationally infeasible to find a message producing a chosen digest (preimage resistance), to find a second message with the same digest (second-preimage resistance), or to find any two different messages with the same digest (collision resistance). Hashing is one-way in normal use; it is not encryption and has no decryption key. Hashes are useful for file-integrity checking, signed documents, content addressing, and password verification. Passwords should be processed with password-specific functions such as Argon2id, scrypt, or bcrypt, together with a unique salt. Fast general-purpose hashes such as SHA-256 are unsuitable as the sole password-storage mechanism because attackers can test guesses rapidly. A salt is a random, non-secret value stored with a password-derived record. It prevents identical passwords from having identical stored values and defeats many precomputed lookup tables. A salt does not replace a strong password or a slow, memory-hard password algorithm. Message Authentication CodesA message authentication code (MAC) uses a shared secret to produce an integrity and authenticity tag: t = MACK(M) The recipient, who also knows K, recomputes the tag and compares it using a safe comparison method. HMAC is a widely deployed construction based on a cryptographic hash. A MAC does not provide non-repudiation because both parties possess the same secret and either could have generated the tag. Digital SignaturesA digital signature uses a private key to sign data and a corresponding public key to verify it. In practice, the message is normally hashed first, and the signature algorithm signs the digest. A signature supports integrity, origin authentication, and evidence associated with the private-key holder. It does not automatically prove that a legal person intentionally signed a document; identity proof, key protection, policy, and evidentiary controls are also required. A signature is different from encrypting with a private key. Secure signature schemes have carefully defined algorithms, padding, encoding, and verification rules. Examples include RSA-PSS, ECDSA, and Ed25519. Implementations must use approved libraries rather than inventing signature procedures. 2. Symmetric and Asymmetric CryptographySymmetric cryptographySymmetric systems use the same secret key, or securely related secret keys, for encryption and decryption. They are computationally efficient and are therefore used for bulk data, disks, databases, and network sessions. Examples include AES and ChaCha20. AES supports 128-, 192-, and 256-bit keys. The security of a mode also matters: AES-GCM provides authenticated encryption, while an inappropriate mode such as electronic codebook (ECB) reveals repeated block patterns and should not be used for ordinary data encryption. The principal operational difficulty is key distribution. Two parties need a shared secret before secure communication can begin, and the number of pairwise keys can become difficult to manage as the number of parties increases. Asymmetric cryptographyAsymmetric cryptography uses a mathematically related public/private key pair. The public key may be distributed widely; the private key must be protected. Public-key encryption can establish confidentiality, while signatures use the private key for signing and the public key for verification. Common families include RSA, elliptic-curve cryptography (ECC), and finite-field systems. Asymmetric operations are generally slower and are not normally used to encrypt large files directly. They are used for authentication, signatures, and establishing a symmetric session key. Hybrid cryptographyMost secure protocols are hybrid. An asymmetric mechanism authenticates parties or establishes keying material; a symmetric authenticated-encryption algorithm then protects application data. This arrangement combines the scalable trust model of public-key cryptography with the speed of symmetric cryptography. For example, a TLS connection may use a server certificate containing a public key, an ephemeral key exchange to derive shared secrets, and AES-GCM or ChaCha20-Poly1305 to protect application records. The exact protocol details depend on the TLS version and negotiated cipher suite. Forward secrecyForward secrecy means that compromise of a long-term private key does not allow an attacker to decrypt previously recorded sessions. Ephemeral Diffie–Hellman key exchange, especially ECDHE, supports this property when fresh ephemeral keys are generated for sessions and erased afterward. Forward secrecy does not protect future sessions if the endpoint remains compromised. 3. Key ManagementCryptographic strength is of limited value if keys are mishandled. Key management covers the complete key lifecycle: - Generation: use an approved cryptographic random-number generator and appropriate key length.
- Distribution: deliver keys through authenticated and protected channels.
- Storage: protect private and symmetric keys with access controls, encryption, hardware security modules (HSMs), or secure platform keystores.
- Use: restrict purpose, algorithm, and environment; avoid reusing a key across unrelated functions.
- Rotation: replace keys according to risk, exposure, policy, and algorithm limits.
- Backup and recovery: preserve availability without creating uncontrolled copies.
- Revocation: invalidate keys or certificates when compromise, departure, or policy violation occurs.
- Destruction: securely erase keys when no longer required, while retaining necessary verification material for records.
A key should have an owner, a defined purpose, an activation and expiration period, and documented recovery and revocation procedures. Access should follow least privilege and separation of duties. HSMs can generate and use keys while preventing ordinary administrators from extracting private key material, although they do not eliminate poor governance or compromised applications. Key compromise is not the only reason to rotate. Rotation may limit the quantity of data protected by one key, meet compliance requirements, or accommodate cryptographic-agility planning. Rotation must be designed so that old data remains decryptable when legitimately required, or is re-encrypted under controlled procedures. 4. Public-Key Infrastructure and CertificatesThe trust problemSuppose a user receives a public key claiming to belong to a bank. The mathematical validity of the key does not prove the owner’s identity. PKI addresses this binding problem through certificates and a trust hierarchy. A digital certificate is a signed data structure that binds a subject identity to a public key for a stated period and purpose. X.509 certificates commonly include the subject, issuer, public key, validity interval, serial number, key-usage constraints, subject alternative names, and the issuer’s signature. A certificate authority (CA) issues certificates after applying an identity-validation policy. A root CA is trusted directly by a device or organization. An intermediate CA is certified by a higher CA and normally issues end-entity certificates. This produces a chain of trust: Root CA → Intermediate CA → Server or user certificate A relying party validates the chain, verifies signatures, checks validity dates, confirms the requested name appears in the Subject Alternative Name extension, evaluates key usage and constraints, and determines whether the certificate has been revoked or otherwise rejected by policy. Certificate validation and revocationCertificates do not make a compromised server safe. If a private key is stolen, the certificate should be revoked and replaced. Revocation mechanisms include certificate revocation lists (CRLs) and the Online Certificate Status Protocol (OCSP). Their effectiveness depends on timely publication, reliable checking, network reachability, and correct client behavior. Short-lived certificates reduce the period of exposure but do not remove the need for incident response. A certificate is not a password, and a public certificate is not secret. The private key associated with it is the sensitive asset. Administrators should monitor unexpected certificates, use certificate-transparency information where appropriate, and automate renewal before expiration. 5. TLS and Secure Web CommunicationTransport Layer Security (TLS) protects communications between applications, most visibly HTTPS. TLS aims to provide confidentiality, integrity, and authentication of the server, with optional client authentication. A simplified TLS connection includes: - The client proposes protocol versions, cryptographic capabilities, and a random value.
- The server selects parameters and sends its certificate and key-exchange information.
- The client validates the certificate chain, hostname, validity, usage, and local trust policy.
- The parties perform an authenticated key exchange and derive session keys.
- Both sides confirm that the handshake transcript has not been altered.
- Application records are protected using authenticated encryption.
This is a conceptual sequence rather than a substitute for the TLS specification; TLS 1.3 changed and streamlined many handshake details compared with earlier versions. TLS protects data in transit between the TLS endpoints. It does not necessarily protect data before encryption at the client, after decryption at the server, or from a compromised endpoint. Organizations should disable obsolete protocol versions and weak cipher suites, configure certificates correctly, protect private keys, and test renewal and failure procedures. A common misconception is that a padlock proves a website is honest. It indicates a cryptographically protected connection to a validated domain under the browser’s trust rules. It does not prove that the business is legitimate, that the content is safe, or that the server itself is uncompromised. 6. IPsec and VPN ApplicationsIPsec operates at the network layer and can protect IP traffic between hosts, networks, or gateways. Its main protocols are Authentication Header (AH), which is rarely used in modern deployments, and Encapsulating Security Payload (ESP), which supports confidentiality, integrity, authentication, and anti-replay protection. IPsec commonly uses Internet Key Exchange (IKEv2) to authenticate peers, negotiate algorithms, and establish Security Associations. In transport mode, the original IP packet is protected while the original IP header remains visible. In tunnel mode, the entire original packet is encapsulated inside a new IP packet; this is common for site-to-site VPNs. A VPN is an encrypted or authenticated tunnel across an untrusted or shared network. VPN security depends on endpoint identity, routing, access control, split-tunnelling policy, logging, updates, and the protection of keys. Encryption does not make an untrusted endpoint trustworthy. A remote-access VPN can provide network reachability without ensuring that the user’s device is healthy or that the user should access every internal service. 7. SSH and Secure AdministrationSecure Shell (SSH) provides encrypted remote login, command execution, port forwarding, and file transfer capabilities. A typical SSH deployment uses: - host keys to authenticate the server;
- user passwords, public keys, certificates, or other mechanisms to authenticate users;
- a key exchange to establish session secrets; and
- symmetric authenticated encryption for the session.
The first-connection host-key decision is important. Blindly accepting an unexpected key enables man-in-the-middle attacks. Administrators should distribute or verify host keys through a trusted channel, restrict private-key permissions, use passphrases or agent controls, disable unnecessary services, and apply least privilege. SSH keys should have identifiable owners, limited uses, and a documented revocation process. Port forwarding is powerful but can bypass network segmentation. It should be governed, logged, and limited to approved administrative needs. 8. Threats, Limitations, and Ethical GovernanceCryptography can fail through: - weak or predictable random numbers;
- reused nonces in algorithms that prohibit reuse;
- obsolete algorithms or insecure modes;
- incorrect certificate validation;
- private-key theft;
- hard-coded secrets in source code;
- poor password handling;
- downgrade and man-in-the-middle attacks;
- implementation bugs and side-channel leakage; and
- inadequate monitoring and incident response.
Security professionals must also consider lawful access, privacy, data minimization, retention, and cross-border requirements. Strong encryption protects citizens and organizations, but its use can complicate investigations and recovery. Governance should define authorized access, escrow or recovery arrangements where legally required, audit procedures, and strict controls against abuse. Backdoors weaken assurance and create risks for legitimate users; any exceptional-access policy requires rigorous legal, technical, and independent oversight. Quantum computing is a contemporary consideration. Large-scale fault-tolerant quantum computers could threaten some widely used public-key systems through Shor’s algorithm, while Grover’s algorithm would reduce the effective security margin of symmetric search. Organizations should inventory cryptographic dependencies, prioritize long-lived confidential data, and plan for cryptographic agility and migration to standardized post-quantum algorithms. This is a planning issue, not evidence that present-day TLS or AES is already broken. Applied Case: Illustrative University Remote-Access ServiceBackgroundA university allows staff to access internal research systems from home. The original service uses passwords over a VPN, a single long-lived server certificate, and manually copied SSH keys. Several former employees retain access, and the certificate is close to expiration. ProblemThe university faces credential theft, excessive network access, unmanaged keys, and outage risk if the certificate expires. It also lacks reliable evidence of who accessed research systems. AnalysisThe VPN provides a protected tunnel but does not by itself establish that a device is compliant or that a user should reach every internal subnet. Password-only authentication increases exposure to phishing and password reuse. Manually copied SSH keys lack ownership and lifecycle controls. The certificate problem is an operational failure likely to become a security incident. Approach and SolutionThe university introduces centralized identity management with phishing-resistant multi-factor authentication, device posture checks, and role-based network access. It uses short-lived certificates or tokens for appropriate services, an automated certificate-management process, and an inventory of certificate and key owners. SSH access is restricted through a bastion host; host keys are distributed through trusted configuration management, and user keys are registered, logged, and revoked during offboarding. Research data remains protected by TLS at the application layer, while VPN access is limited to required routes. OutcomeThe design reduces credential-reuse risk, limits lateral movement, improves auditability, and prevents routine certificate expiration. It does not eliminate endpoint compromise, so patching, monitoring, backups, and incident response remain necessary. Learning PointsA VPN is a control within a broader architecture, not a complete identity solution. Certificates and keys require ownership and automation. Defense in depth combines cryptographic protection with access control, endpoint security, monitoring, and governance. Best Practices Checklist- Prefer current, peer-reviewed protocols and well-maintained libraries.
- Use authenticated encryption for new applications.
- Never invent cryptographic algorithms or certificate-validation logic.
- Protect private keys with least privilege, secure storage, and monitoring.
- Use unique salts for password records and password-specific KDFs.
- Validate certificate names, chains, dates, constraints, and revocation policy.
- Use forward-secret key exchange where supported.
- Automate certificate discovery, renewal, and alerting.
- Document key ownership, rotation, recovery, and destruction.
- Test backups, revocation, failover, and incident response.
- Separate network reachability from authorization to individual services.
- Plan for cryptographic agility and post-quantum migration.
Chapter SummaryCryptography is a collection of specialized tools rather than a single security function. Symmetric encryption efficiently protects data but requires secure key sharing. Asymmetric cryptography supports scalable authentication, key establishment, and signatures, but is normally combined with symmetric encryption in hybrid protocols. Hashes provide fixed-length fingerprints; MACs provide integrity and authentication to parties sharing a secret; and digital signatures use private/public key pairs to support integrity and attribution. PKI solves the identity-binding problem through certificates, certificate authorities, trust chains, validation, and revocation. TLS protects application communications, IPsec protects network-layer traffic and VPN tunnels, and SSH protects remote administration. Each technology has boundaries: encryption does not secure compromised endpoints, certificates do not guarantee honest websites, and VPNs do not replace authorization or device security. Sound key management, automation, governance, monitoring, and cryptographic agility are therefore essential. Key TermsCryptography: The practice of protecting information using mathematical algorithms and keys. Plaintext: Readable or original data before encryption. Ciphertext: Data produced by encryption. Symmetric cryptography: Cryptography using a shared secret key. Asymmetric cryptography: Cryptography using related public and private keys. Hash function: A one-way function that produces a fixed-length digest. Salt: A unique, non-secret random value added to password processing. MAC: A secret-key tag providing message integrity and authentication. Digital signature: A private-key-generated value verified with a public key. Authenticated encryption: Encryption that also provides integrity and authenticity of ciphertext. Forward secrecy: Protection of past sessions from later compromise of a long-term private key. PKI: The policies, technologies, roles, and processes supporting public-key trust. Certificate: A signed binding between an identity and a public key. Certificate authority: An entity that issues and signs certificates. Trust chain: A sequence linking an end certificate to a trusted root. Revocation: The process of invalidating a certificate or key before normal expiration. TLS: A protocol suite for securing application communications. IPsec: A family of protocols securing IP-layer traffic. SSH: A protocol for secure remote access and administration. VPN: A protected tunnel across an untrusted or shared network. Review QuestionsShort Answer Questions- Why is hashing not considered encryption?
- What is the principal difference between a MAC and a digital signature?
- What role does a certificate authority play in PKI?
- Define forward secrecy.
- Name two responsibilities included in key management.
Long Answer Questions- Compare symmetric and asymmetric cryptography, including their strengths, limitations, and typical combined use in TLS.
- Explain how a browser validates a server certificate and identify possible reasons for rejection.
- Describe the key lifecycle from generation through destruction and explain why governance is necessary at each stage.
- Compare TLS, IPsec, and SSH by layer, purpose, authentication, and typical application.
- Explain why a VPN does not by itself provide complete enterprise security.
Analytical / Application Questions- A company discovers that an employee’s private SSH key has been copied. What immediate and longer-term actions should the security team take?
- An organization wants to store user passwords by computing a single SHA-256 digest for each password. Evaluate this design and propose a safer alternative.
- A remote-access service has valid TLS certificates and strong encryption, but users can reach every internal subnet after login. Analyze the risks and recommend layered controls.
Multiple Choice Questions with AnswersQuestion 1Which mechanism is primarily designed to provide confidentiality for bulk data? A. Symmetric encryption B. Cryptographic hashing C. Certificate revocation D. Digital signing Correct Answer: A. Symmetric encryption Question 2What does a salt primarily help prevent in password storage? A. All phishing attacks B. Identical passwords having identical stored values C. Private-key compromise D. Certificate expiration Correct Answer: B. Identical passwords having identical stored values Question 3Which statement about a MAC is correct? A. It uses a shared secret and does not provide non-repudiation B. It uses only a public key C. It is always reversible into plaintext D. It proves which of two holders created the tag Correct Answer: A. It uses a shared secret and does not provide non-repudiation Question 4What does a certificate primarily bind together? A. A password and a username B. An identity and a public key C. A firewall and a subnet D. A hash and a salt Correct Answer: B. An identity and a public key Question 5Which property is associated with ephemeral Diffie–Hellman key exchange? A. Forward secrecy B. Password salting C. Certificate transparency D. Data compression Correct Answer: A. Forward secrecy Question 6In a typical TLS deployment, which party validates the server certificate? A. The client B. The network cable C. The DNS root server exclusively D. The symmetric cipher Correct Answer: A. The client Question 7Which IPsec mode encapsulates the original IP packet inside a new IP packet? A. Hash mode B. Tunnel mode C. Signature mode D. Digest mode Correct Answer: B. Tunnel mode Question 8Why should an SSH host key be verified through a trusted channel? A. To prevent accepting an impostor during a man-in-the-middle attack B. To increase the bandwidth of SSH C. To convert SSH into a VPN D. To make passwords unnecessary in every case Correct Answer: A. To prevent accepting an impostor during a man-in-the-middle attack Question 9Which item is a key-management activity? A. Key rotation B. Changing a file extension C. Increasing monitor brightness D. Disabling all authentication Correct Answer: A. Key rotation Question 10What is a major limitation of a VPN? A. It cannot use cryptography B. It automatically proves that every endpoint is trustworthy C. It may provide network reachability without sufficient authorization or endpoint assurance D. It can protect only printed documents Correct Answer: C. It may provide network reachability without sufficient authorization or endpoint assurance
|