Skip to content
BoKSA

CYBOK 18.1 2 Crypto Schemes and Protocols Implementation

CYBOK 18.1-2 Crypto Schemes and Protocols - Implementation

1. Introduction: Cryptography as a Foundation for Cyber Security

In the modern security landscape, cryptography is frequently misunderstood as a "silver bullet" for all digital ailments. In reality, it is a mongrel field—a complex blend of high-level mathematics, software and hardware engineering, and human factors. While it provides the mathematical certainty required to protect information, its strategic importance lies in its ability to reduce the attack surface of modern systems rather than eliminating all possible threats. It is a tool that must work in concert with other security building blocks to make specific attack vectors either infeasible or economically unattractive for an adversary.To understand the scope of applied cryptography, we categorize its applications into the Cryptographic Triumvirate :

  • Data in transit: Protecting information as it moves across untrusted networks (secure communications).
  • Data at rest: Securing stored information, effectively treating storage as a communication channel across time.
  • Data under computation: An emergent field (e.g., Fully Homomorphic Encryption) enabling processing on encrypted data without leaking the underlying information to the server performing the work.This document serves as a guide to bridge the significant gap between theoretical algorithms—the "perfect math"—and the messy reality of secure implementation.

2. Core Building Blocks: From Algorithms to Schemes

A critical skill for any cyber security specialist is the ability to distinguish between an individual algorithm and a functional scheme . An algorithm is a single, well-defined procedure (like a block cipher), while a scheme is a collection of algorithms—such as key generation, encryption, and decryption—that together provide a specific service like Public Key Encryption (PKE) .

Explanation of Concept

The fundamental distinction in cryptography lies between Symmetric and Asymmetric systems. In symmetric cryptography, the same key is used for both encryption and decryption; therefore, the confidentiality of the key is the single most important factor. Asymmetric systems utilize a key pair: a public key for encryption and a corresponding private key for decryption. Currently, we are witnessing the slow death of RSA in favor of Elliptic Curve Cryptography (ECC) . This shift is driven by efficiency: for a 128-bit security level, RSA requires a massive 3072-bit modulus, whereas ECC achieves the same strength with a 256-bit prime field, significantly reducing computational overhead.

Relevance in Cyber Security: The Composability Problem

In the field, we must recognize that encryption is only one part of the story . Tools such as Message Authentication Codes (MACs) and Digital Signatures ensure integrity and authentication. However, architects must beware of non-composability . A system built from individually secure components can still be insecure. For instance, the "Encrypt-and-MAC" ( E\&M ) approach—historically used in SSH—can leak plaintext equality because the MAC is deterministic. The preferred industry standard is "Encrypt-then-MAC" ( EtM ), which provides the most robust security. In cryptography, every bit matters .

Socio-Technical Context: Cryptographic Diversity

There is a "long road" between a research paper and a production-quality implementation. This Cryptographic Diversity means many academic "gadgets," such as Multi-Party Computation (MPC) or Fully Homomorphic Encryption (FHE) , are still largely emergent and not yet ready for commoditized, large-scale deployment. Gaps between design and implementation are where vulnerabilities flourish, often through the misuse of library APIs or the failure to account for hardware-level leakage.

Starting Points
  • CyBOK Applied Cryptography Knowledge Area: The foundational text for understanding these primitives.
  • NIST Standards: Refer to FIPS 197 for AES and FIPS 202 for SHA-3.
  • CAESAR Competition: A vital resource for modern Authenticated Encryption with Associated Data (AEAD) schemes.
Points of Attention

When auditing an algorithm selection, use this architect’s checklist:

  • Avoid Legacy Status: Deprecate SHA-1 or MD5 ; collisions are now computationally feasible.
  • Key Length vs. Lifetime: Ensure symmetric keys provide at least 128-bit security .
  • Cryptographic Agility: Does the system support switching algorithms (e.g., via cipher suites) if a primitive is broken?
  • Composability Audit: Are primitives combined safely (e.g., using EtM or vetted AEAD like AES-GCM)?

3. Interactive Security: Protocols and Digital Signatures

Modern networks are inherently untrusted. We rely on protocols —interactive systems where parties exchange messages—to establish trust over these networks.

Explanation of Concept

