Encryption and Decryption using Vigenere with Cipher Block Chaining: Up to 50 dollars will be given
Cryptographic Tools Dr. Y. Chu CIS3360: Security in Computing 0R02 Spring 2018
1
Information
Reading: Textbook Chapter 2
Some of the slides and figures are from textbook slides distributed by Pearson
2
Encryption
Definition
Encryption is the process of encoding a message or information in such a way that only authorized parties can access it and those who are not authorized cannot.
3
secure
sender
secure
receiver
data
data
Alice
Bob
Eve
Symmetric Encryption
Universal technique for providing confidentiality for transmitted or stored data
Also referred to as conventional encryption or single-key encryption
Two requirements for secure use:
Need a strong encryption algorithm
Sender and receiver must have obtained copies of the secret key in a secure fashion and must keep the key secure
4
Symmetric Encryption Model
Plaintext
The original message or data, input to the encryption algorithm
Encryption algorithm
The algorithm performs various substitutions and transformations on the plaintext.
Secret key
Another input to the encryption algorithm. The exact substitutions and transformations performed by the algorithm depend on the key.
Ciphertext:
The scrambled message produced as output. It depends on the 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.
5
Figure 2.1 in textbook
Attacking Symmetric Encryption
Cryptanalytic Attacks
Rely on:
Nature of the algorithm
Some knowledge of the general characteristics of the plaintext
Some sample plaintext-ciphertext pairs
Exploits the characteristics of the algorithm to attempt to deduce a specific plaintext or the key being used
If successful all future and past messages encrypted with that key are compromised
Brute-Force Attack
Try all possible keys on some ciphertext until an intelligible translation into plaintext is obtained
On average half of all possible keys must be tried to achieve success
6
Popular Encryption Algorithms
7
Table 2.1 in textbook
7
Data Encryption Standard (DES)
The most widely used encryption scheme
FIPS PUB 46
Data Encryption Algorithm (DEA)
64 bit plaintext block and 56 bit key to produce a 64 bit ciphertext block
Strength concerns:
Concerns about algorithm
DES is the most studied encryption algorithm in existence
Use of 56-bit key
Electronic Frontier Foundation (EFF) announced in July 1998 that it had broken a DES encryption
8
Triple DES (3DES)
Repeats basic DES algorithm three times using either two or three unique keys
First standardized for use in financial applications in ANSI standard X9.17 in 1985
Attractions:
168-bit key length overcomes the vulnerability to brute-force attack of DES
Underlying encryption algorithm is the same as in DES
Drawbacks:
Algorithm is sluggish in software
Still uses a 64-bit block size
9
American National Standards Institute
Software designed for 70’s hardware, not efficient
Advanced Encryption Standard (AES)
NIST in 1997 issued a call for proposals for a new Advanced Encryption Standard
Security strength equal to or better than 3DES
Significantly improved efficiency
Symmetric block cipher
128 bit data and 128/192/256 bit keys
NIST selected Rijndael algorithm (FIPS PUB 197)
10
Decryption Time
11
Table 2.2 in textbook
Practical Security Issues
Typically symmetric encryption is applied to a unit of data larger than a single 64-bit or 128-bit block
Electronic codebook (ECB) mode is the simplest approach to multiple-block encryption
Each block of plaintext is encrypted using the same key
Cryptanalysts may be able to exploit regularities in the plaintext
Modes of operation
Alternative techniques developed to increase the security of symmetric block encryption for large sequences
Overcomes the weaknesses of ECB
12
Block Cipher
13
Block cipher
Processes the input one block of elements at a time
Produces an output block for each input block
Can reuse keys
More common
ECB
Stream Cipher
Processes the input elements continuously
Produces output one element at a time
Primary advantage is that they are almost always faster and use far less code
Encrypts plaintext one byte at a time
Pseudorandom stream is one that is unpredictable without knowledge of the input key
14
Message Authentication
Encryption assures confidentiality
Message authentication assures data integrity: verifies received message is authentic
Contents have not been altered
From authentic source
Timely and in correct sequence
Message authentication can be performed either with or without encryption
Symmetric encryption alone may not be good for message authentication: reorder attack
Message authentication without encryption
Broadcast
Heavy load and cannot decrypt all messages
Computer program authentication
15
Message Authentication Code (MAC)
Authentication technique
The use of a secret key to generate a small block of data
Assuming both parties share same secret key and MAC algorithm
Message can include a sequence number
FIPS PUB 113, recommends the use of DES. DES is used to generate an encrypted version of the message, and the last 16 or 32 bits of ciphertext are used as MAC.
16
Secure Harsh Function
One-way hash function
Given hash value it is infeasible to find the original message
Message digest H(M)
Accepts a variable-size message M as input and produces a fixed-size message digest or harsh value or harsh code
17
17
Hash Function Requirements
For any hash function
can be applied to an entire message or file of any size
produces a fixed-length output
computationally easy to compute
For a secure hash function, all above, plus
must be one-way (pre-image resistant)
infeasible to find x from H( x )
must be collision resistant
for a given message, infeasible to find another message that generates the same hash value
infeasible to find 2 messages that generate the same hash value
Uses for secure hash functions
MACs, digital signatures, and integrity checking
18
Message Authentication with Secure Hash Function
Hash function does not take a secret key as input.
To authenticate a message, the message digest can be encrypted with the secret key
19
Security of Secure Hash Function
Attacks on secure hash function
Cryptanalysis
Exploit logical weaknesses in the algorithm
Brute-force attack
Strength of hash function depends on the length of the hash code produced by the algorithm
SHA (Secure Hash Algorithm) most widely used hash algorithm
FIPS 180 (1993): SHA
FIPS 180-1 (1995): SHA-1 (160 bits)
FIPS 180–2 (2002): SHA-2
SHA-256, SHA-384, and SHA-512
Other uses
Passwords
Hash of a password stored by an operating system
Intrusion detection
Store H(F) for each file on a system and secure the hash values. Later check if a file has been modified.
20
Public-Key Encryption
First proposed by Diffie and Hellman in 1976
Based on mathematical function rather than simple operations on bit patterns
Asymmetric
Uses two separate keys: public key and private key
Public key is made public for others to use
Usage example
To send a message, the sender encrypts the message using the receiver's public key
The receiver uses his private key to decrypt the message.
Solves key distribution and digital signature issues, but algorithms run much slower than symmetric algorithms.
Computationally expensive, symmetric encryption still the method most used for data encryption
Still need some form of protocol for distributing keys
21
21
Public-Key Encryption Model
Plaintext
Readable message or data that is fed into the algorithm as input
Encryption algorithm
Performs transformations on the plaintext
Public and private key
Pair of keys, one for encryption, one for decryption
Ciphertext
Scrambled message produced as output
Decryption algorithm
Produces the original plaintext
22
Public-Key Cryptography
Other way to use public key: provide authentication and integrity
Only Bob has his private key
Authentication - only Bob could have encrypted the plaintext
Integrity - no one but Bob would be able to modify the plaintext
23
Requirements for Public-Key Cryptosystems
Computationally easy to create key pairs
Useful if either key can be used for each role
Computationally infeasible for opponent to otherwise recover original message
Computationally infeasible for opponent to determine private key from public key
Computationally easy for sender who knows public key to encrypt messages
Computationally easy for receiver who knows private key to decrypt ciphertext
24
Application of Public Key
Encryption,
Computationally expensive, not popular
Diffie-Hellman key exchange
Use public-key encryption to distribute a shared secret key
The secrete key then can be used for symmetric encryption
Authentication
Digital signature
Use authentication scenario, but encrypt a hash value, not the message
Key management and distribution
used with certificate authorities (CAs) to assure recipients that alleged public key is genuine
25
Digital Certificates
Used for authenticating both source and data integrity
Created by encrypting hash code with private key
Does not provide confidentiality
Even in the case of complete encryption
Message is safe from alteration but not eavesdropping
Message can be decrypted using sender’s public key
26
Public Key Management
In public key scenario, how can Alice know that the public key she is using for Bob is really his public key?
Digital certificates (DC)
Issued by trusted entities called certificate authorities (CA)
A digital certificate vouches for Bob and contains Bob’s public key
DC is digitally signed by the CA using its private key; Alice uses the CA’s public key to verify the CA’s signature
Alice now trust that they have a valid public key for Bob, since they trust the CA.
This is not fool-proof. It is merely “strong evidence” of Bob’s public key
27
Digital Envelopes
Another way to use public-key encryption to protect symmetric key
Protects a message without arranging for sender and receiver to have the same secret key
Similar to a sealed envelope containing an unsigned letter
Process
Uses a one-time symmetric key
Key is encrypted using receiver's public key and sent to receiver
28
Random Numbers
Uses
Keys for public-key algorithms
Stream key for symmetric stream cipher
Symmetric key for use as a temporary session key or in creating a digital envelope
Handshaking to prevent replay attacks
Session key
Requirements
Randomness
Uniform distribution
Frequency of occurrence of each of the numbers should be approximately the same
Independence
No one value in the sequence can be inferred from the others
Unpredictability
Opponent should not be able to predict future element of sequence on basis of earlier elements
29
Random vs. Pseudorandom
Cryptographic applications typically make use of algorithmic techniques for random number generation.
These algorithms are deterministic and produce sequences of numbers that are not statistically random
Pseudorandom numbers
Sequences that satisfy statistical randomness tests (uniformity, independence)
Can be predictable
True random number generator (TRNG)
Uses a nondeterministic source to produce randomness
Most operate by measuring unpredictable natural processes
e.g. radiation, gas discharge, leaky capacitors
Increasingly provided on modern processors
30
Encryption of Stored Data
Situation
Common to encrypt transmitted data, much less common for stored data
There is often little protection beyond domain authentication and operating system access controls
Data are archived for indefinite periods
Even though erased, until disk sectors are reused data are recoverable
Approaches
Use a commercially available encryption package
Pretty Good Privacy (PGP) enables to generate a key from password
Back-end appliance
Encrypts all data going from server to the storage
Library based tape encryption
Co-processor embedded in library hardware encrypts data using a non readable key
Background laptop/PC data encryption
Software that encrypts all or part of data
Transparent to users and applications
31
Summary
Symmetric Encryption
Symmetric Encryption Model
Popular Encryption Algorithms
DES
3DES
AES
Block Cipher vs Stream Cipher
Message Authentication
Message Authentication Code (MAC)
Secure Harsh Function
Public-Key Encryption
Digital Certificates
Public Key Certificate
Digital Envelopes
Random Numbers
Encryption of Stored Data
32
Key size (bits) Cipher
Number of Alternative
Keys Time Required at 109
decryptions/s
Time Required at 1013
decryptions/s 56 DES 256 ≈ 7.2 × 1016 255 ns = 1.125 years 1 hour
128 AES 2128 ≈ 3.4 × 1038 2 127 ns = 5.3 × 1021
years 5.3 × 10 17 years
168 Triple DES 2168 ≈ 3.7 × 1050 2 167 ns = 5.8 × 1033
years 5.8 × 10 29 years
192 AES 2192 ≈ 6.3 × 1057 2191 ns = 9.8 × 1040 years
9.8 × 1036 years
256 AES 2256 ≈ 1.2 × 1077 2255 ns = 1.8 × 1060 years
1.8 × 1056 years
Key size
(bits) Cipher
Number of
Alternative
Keys
Time Required at 10
9
decryptions/s
Time Required
at 10
13
decryptions/s
56 DES
2
56
≈ 7.2 ´ 10
16
2
55
ns = 1.125 years
1 hour
128
AES
2
128
≈ 3.4 ´ 10
38
2
127
ns = 5.3 ´ 10
21
years
5.3 ´ 10
17
years
168
Triple DES
2
168
≈ 3.7 ´ 10
50
2
167
ns = 5.8 ´ 10
33
years
5.8 ´ 10
29
years
192 AES
2
192
≈ 6.3 ´ 10
57
2
191
ns = 9.8 ´ 10
40
years
9.8 ´ 10
36
years
256 AES
2
256
≈ 1.2 ´ 10
77
2
255
ns = 1.8 ´ 10
60
years
1.8 ´ 10
56
years