Practical Cryptography: Fundamentals, Algorithms, and Use Cases
Fundamental Objectives and Purpose of Cryptography
- Primary Purpose: The central goal of cryptography is to protect information by making it unreadable to unauthorized users. It is distinct from other data processes such as organizing data for storage, compressing data to save space, or encoding data for platform compatibility.
- Interrelation of Concepts: The processes of organizing data for storage and compressing data to save space are noted to "go hand in hand."
- Cryptographic Objectives:
- Confidentiality: Ensuring that data is only accessible to those authorized to see it.
- Integrity: This refers to the assurance that the data has not been "compromissed" or altered during storage or transit.
- Authentication: Verifying the identity of a user or system.
- Non-repudiation: Ensuring that a party in a communication cannot deny having sent a message or performed a transaction.
Comparative Analysis: Encryption vs. Hashing
- Reversibility: The main distinction between the two is that encryption is a reversible process (decryption), whereas hashing is a one-way function and is not reversible.
- Performance: Hashing is characterized as being "very fast." In contrast, processes based on encryption algorithms are "much slower."
- Functional Differences:
- Encryption is primarily used to ensure confidentiality.
- Hashing is used to ensure and verify data integrity by producing a fixed-length output string from input data.
Symmetric Encryption
- Core Characteristic: Symmetric encryption uses a single shared key for both the encryption of plaintext and the decryption of ciphertext.
- Performance and Resources: It is generally faster and less resource-intensive than asymmetric encryption.
- Algorithms:
- AES (AdvancedEncryptionStandard): A primary symmetric algorithm. Specifically, AES−256 is used in secure messaging applications to encrypt communications.
- DES (DataEncryptionStandard): A traditional symmetric algorithm.
- 3DES (TripleDES): An evolution of the DES algorithm.
- Limitations: It requires a secure method for key exchange, as the same key must be known by both parties.
- Use Case: Symmetric encryption is most likely used for encrypting large volumes of data in a database due its efficiency.
Asymmetric Encryption
- Core Characteristic: Also known as public-key cryptography, it uses two distinct keys: a public key and a private key.
- Performance and Resources: It is slower and more resource-intensive compared to symmetric encryption.
- Primary Algorithm: RSA (described in the text as the "Really secure algorithm").
- Digital Signatures: RSA is the cryptographic algorithm most often used for creating digital signatures to provide authentication and non-repudiation (ensuring "the name" or identity of the sender).
- Secure Key Exchange: Asymmetric encryption is frequently used for secure key exchange. Because users possess both a public and private key, it eliminates the need to securely share a private key over an insecure channel. It is used to "send over" the private key used for subsequent symmetric communication.
- Web Traffic: It is the foundational technology for securing web traffic via HTTPS.
Hashing Functions and Data Integrity
- Functions of Hashing:
- It is a one-way function.
- It produces a fixed-length value (hash) regardless of the input size.
- It does NOT ensure confidentiality; it is strictly for integrity and verification.
- SHA-256: This algorithm is commonly used to create a fixed-length hash for verifying data integrity.
- Password Storage Applications: Hashing is used in password storage to create a one-way hash. This allows a system to verify a password by comparing hashes without ever storing the actual password in plaintext. E-commerce sites use this to ensure stored passwords cannot be reversed.
- File Integrity: Hashing is the specific cryptographic function used to verify the integrity of a downloaded file to ensure it has not been altered.
Data Encoding
- Purpose: The primary distinction of encoding is that it is used to convert data into a specific format for compatibility across different platforms or transmissions.
- Security Distinction: Encoding does NOT secure data or provide confidentiality; it does not require a key for the conversion process. Unlike hashing, encoding is reversible.
Practical Scenarios and Summary of Usage
- Large Data Volumes: Symmetric encryption (e.g., AES).
- Secure Communications over HTTPS: Asymmetric encryption.
- Integrity Verification (Files/Data): Hashing (e.g., SHA−256).
- Password Verification: Hashing.
- Compatibility Conversion: Encoding.
- Digital Signatures for Emails: Asymmetric encryption (RSA).