0% found this document useful (0 votes)
20 views

2nd Lec - Part1

Uploaded by

amir azeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

2nd Lec - Part1

Uploaded by

amir azeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

Information Security:

Principles and Practice


Chapter 2 – Cryptographic Tools

First Edition
by William Stallings and Lawrie Brown
Lecture slides by Lawrie Brown
Introduction
• Cryptography is a method used to protect information by
transforming it into a form that can only be understood by
authorized individuals.
• cryptography as the science of encoding and decoding information
to keep it secure. Cryptography ensures that only the intended
recipient can understand the message.
• Traditional cryptographic algorithms, also known as classical
cryptography algorithms, were primarily used before the modern
era of cryptography. They focus on methods that either substitute or
scramble text, relying on simple mathematical transformations. Here
are the key types of traditional algorithms:
 Substitution Cipher
 Transposition Cipher
•Monoalphabetic Cipher (e.g., Caesar Cipher)
•Transposition Cipher (e.g., Rail Fence Cipher)
•Vigenère Cipher (Polyalphabetic substitution)
•Playfair Cipher (polyalphabetic cipher)
•Affine Cipher (Mathematical shift)
•Hill Cipher (Linear algebra-based)
•Enigma Machine (Historical cipher machine)
Cryptographic Tools

cryptographic algorithms important element in security services


• review various types of elements
• symmetric encryption
• public-key (asymmetric) encryption
• digital signatures and key management
• secure hash functions
• Example is use to encrypt stored data
Symmetric encryption
Symmetric encryption is a type of encryption where the same key is
used for both encrypting (locking) and decrypting (unlocking) the data.
Example :
When you use a Wi-Fi network secured with WPA2, your device and
the router share a symmetric key to encrypt your internet traffic.
Challenges:
• Key Distribution: The main problem with symmetric encryption is
that both the sender and receiver need to share the same key
securely. If someone intercepts the key, they can decrypt the
message.
Symmetric Encryption
A symmetric encryption scheme has five ingredients ( Figure 2.1 ):

• Plaintext: This is the original message or data that is fed into the algorithm as input.

• Encryption algorithm: The encryption algorithm performs various substitutions and transformations on the plaintext.

• Secret key: The secret key is also input to the encryption algorithm. The exact substitutions and transformations performed
by the algorithm depend on the key.
• Ciphertext: This is the scrambled message produced as output. It depends onthe plaintext and the secret key. For a given
message, two different keys will produce two different ciphertexts.

• Decryption algorithm: This is essentially the encryption algorithm run in reverse. It takes the ciphertext and the secret key
and produces the original plaintext.
Attacking Symmetric Encryption
Cryptanalysis is the study and practice of breaking
cryptographic systems. The attacker tries to figure out the
key or the original message (plaintext) from the encrypted
message (ciphertext).
• rely on nature of the algorithm
• plus some knowledge of plaintext characteristics
• even some sample plaintext-ciphertext pairs
• exploits characteristics of algorithm to deduce specific
plaintext or key
brute-force attack
• try all possible keys on some ciphertext until get an intelligible
translation into plaintext
Exhaustive Key Search
Symmetric Encryption Algorithms
• The most commonly used symmetric encryption algorithms are block
ciphers. A block cipher processes the plaintext input in fixed-size
blocks and produces a block of ciphertext of equal size for each
plaintext block. The algorithm processes longer plaintext amounts as a
series of fixed-size blocks. The most important symmetric algorithms,
all of which are block ciphers, are the Data Encryption Standard
(DES), triple DES, and the Advanced Encryption Standard (AES); as
summarized here in Table 2.2 from the text.
DES and Triple-DES
• Data Encryption Standard (DES) is the most widely
used encryption scheme
• uses 64 bit plaintext block and 56 bit key to produce a 64
bit ciphertext block
• concerns about algorithm & use of 56-bit key
• Triple-DES
• repeats basic DES algorithm three times
• using either two or three unique keys
• much more secure but also much slower
Advanced Encryption Standard
(AES)
• needed a better replacement for DES
• NIST called for proposals in 1997
• efficiency, security, HW/SW suitability, 128, 256, 256 keys
• selected Rijndael in Nov 2001
• symmetric block cipher
• uses 128 bit data & 128/192/256 bit keys
• now widely available commercially
Block verses Stream Ciphers