A cornerstone of interactive security is Diffie-Hellman Key Exchange (DHKE) . However, architects must ensure the use of trusted parameters . Relying on unvetted parameters can lead to small sub-group attacks . Participants should verify the cryptographic strength (such as primality tests) or use standardized curves. Furthermore, raw DHKE is vulnerable to Man-in-the-Middle (MitM) attacks; thus, Authentication (via signatures) must be integrated to verify participant identities.

Relevance in Cyber Security

Digital signatures provide Non-repudiation . If a user is associated with a private signing key, they cannot legally or professionally deny creating a verified message. This is critical for accountability in digital contracts and administrative actions.

Socio-Technical Context

The "Crypto Wars" illustrate that cryptography is inherently political . While governments have historically used export controls to regulate these tools, the "cryptographic genie" is out of the bottle. Today, protocols protect whistleblowers and journalists, creating a permanent tension between the state's desire for "back-doors" and the individual's right to privacy.

Starting Points
  • IETF RFC 8446: This document specifies TLS 1.3 , the gold standard for modern, vetted interactive protocols.
  • Signal Protocol: Useful for studying modern end-to-end encryption in messaging.
Points of Attention

Warning: Duplicate Signature Key Selection (DSKS) A valid signature does not inherently bind a message to a specific verification key. An adversary might concoct an alternative key pair that validates an existing signature. This "DSKS" gap can lead to catastrophic failures in complex protocol designs.

4. The Reality of Implementation: Libraries, APIs, and Side-Channels

The transition from mathematical pseudo-code to machine code is the final line of defense. Even "perfect" math fails if the implementation leaks information.

Explanation of Concept

Security specialists consume cryptography through Cryptographic Libraries (like OpenSSL). Implementation happens in both software and hardware, utilizing specialized instructions like RDRAND for entropy or Trusted Platform Modules (TPMs) . However, implementation introduces Side-Channel Attacks . These are not attacks on the math, but on the physical properties of the system:

  • Length Side Channels: If a system sends "BUY" or "SELL" commands, an adversary can distinguish them simply by the ciphertext length (the "SELL" ciphertext being one byte longer).
  • Cache-based attacks: Techniques like Flush+Reload exploit shared memory resources in modern CPUs to leak key-dependent memory access patterns.
Relevance in Cyber Security

The golden rule is: "Never roll your own crypto." Rely on vetted libraries like BoringSSL or LibreSSL . Yet, simply using a library is insufficient; you must avoid API misuse, such as failing to use unique nonces in AES-GCM, which can lead to a total loss of integrity.

Socio-Technical Context: API Design

Human error is the primary cause of failure. Green and Smith’s principles highlight how API design impacts security:| Principle | Impact on Security || ------ | ------ || Safe Defaults | Prevents the accidental use of insecure modes like ECB. || Hard to Misuse | Ensures incorrect usage results in visible errors during development. || Hiding Complexity | Hides the underlying math from non-expert developers to prevent implementation gaps. || Safe Error Handling | Prevents Padding Oracle attacks where error messages reveal the validity of decrypted blocks. |

Points of Attention
  • Constant-Time Cryptography: Routines must execute in the same amount of time regardless of the secret key value to prevent timing attacks.
  • Secure Randomness: Ensure the use of a "strong" random bit generator; weak entropy in key generation renders the strongest algorithm useless.
  • Side-Channel Mitigation: Use blinding or masking techniques in high-risk hardware environments.

5. Advanced Notes (For Year 3 & 4 Students)

Post-Quantum Cryptography (PQC) vs. QKD

Post-Quantum Cryptography refers to classical algorithms (lattice-based, code-based) designed to resist quantum attacks while running on existing hardware. This must be distinguished from Quantum Key Distribution (QKD) .Architects should maintain a healthy skepticism regarding QKD. While marketed as "unconditionally secure," QKD faces severe challenges: it does not solve any problem that isn't already solved by commoditized classical means, it requires an expensive authenticated channel to prevent MitM, and it suffers from severe range and rate limitations.

The Quantum Threat

The primary threat is Shor’s algorithm , which can solve the Integer Factorization and Discrete Logarithm problems in polynomial time. This would render RSA and ECC obsolete. Symmetric algorithms (AES) are more resilient, requiring only a doubling of key sizes to remain secure against Grover's algorithm .

Verification Techniques

To verify complex protocols, we use "Game Hopping." This modularizes a security proof into a sequence of "games." By demonstrating that an adversary's advantage does not significantly increase between games, we provide a rigorous mathematical assurance of a protocol's soundness before it is ever deployed in code.