Lecture 2 - Cryptographic Building Blocks
Lecture 2 - Cryptographic Building Blocks
Blocks
3
Learning Objectives
4
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
5
Introduction
6
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
7
Generic Concepts
Encryption and Decryption
▪ Recall: An algorithm is a series of steps, often implemented in
software programs or hardware.
▪ Encryption (and Decryption) algorithms are a fundamental
means for providing Data Confidentiality,
▪ Especially in Distributed Communications Systems (e.g. Internet)
▪ They are parameterized by a Cryptographic Key;
▪ Conceptualize a key as a binary string representing a large secret
number
8
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
9
Generic Concepts
Plaintext and Ciphertext
▪ Encryption transforms data ▪ Only authorized parties are
given access to this key.
(Plaintext) into an unintelligible
form (Ciphertext). ▪ Sensitive Information should
be Encrypted before:
▪ The process is Reversible:
▪ Transmission
▪ Decryption Key allows recovery
of plaintext, using a ▪ If data is subject to
eavesdropping
corresponding Decryption
Algorithm ▪ Saving to Storage Media
▪ Access to the Decryption Key ▪ If concerned about access
controls access to the
Plaintext;
10
Generic Concepts
Plaintext and Ciphertext
11
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
12
Generic Concepts
Generic Encryption Notation
▪ Let
▪ m = Plaintext message
▪ c = the Ciphertext
▪ Ek, Dk’ = the Encryption, Decryption algorithms Respectively
▪ k, k’ = Parameterized Symmetric Keys for Encryption and Decryption
Respectively.
▪ Encryption and Decryption is denoted as follows
c = Ek(m) m = Dk’(c)
13
14
Generic Encryption Notation
15
Example | Caesar Cipher
▪ Caesar’s famous Cipher was rather simple.
▪ The encryption algorithm simply substituted each alphabetic
plaintext character by that occurring three letters later in the
alphabet.
▪ Watch the Video
▪ Exercise
▪ Mathematically Describe the algorithms of the Caesar cipher.
▪ What is the Cryptographic Key?
▪ How many other keys could be Chosen?
16
Lecture Outline | Progress
▪ Introduction ▪ Stream Ciphers
▪ Block Ciphers
▪ Generic Concepts
▪ Public Key Encryption and
▪ Encryption and Decryption
Decryption
▪ Plaintext and Cyphertext
▪ Key Distribution
▪ Encryption Notation
▪ Hybrid Encryption
▪ Exhaustive Key Search
▪ Digital Signatures Using Public Keys
▪ Cipher Attack Models
▪ Cryptographic Hash Functions
▪ Encryption and Decryption
▪ Symmetric-Key Encryption and
Decryption ▪ Public Key Certificates
17
Generic Concepts
Exhaustive Key Search
▪ Cryptographers should provide “good” algorithms for Encryption
and Decryption.
▪ A critical Property is that it be infeasible to recover Plaintext from
Ciphertext without knowledge of the key.
▪ When a Ciphertext is intercepted, the best an adversary can do, is
▪ Go through all keys k from the key space K,
▪ Parameterizing D with each k sequentially,
▪ Computing each Dk(c) and looking for some meaningful result
▪ This process is called an Exhaustive Key Search.
18
Generic Concepts
Exhaustive Key Search
19
Example | DES Key Space
20
Example | The Enigma Machine
▪ The Enigma machine is a Cipher device developed
and used in the early- to mid-20th century to protect
Commercial, Diplomatic, and Military Communication.
▪ It was employed extensively by Nazi Germany during
World War II.
▪ The Enigma machine was considered so secure that it
was used to encipher the most top-secret messages
▪ Poland cracked the machine prior to the war,
▪ This enabled the Allies to exploit Enigma-enciphered
messages as a major source of intelligence
21
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
22
Cipher Attack Models
24
Summary of Attack Types
25
Cipher Attack
Passive Vs Active Adversary
▪ A Passive Adversary observes ▪ An Active Adversary interacts
and records but does not alter with ongoing transmissions, by
information. ▪ Injecting data
▪ For example: ▪ Altering data
▪ Ciphertext-only Attacks ▪ Starts new interactions with
▪ Known-Plaintext attacks legitimate parties.
▪ For example
▪ Chosen-Plaintext Attacks
▪ Chosen-ciphertext Attacks
26
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
27
Types of Encryption and Decryption
28
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
29
Symmetric-key Encryption and Decryption
30
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
31
Classes of Symmetric-Key Encryption and Decryption
Stream Ciphers
▪ Each Plaintext digit is encrypted one at a time with the
corresponding digit of the keystream, to give a digit of the
Ciphertext stream.
▪ Usage example: e.g., User-typed characters sent to a remote site in
real time.
▪ It needs a Key with the same length as the Plaintext
▪ In practice, a digit is typically a bit and the combining operation is an
exclusive-or (XOR).
32
Classes of Symmetric-Key Encryption and Decryption
Stream Ciphers
33
Stream Ciphers | Example
▪ Plaintext "HELLOWORLD"
▪ Stream of key bits "1011010101".
34
Stream Ciphers | Example
Step 1: Plaintext and Key Bit Stream
▪ Plaintext: H E L L O W O R L D
▪ Key Bit Stream: 1 0 1 1 0 1 0 1 0 1
35
Stream Ciphers | Example
Step 2: Converting Plaintext to Binary
36
Stream Ciphers | Example
Step 3: XOR Operation with Key Bit Stream
▪ We perform an XOR operation between each bit of the
plaintext (in binary form) and the corresponding key bit
from the key bit stream.
▪ Plaintext (Binary): 01001000 01000101 01001100 01001100
01001111 01010111 01001111 01010010 01001100 01000100
▪ Key Bit Stream: 1 0 1 1 0 1 0 1 0 1
▪ XOR Result: 11111101 11110000 11111001 11111001 11111010
11100010 11111010 11100111 11111001 11110001
37
Stream Ciphers | Example
Step 4: Converting Binary to ASCII
38
Stream Ciphers | Example
Step 5: Converting ASCII to Ciphertext
▪ Finally, convert the ASCII values obtained from the XOR
operation to their corresponding characters to get the
Ciphertext.
▪ Ciphertext: ýðùùúâúçùñ
▪ Given key bit stream "1011010101", the plaintext "HELLOWORLD" is
encrypted to " ýðùùúâúçùñ"
▪ Note: Same KEY bit stream must be used for both encryption and
decryption in a Stream Cipher to obtain the original plaintext.
39
Lecture Outline | Progress
▪ Introduction ▪ Stream Ciphers
▪ Block Ciphers
▪ Generic Concepts
▪ Public Key Encryption and
▪ Encryption and Decryption
Decryption
▪ Plaintext and Cyphertext
▪ Key Distribution
▪ Encryption Notation
▪ Hybrid Encryption
▪ Exhaustive Key Search
▪ Digital Signatures Using Public Keys
▪ Cipher Attack Models
▪ Cryptographic Hash Functions
▪ Encryption and Decryption
▪ Symmetric-Key Encryption and
Decryption ▪ Public Key Certificates
40
Classes of Symmetric-Key Encryption and Decryption
Block Ciphers
▪ Processes Plaintext in fixed- ▪ Key-length: Key size in bits
length Chunks or Blocks ▪ If the last Plaintext block has
▪ Each block is encrypted with a fewer bits than the block-length, it
fixed transformation dependent is Padded with “filler” characters.
on the Key. ▪ A common non-ambiguous
▪ From an input-output perspective, Padding Rule is to always append
a Block Cipher’s main properties a 1-bit, followed by zero or more
are 0-bits as necessary to fill out the
blockchunks or blocks
▪ Block-length: Block size in bits
41
Block Ciphers | Example
▪ Plaintext: "HELLOWORLD"
▪ Block size of 4 characters
▪ with a key "KEY1".
42
Block Ciphers | Example
Step 1: Plaintext and Key
▪ Plaintext: H E L L O W O R L D
▪ Block Size: 4 characters
▪ Key: KEY1
43
Block Ciphers | Example
Step 2: Padding
44
Block Ciphers | Example
Step 3: Converting Plaintext and Key to ASCII
45
Block Ciphers | Example
Step 4: Applying Block Cipher Algorithm
▪ Block cipher Algorithm, involves ▪ Produce Ciphertext (ASCII): 3 0 21
operations such as Substitution, 125
Permutation, and Mixing, to each ▪ Block 2:
block of plaintext and the key. ▪ Plaintext (ASCII): 79 87 79 82 XOR
▪ Specific algorithm depends on the Key (ASCII): 75 69 89 49
block cipher used (e.g., AES, DES, ▪ Produce Ciphertext (ASCII): 4 18 22
etc.), 99
▪ For this example, we’ll use a basic ▪ Block 3:
XOR operation.
▪ Plaintext (ASCII): 76 68 88 88 XOR
▪ Block 1: Key (ASCII): 75 69 89 49
▪ Plaintext (ASCII): 72 69 76 76 XOR ▪ Produce Ciphertext (ASCII): 7 1 1 105
Key (ASCII): 75 69 89 49
46
Block Ciphers | Example
Step 5: Converting ASCII to Ciphertext
47
Assignment | Read on the Atalla Key Block
▪ Invented by Mohamed Atalla, the Atalla key block is the root of all
key blocks.
▪ In 1972, Atalla filed U.S. Patent 3,938,091 for a remote PIN verification
system, which utilized encryption techniques to assure telephone link
security while entering personal ID information, which would be
transmitted as encrypted data over telecommunications networks to a
remote location for verification
▪ All over the globe, hundreds of millions of financial transactions
are secured daily using Hardware Security Modules (HSMs) and
the Atalla key block…Read More
48
Example | AES Block Cipher
▪ Today’s most widely used Block government.
Cipher is AES, ▪ It supersedes the Data Encryption
▪ It was specified by the Advanced Standard (DES)
Encryption Standard. ▪ AES is included in the ISO/IEC
▪ Created by researchers at Flemish 18033-3 standard.
university KU Leuven with the ▪ a U.S. federal government standard
Original algorithm named Rijndael in 2002
▪ It was selected after an open, multi- ▪ The first (and only) publicly
year competition run by NIST accessible cipher approved by the
▪ AES has been adopted by the U.S. NSA for top secret information
49
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
50
Public-key Encryption and Decryption
▪ Recall: For symmetric-key encryption, k denoted a key shared
between two parties.
▪ For public-key encryption, keys are labelled with a subscript
denoting the single party they belong to
▪ For example: Each party has a key pair (eB,dB) for Bob,
▪ An Encryption public key eB, which can be publicized as belonging to
Bob,
▪ A Decryption private key dB, which Bob should keep secret and share
with no one.
51
Public-key Encryption and Decryption
52
Integrity of Public Key Is Important
53
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
54
Key Distribution | Symmetric Vs Public key
55
Lecture Outline | Progress
▪ Introduction ▪ Stream Ciphers
▪ Block Ciphers
▪ Generic Concepts
▪ Public Key Encryption and
▪ Encryption and Decryption
Decryption
▪ Plaintext and Cyphertext
▪ Key Distribution
▪ Encryption Notation
▪ Hybrid Encryption
▪ Exhaustive Key Search
▪ Digital Signatures Using Public Keys
▪ Cipher Attack Models
▪ Cryptographic Hash Functions
▪ Encryption and Decryption
▪ Symmetric-Key Encryption and
Decryption ▪ Public Key Certificates
56
Hybrid Encryption
57
Lecture Outline | Progress
▪ Introduction ▪ Stream Ciphers
▪ Block Ciphers
▪ Generic Concepts
▪ Public Key Encryption and
▪ Encryption and Decryption
Decryption
▪ Plaintext and Cyphertext
▪ Key Distribution
▪ Encryption Notation
▪ Hybrid Encryption
▪ Exhaustive Key Search
▪ Digital Signatures Using Public
▪ Cipher Attack Models Keys
▪ Encryption and Decryption ▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
Decryption
58
Digital Signatures and Verification using
Public Keys
59
Properties of Digital Signatures
▪ Data Origin Authentication
▪ Assurance of who originated (signed) a message or file.
▪ Data Integrity
▪ Assurance that received content is the same as that originally
signed.
▪ Non-Repudiation biometrics a good example
61
62
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
63
Cryptographic Hash Functions
64
65
Cryptographic Hash Functions | a Hash Value
66
Cryptographic Hash Functions | Properties
68
One-way Hash Functions
69
Using ONE-WAY Functions in Password
Verification
▪ One-way hash functions H are often used in password
authentication as follows.
▪ A user-id + password p entered on a client device are sent to a Server.
▪ The Server hashes the p received to H(p) and uses the user-id to index
a data record containing the (known-correct) password hash.
▪ If the values match, login succeeds.
▪ This is done to avoid storing Plaintext passwords at the server,
▪ Which might be directly available to anyone with access to backup
storage, or via server database break-ins
70
Lecture Outline | Progress
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
71
Public-Key Certificates
▪ A Public-key Certificate is a Authority (CA).
data structure whose ▪ The signature means the CA
has verified that the named
primary fields are subject is legitimate
▪ A Subject Name ▪ Parties that rely on the
▪ A Public Key asserted to certificate require an
belong to that subject authentic copy of the CA’s
verification public key to verify
▪ A Digital Signature (over these
the CA’s signature,
and other fields) by a third
▪ Hence, the certificate’s
party called a Certification integrity
72
Certification Authorities
73
Certificate Revocation
▪ Certificates also include: validity, which by default continues
until the expiry date
▪ A Serial number to uniquely identify
▪ To be terminated earlier (e.g., if
the certificate there is a compromise).
▪ An Expiry date
▪ The Revocation Information
▪ Identity information for the CA
indicates how relying parties can
▪ Algorithm identifiers get further details, e.g.,
▪ For the embedded public key, and
the CA’s signature
▪ a signed list of revoked certificates,
▪ Revocation information ▪ the URL of a trusted site to contact
for a real-time status check of a
▪ The latter allows a certificate’s
certificate’s validity
74
Lecture Outline | End
▪ Introduction Decryption
▪ Generic Concepts ▪ Stream Ciphers
▪ Block Ciphers
▪ Encryption and Decryption
▪ Public Key Encryption and
▪ Plaintext and Cyphertext
Decryption
▪ Encryption Notation
▪ Key Distribution
▪ Exhaustive Key Search
▪ Hybrid Encryption
▪ Cipher Attack Models
▪ Digital Signatures Using Public Keys
▪ Encryption and Decryption
▪ Cryptographic Hash Functions
▪ Symmetric-Key Encryption and
▪ Public Key Certificates
75