Unit 2 - Cryptography
Unit 2 - Cryptography
Introduction to Cryptography
The main idea behind confusion is to make the relationship between the
plaintext and the ciphertext as complex and unpredictable as possible.
In other words, the goal is to ensure that the statistics of the plaintext do
not reflect in the statistics of the ciphertext.
Diffusion
Diffusion aims to spread out the influence of individual plaintext bits over
the entirety of the ciphertext.
That is, a change in a single bit of the plaintext or the key should affect
many bits of the ciphertext.
Symmetric Encryption
Asymmetric Encryption
End-to-End Encryption
What is Cryptoanalysis
Cryptanalysis is the study of analyzing cryptographic systems
and methods with the intention of understanding them and
finding their weaknesses.
Examples include the rail fence cipher, route cipher, and Myszkowski
transposition.
Modern ciphers are designed to withstand a wide range of attacks. They
provide message secrecy, integrity, and authentication of the sender.
A user can calculate a modern cipher using a one-way mathematical
function that is capable of factoring large prime numbers.
Modern Ciphers
Based on the type of key used
• Symmetric-key algorithms (Private-key cryptography): Use the same key for
encryption and decryption.
• Asymmetric-key algorithms (Public-key cryptography): Use two different keys for
encryption and decryption.
Data Integrity
Password Storage:
Cryptographic Applications (Blockchain)
The password and the salt are combined, and then this combined value
is hashed.
By adding this randomness via the salt, even if two users have the same
password, their hashes will differ because their salts are different.
The salt, even though it's stored in plaintext alongside the hash, ensures
that precomputed tables (like rainbow tables) become ineffective because
an attacker would need a different table for each possible salt.
Salting (Why Not Just Hashing?)
Cont’d
When a user creates an account or changes their password:
You can determine which one is being used by looking at the /etc/shadow
file or by examining the configuration in /etc/pam.d.
What About Windows
Windows uses different mechanisms and algorithms depending on the
purpose and the version of the operating system. Here are some key areas
where hashing is employed:
NTLM Hash (NT LAN Manager hash): Used from Windows NT onwards
and is more secure than LM, but still has known vulnerabilities.
If an attacker has physical access to a machine, they can boot the system
using an external operating system (e.g., a Linux live CD) to access the
SAM file directly and extract its contents.
Mimikatz is a famous tool known for its ability to extract the hashed
passwords from SAM database
Hash Message Authentication
Code (HMAC)
The hash-based message authentication code (HMAC) is a type of
message authentication code (MAC) that uses a cryptographic key along
with a cryptographic hash function.
It is widely used for verifying the integrity of data and authentication of a
message.
The strength of the HMAC depends on the embedded hash function, key
size, and the size of the hash output.
Hash Message Authentication
Code (HMAC)
Hash Message Authentication
Code (HMAC) Application
Digital Signature
Digital Signature (Cont’d)
PGP (Pretty Good Privacy)
Let’s Play with Hashing
Hashing Concepts
https://tools.superdatascience.com/blockchain/hash/
https://tools.superdatascience.com/blockchain/public-private-k
eys/signatures
Digital Certificates (HTTPS)
Digital Certificates (Cont’d)
How does it work?
How Does Certificate Authority
work?
Self Signed Certificate
A self-signed certificate is a security certificate that is not signed by a
certificate authority (CA).
Website visitors who bypass such warnings are exposed to a risk that a
third party could intercept traffic to the website using the third-party's
own self-signed certificate.
Self Signed Certificate (Cont’d)
SSL/TLS
SSL stands for Secure Sockets Layer and, in short, it's the standard
technology for keeping an internet connection secure and safeguarding
any sensitive data that is being sent between two systems.
The attacker "replays" the captured data to either impersonate one of the
parties or to repeat a specific transaction.
The following are some tools used for the cracking process:
Hashcat
Hydra
John the ripper
Aircrack-ng (Used for wifi password cracking)
What about Encoding like
Base64?
Questions?