## Introduction to Cryptography
Cryptography is the practice and study of techniques for secure communication in the presence of adversarial behavior. It aims to achieve four primary security goals:
- Confidentiality: Keeping information secret from unauthorized individuals.
- Integrity: Ensuring that information has not been altered or tampered with.
- Authentication: Verifying the identity of a user, process, or device.
- Non-repudiation: Preventing an entity from denying previous actions or commitments.
## Types of Cryptographic Algorithms
Symmetric-Key Cryptography
- Uses a single shared secret key for both encryption and decryption. This key must be securely exchanged between communicating parties.
- Advantages: Very fast and efficient for encrypting large amounts of data.
- Disadvantages: The secure distribution and management of the shared key is a significant challenge.
- Algorithms: AES (Advanced Encryption Standard) is the current industry standard, supporting 128, 192, and 256-bit keys. DES (Data Encryption Standard) and 3DES (Triple DES) are older and less secure, primarily for legacy systems.
Asymmetric-Key (Public-Key) Cryptography
- Uses a pair of mathematically linked keys: a public key (freely shared) and a private key (kept secret by its owner).
- Advantages: Solves the key distribution problem, enables digital signatures, and facilitates secure key exchange for symmetric encryption.
- Disadvantages: Significantly slower than symmetric encryption, making it unsuitable for bulk data encryption.
- Algorithms: RSA (Rivest-Shamir-Adleman) is widely used for encryption, digital signatures, and key exchange. ECC (Elliptic Curve Cryptography) provides comparable security with smaller key sizes, making it efficient for mobile and constrained environments.
Hashing
- A one-way function that transforms input data of any size into a fixed-size string, called a hash value or message digest.
- Purpose: Primarily used for integrity checking (detecting data tampering) and secure password storage.
- Properties: Deterministic (same input always yields same output), computationally infeasible to reverse, and collision resistance (extremely difficult to find two different inputs that produce the same hash).
- Algorithms: SHA-256 (Secure Hash Algorithm 256) is widely used. MD5 (Message Digest 5) and SHA-1 are considered cryptographically broken due to known collision vulnerabilities and should not be used for new applications.
## Digital Signatures and PKI
- Digital Signatures: Provide integrity, authentication, and non-repudiation. They are created by hashing a document and then encrypting that hash with the sender's private key. The signature is verified using the sender's public key.
- Public Key Infrastructure (PKI): A framework that manages digital certificates and public-key encryption. It binds public keys with respective user identities through a Certificate Authority (CA). X.509 is the standard for digital certificates.
## Cryptographic Attacks
- Brute-force attack: Trying every possible key until the correct one is found.
- Known-plaintext attack: Attacker has access to both plaintext and its corresponding ciphertext.
- Chosen-plaintext attack: Attacker can choose arbitrary plaintexts to be encrypted and obtain the corresponding ciphertexts.
- Frequency analysis: Exploiting statistical patterns in ciphertext to deduce the plaintext (e.g., common letters in a language).
- Side-channel attacks: Exploiting information leaked from the physical implementation of a cryptosystem (e.g., timing, power consumption, electromagnetic radiation).
What are the four core security goals achieved by cryptography?
Confidentiality, Integrity, Authentication, and Non-repudiation (CIAN).
tap to reveal
Which type of cryptography uses a single shared key for both encryption and decryption?
Symmetric-key cryptography.
tap to reveal
Name a widely used symmetric encryption algorithm that is considered current and secure.
AES (Advanced Encryption Standard).
tap to reveal
Which type of cryptography uses a public/private key pair?
Asymmetric-key (or Public-key) cryptography.
tap to reveal
What is the primary purpose of a cryptographic hash function?
To ensure data integrity (detect unauthorized alterations) and for password storage.
tap to reveal
What cryptographic primitive provides integrity, authentication, and non-repudiation?
Digital signatures.
tap to reveal
What standard defines the format for digital certificates in a Public Key Infrastructure (PKI)?
X.509.
tap to reveal
Why are MD5 and SHA-1 considered insecure for new cryptographic applications?
They are vulnerable to collision attacks, meaning different inputs can produce the same hash output.
tap to reveal