Asymmetric vs. Symmetric
In short, symmetric cryptography is faster and simpler but lacks scalability, has challenges with key distribution, and cannot provide nonrepudiation.
On the other hand, asymmetric cryptography, while slower and more complex, offers scalability, easier key distribution, nonrepudiation, and is generally considered stronger.
Both methods have their use cases and are often used together in a complementary manner in many cryptographic systems, you'll need to memorize the pros and cons of each, outlined below
Symmetric Cryptography | Asymmetric Cryptography | |
Key Usage | Uses a shared secret key. | Uses public-private key pairs for communication between parties. |
Scalability | Lacks support for scalability due to the need for secure key exchange for each new communication pair. | Supports scalability because any number of parties can use the public key for encryption. |
Key Distribution | Key distribution is a challenge, as the same secret key must be securely transferred and kept secret by both parties. | Key distribution is easier because the public key can be openly distributed, while the private key remains secret. |
Nonrepudiation | Cannot provide nonrepudiation, as both parties share the same key and thus any party could potentially create a given message. | Provides nonrepudiation because messages encrypted with a private key can only be decrypted with the corresponding public key, verifying the source. |
Speed | Faster due to simpler computations. | Slower because it requires more complex computations. |
Strength | Typically requires larger key sizes for equivalent security due to vulnerabilities to methods like brute-force attacks. | Generally stronger and provides a high level of security, even with smaller key sizes. |
Post-Quantum | Holds up fairly well. | Poses more immediate threats. |
You could exploit both advantages of asymmetric and symmetric simultaneously by distributing a symmetric key with asymmetric cryptography. This mitigates the symmetric key distribution, authentication, and nonrepudiation problem.
Symmetric
In symmetric cryptography, a single, shared key is used between the sender and the recipient. This key is used both for encryption and decryption of the message. This means that both parties need to have access to the same secret key.
Image Credit:
Algorithm | Type | Score | Block Size (bits) | Key Size (bits) | In Use? |
RC4 | Stream | 40 | N/A | 40-2048 (variable) | No, deprecated |
DES | Block | 30 | 64 | 56 | No, deprecated |
3DES (Triple DES) | Block | 60 | 64 | 168 | Yes, but being phased out |
CAST-128 (CAST5) | Block | 60 | 64 | 40-128 (variable) | Rarely |
Blowfish | Block | 70 | 64 | 32-448 (variable) | Yes, but being phased out |
IDEA | Block | 70 | 64 | 128 | Yes |
RC5 | Block | 70 | 32, 64, 128 | 0-2048 (variable) | Rarely |
CAST-256 (CAST6) | Block | 80 | 128 | 128, 160, 192, 224, 256 | Yes |
Twofish | Block | 90 | 128 | 128, 192, 256 | Yes |
Camellia | Block | 90 | 128 | 128, 192, 256 | Yes |
Serpent | Block | 90 | 128 | 128, 192, 256 | Yes |
Rijndael (AES) | Block | 100 | 128, 192, 256 | 128, 192, 256 | Yes |
Combinations Problem
The formula (n*(n-1))/2 is used to calculate the number of pairwise combinations between n entities, which often arises when discussing the key management challenge in symmetric encryption for a large network of users.
If we want every pair of individuals in a group of people to be able to communicate securely using symmetric encryption, then every pair needs a unique secret key that only they know.
- With 2 people, only 1 key is needed (between person A and person B).
- With 3 people, we need a key for (A,B), (A,C), and (B,C) = 3 keys.
- With 4 people, we need a key for (A,B), (A,C), (A,D), (B,C), (B,D), and (C,D) = 6 keys.
- ...
This exponential growth in required keys becomes a key management challenge in large networks. This is one of the reasons why we have asymmetric cryptography.
DES & 3DS
DES and 3DES are encryption standards that were previously widely used.DES, which stands for Data Encryption Standard, is no longer considered secure for many applications due to its lower strength with 64-bit blocks and 56-bit keys. An easy way to remember this is that "DES" sounds like "less", implying its reduced security.
3DES, or Triple DES, is a more secure version of DES used for scenarios requiring higher security but where changing to a completely different algorithm isn't feasible. It has larger key sizes and increased strength. "3DES, thrice as nice," is a way to remember that it's an upgraded version from DES, though it too is being phased out.
DES and 3DES operate in five basic modes: Electronic Codebook (ECB), Cipher Block Chaining (CBC), Cipher Feedback (CFB), Output Feedback (OFB), and Counter (CTR). Each mode has its pros and cons:
Mode | Pros | Cons |
ECB | Simple and easy to implement | Input blocks produce identical output blocks! Very insecure |
CBC | Provides confidentiality and integrity. | Error in one block affects subsequent blocks due to chaining. |
CFB | Allows real-time encryption and transmission. | Errors in transmission can propagate through the chain. |
OFB | Errors do not propagate through subsequent blocks. | Lacks the inherent integrity-checking of CBC mode. |
CTR | Allows parallel encryption and decryption. | Lacks the inherent integrity-checking of CBC mode. |
Other Symmetric Encryption Standards
Some other notable encryption standards include:
- Skipjack: Invented by the NSA and designed for use in the Clipper chip for encrypting voice and data messages. Think of it as "we skipped this one, didn't get jack" since it wasn't widely known until later.
- IDEA: Used in Pretty Good Privacy (PGP), an email encryption program. Its strength can be compared to a "good idea", having a 64-bit block size and 128-bit keys.
- Blowfish: Popular for applications with infrequent key changes, like disk encryption. Remember it as the "smaller fish" with 64-bit block size and a variable key size.
- Twofish: Known for its efficiency and flexibility, Twofish was a finalist in the AES competition. Consider it the "bigger fish" with 128-bit block size and key sizes similar to AES.
- AES: Currently the most widely used and considered strong. You can remember it as "AES the best". It has a 128-bit block size with varying key lengths (128, 192, 256).
RC4, RC5, and RC6 can be visualized as radio-controlled (RC) cars. RC4 is the older, less powerful model (low strength, stream cipher), while RC5 and RC6 are the newer, more robust models (high strength, variable for RC5 and 128-bit blocks for RC6).
Asymmetric Cryptography
Asymmetric cryptography, also known as public key cryptography, makes use of two distinct keys: a public key and a private key. These keys are mathematically linked; what one key encrypts, only the other can decrypt.
-
Public Key: This key is known to everyone and is used for encrypting messages. Anyone can encrypt a message using the recipient's public key, but only the recipient can decrypt it using their private key.
-
Private Key: This key is kept secret by the owner and is used to decrypt messages encrypted with the corresponding public key. Similarly, the owner can use this key to encrypt a message, and anyone can decrypt it using the public key, confirming that the message is indeed from the owner.
Encryption
In the realm of data security, encryption is a two-way function. To encrypt a message, you use the recipient's public key. This unique key ensures that the message is encrypted specifically for the recipient. The encrypted message can then be decrypted using the recipient's private key.
Example: Online sellers on the dark web often utilize this mechanism when exchanging sensitive information, such as addresses. This ensures that only the intended recipient can access the decrypted information.
Most Significant Public Key Cryptosystems
RSA | The most renowned public-key cryptosystem, developed by Rivest, Shamir, and Adleman in 1977. It relies on the computational difficulty of factoring the product of large prime numbers. This method is widely used in digital signatures, secure email, credit card encryption, and secure remote access systems. |
El Gamal |
An extension of the Diffie-Hellman key exchange algorithm and it operates on principles of modular arithmetic. While it's less common than RSA, it has the advantage of providing semantic security, meaning it's secure against chosen plaintext attacks. A real-world use case of ElGamal is in the GNU Privacy Guard (GPG), a widely used email encryption standard. |
Elliptic Curve Cryptography | Predicated on the difficulty of solving the Elliptic Curve Discrete Logarithm Problem (ECDLP). It offers more security than other algorithms when both keys are the same length. |
The strength of ECC lies in the fact that it provides the same level of security as other algorithms (like RSA) with significantly smaller key sizes. This makes ECC more efficient, as it requires less computational power and memory. This is particularly useful in constrained environments, like mobile devices or embedded systems.
Approved Encryption Algorithms
Algorithm | Type | Key Size (bits) | Strength | Replaced By |
RSA |
Public Key ANSI X9.31 |
1024-4096 | High, but computationally expensive | |
Diffie-Hellman | Key Exchange | 1024-4096 | High, but susceptible to man-in-the-middle attacks | ECDH (Elliptic-Curve Diffie-Hellman) |
ElGamal | Public Key / Digital Signatures | 1024-4096 | High | |
Elliptic Curve Cryptography (ECC) | Public Key | 160-512 | High, less computationally expensive than RSA or Diffie-Hellman | |
Digital Signature Algorithm (DSA)
|
Digital Signatures FIPS 186-4 |
1024-3072 | High | ECDSA (Elliptic Curve Digital Signature Algorithm) |
Additional Information:
-
DSA (Digital Signature Algorithm)
- Specification: FIPS 186-4
- Note: Must use SHA-2 hashing functions as specified by FIPS 186-4
-
RSA (Rivest–Shamir–Adleman)
- Specification: ANSI X9.31
- Note: A widely used public-key algorithm suitable for data transmission
-
ECDSA (Elliptic Curve Digital Signature Algorithm)
- Specification: ANSI x9.62
- Note: Offers greater security for a given key size compared to RSA and DSA
Digital Signatures and Nonrepudiation
To digitally sign a message, you use your own private key. This process provides nonrepudiation, which means it can be proven that the sender actually sent the message. This helps prevent a party from denying their actions.
In a specific scenario, law enforcement had seized a hacking website. The officials attempted to post an update but lacked the private key of the arrested individual. Consequently, suspicions arose among the website's users since the update couldn't be authenticated. To verify a digital signature, the sender's public key is utilized, ensuring that the message was genuinely sent by the purported sender.
A recent instance resembling this situation involves BreachForums. Despite the owner of the site being arrested, it was relaunched with the original owner signing messages using a PGP key. However, since the owner's arrest raises doubts about the ownership of the PGP key itself—potentially sold or stolen—it questions whether the site is a honeypot or not.
Digital Signature Standard (DSS)
Before we delve deeper into hashing, let's touch on DSS (Digital Signature Standard).
DSS operates in conjunction with one of three asymmetric encryption algorithms:
- Digital Signature Algorithm (DSA)
- Rivest, Shamir, Adleman (RSA)
- Elliptic Curve DSA (ECDSA)
These algorithms form the backbone of DSS, ensuring secure and authenticated digital communications. We'll explore hashing and its significance in the upcoming section.
While DSS primarily works with DSA, it can utilize RSA and ECDSA as alternatives, providing versatility in different cryptographic contexts.