Block ciphers encrypt data in fixed-size blocks (typically 64 or 128 bits).


If the plaintext is larger than the block size, it’s divided into multiple
blocks and encrypted separately.
Operation: Each block of plaintext is encrypted using the same key,
and padding is often required if the data doesn’t align perfectly with
the block size.
Examples: AES (Advanced Encryption Standard), DES (Data Encryption
Standard).
Stream ciphers

Stream ciphers encrypt data one bit or one byte at a time, producing a
continuous stream of encrypted data.
Operation: Instead of dividing data into blocks, stream ciphers generate
a key stream, which is combined with the plaintext on a bit-by-bit or
byte-by-byte basis (often using XOR).
Examples: RC4, Salsa20, ChaCha20.
Block
verses
Stream
Ciphers
Message Authentication
• Encryption protects against passive attack (eavesdropping).
• message or data authentication protects against active attacks
• verifies received message is authentic
• contents unaltered
• from authentic source
• timely and in correct sequence
• can use conventional encryption
• only sender & receiver have key needed
• or separate authentication mechanisms
• append authentication tag to cleartext message
• . Furthermore, if the message includes an error-detection code and a
sequence number, the receiver is assured that no alterations have been
made and that sequencing is proper. If the message also includes a
timestamp, the receiver is assured that the message has not been
delayed beyond that normally expected for network transit.
Message Authentication without Message
Encryption
• In all of these approaches, an authentication tag is generated and
appended to each message for transmission.
• Because the approaches discussed in this section do not encrypt the
message,message confidentiality is not provided.
• Typically, however, message authentication is
provided as a separate function from message encryption
MESSAGE AUTHENTICATION CODE
• One authentication technique involves the use of a secret key to generate a small
block of data, known as a message authentication code, that is appended to the
message.
• This technique assumes that two communicating parties, say A and B, share a
common secret key KAB. When A has a message to send to B, it calculates the
message authentication code as a
• complex function of the message and the key: MACM F(KAB, M).
• The message plus code are transmitted to the intended recipient.
• The recipient performs the same
• calculation on the received message, using the same secret key, to
generate a new
• message authentication code. The received code is compared to the
calculated code
• ( Figure 2.4 ). If we assume that only the receiver and the sender
know the identity of
• the secret key, and if the received code matches the calculated code,
then
1. The receiver is assured that the message has not been altered.why?
2. The receiver is assured that the message is from the alleged
sender.Why?
3. If the message includes a sequence number , then the receiver can
be assured of the proper sequence,why?
Message Authentication Codes
ONE-WAY HASH FUNCTION
• An alternative to the message authentication code is the one-way hash function.
As with the message authentication code, a hash function
• accepts a variable-size message M as input and produces a fixed-size message
digest
• H(M) as output ( Figure 2.5 ). Typically, the message is padded out to an integer
multiple of some fixed length (e.g., 1024 bits) and the padding includes the value
of the length of the original message in bits. The length field is a security measure
to increase the difficulty for an attacker to produce an alternative message with
the same hash value.
Secure Hash Functions
Example
• SHA-256(HelloWorld) =
A591A6D40BF420404A011733CFB7B190D62C65BF0BCDA32B26D34
60B4527E691
Secure Hash Functions
• The one-way hash function, or secure hash function, is important not
only in message authentication but in digital signatures.
Hash Function Requirements
• applied to any size data
• H produces a fixed-length output.
• H(x) is relatively easy to compute for any given x
• one-way property
• computationally infeasible to find x such that H(x) = h
• weak collision resistance
• computationally infeasible to find y ≠ x such tha H(y) = H(x)
• strong collision resistance
• computationally infeasible to find any pair (x, y) such that H(x) = H(y)
Hash Functions
• SHA most widely used hash algorithm
• SHA-1 gives 160-bit hash
• more recent SHA-256, SHA-384, SHA-512 provide improved
size and security
Public Key Encryption
• Public-key encryption, first publicly proposed by Diffie and Hellman
in 1976 is the first truly revolutionary advance in encryption in
literally thousands of years. Public-key algorithms are based on
mathematical functions rather than on simple operations on bit
patterns. More important, public-key cryptography is asymmetric,
involving the use of two separate keys, in contrast to the symmetric
conventional encryption, which uses only one key
• In fact, the security of any encryption
• scheme depends on (1) the length of the key and (2) the
computational work involved in breaking a cipher.
• A public-key encryption scheme has six ingredients, as shown here in Figure 2.6a:
• Plaintext: the readable message or data that is fed into the algorithm as input.
• Encryption algorithm: performs various transformations on the plaintext.
• Public and private key: a pair of keys selected so that if one is used for encryption, the other is used for
decryption. The exact transformations performed by the encryption algorithm depend on the public or private
key that is provided as input.
• Ciphertext: the scrambled message produced as output that depends on the plaintext and key.
• Decryption algorithm: takes ciphertext and key to produces the original plaintext.
• As the names suggest, the public key of the pair is made public for others to use, while the private key is
known only to its owner. A public-key cryptographic algorithm relies on one key for encryption and a
different but related key for decryption. All participants have access to public keys, and private keys are
generated locally by each participant and therefore need never be distributed. As long as a user protects his or
her private key, incoming communication is secure.
Public Key Encryption
Public Key Authentication
Authentication and/or data integrity
Public Key Algorithms
• RSA (Rivest, Shamir, Adleman)
• developed in 1977
• only widely accepted public-key encryption alg
• given tech advances need 1024+ bit keys
• Diffie-Hellman key exchange algorithm
• only allows exchange of a secret key
• Digital Signature Standard (DSS)
• provides only a digital signature function with SHA-1
• Elliptic curve cryptography (ECC)
• new, security like RSA, but with much smaller keys
Digital Signature
• Public-key encryption can be used for authentication. as suggested by
Figure 2.6b.
• Suppose that Bob wants to send a message to Alice. Although it is not important that the message be kept
secret, he wants Alice to be certain that the message is indeed from him. For this purpose, Bob uses a secure
hash function, such as SHA-512, to generate a hash value for the message and then encrypts the hash code
with his private key, creating a digital signature . Bob sends the message with the signature attached. When
Alice receives the message plus signature, she (1) calculates a hash value for the message; (2) decrypts the
signature using Bob’s public key; and (3) compares the calculated hash value to the decrypted hash value. If
the two hash values match, Alice is assured that the message must have been signed by Bob. No one else
has Bob’s private key and therefore no one else could have created a ciphertext that could be decrypted with
Bob’s public key. In addition, it is impossible to alter the message
• without access to Bob’s private key, so the message is authenticated both in terms of source and in terms of
data integrity
• It is important to emphasize that the digital signature does not
provide confidentiality.
• That is, the message being sent is safe from alteration but not safe
from eavesdropping. This is obvious in the case of a signature based
on a portion of the message, because the rest of the message is
transmitted in the clear.
Problem
• How does Alice really know that she is using Bob’s public key?
• How does Alice know she really is using Bob’s public key and it isn’t
someone pretending to be Bob?
Public-Key Certificates

• Digital certificates are issued to individuals by a certificate authority


(CA), a private company that charges either the user or the receiver
for issuing a certificate. The company DocuSign is an example of an
issuer of digital certificates.
• Your digital certificate will contain:
• your name
• the name of the certificate authority
• a unique certificate serial number, its expiration date, etc.
• a unique private key (to include with messages you send)
• the digital signature of the CA

You might also like