1. Core Principles of Cryptography & CIA Triad
The CIA Triad and Non-Repudiation
The CIA Triad is the foundational model for information security. Confidentiality ensures that data is accessible only by authorized parties. Integrity guarantees that data has not been altered in transit or at rest. Availability ensures that systems and data are accessible when needed.
Non-repudiation is the fourth pillar, providing proof of the origin and integrity of data, ensuring the sender cannot deny having sent a message.
To verify integrity in a real-world scenario, we use cryptographic hashes. You can use OpenSSL to generate a SHA-256 fingerprint of a file, ensuring its state remains consistent.
openssl dgst -sha256 document.txt
Single shared key used for both encryption and decryption. Ultra-fast performance suitable for streaming gigabytes of data.
KeyPair scheme: Public Key encrypts data, Private Key decrypts. Solves key distribution over public untrusted networks.
Plaintext, Ciphertext, Keys, and Ciphers
Plaintext is the readable, unencrypted message. A cipher is the algorithm—the mathematical formula—used to perform encryption and decryption. The key is a secret piece of information that makes the cipher's output unique to the user.
The fundamental relationship is: Ciphertext = Encryption_Algorithm(Plaintext, Key).
Below is a simple XOR cipher simulation in Python. XORing plaintext with a repeating key is a classic (though weak) symmetric cipher technique.
def xor_cipher(data, key): return bytes([b ^ key[i % len(key)] for i, b in enumerate(data.encode())]) message = 'SecretData' key = b'VOIDX' encrypted = xor_cipher(message, key) print(f'Ciphertext: {encrypted.hex()}')
Kerckhoffs's Principle & Shannon's Maxim
Kerckhoffs's Principle states that a cryptosystem should be secure even if everything about the system, except the key, is public knowledge. This is reinforced by Shannon's Maxim: 'The enemy knows the system.'
Security through obscurity is never a substitute for robust key management. If your security relies on hiding the algorithm, your system is fundamentally broken if the implementation is leaked.
The table below clarifies the distinction between algorithm secrecy and key management.
| Feature | Description |
|---|---|
| Algorithm | The public, peer-reviewed mathematical transformation. |
| Key | The private, high-entropy variable securing the input. |
Cryptographic Attack Types
Attackers use various methods to break cryptosystems. A Ciphertext-only attack involves having access to only the encrypted messages. A Known-plaintext attack occurs when the attacker has pairs of both plaintext and the resulting ciphertext.
A Chosen-plaintext attack is the most dangerous scenario, where the attacker can obtain the ciphertext for arbitrary plaintext of their choosing, often leading to the discovery of the underlying key.
You can simulate a simple bit-flipping attack on raw byte streams using Python to observe how integrity is compromised.
original = bytearray(b'Admin:False') # Flip a bit to change 'F' to 'T' for True original[6] = original[6] ^ 0x05 print(f'Modified payload: {original.decode()}')
Knowledge Check
Ready to test your understanding of 1. Core Principles of Cryptography & CIA Triad?