Page 1
BỘ MÔN ĐIỆN TỬ HÀNG KHÔNG VŨ TRỤ
4/27/2016 1
TRƯỜNG ĐẠI HỌC BÁCH KHOA HÀ NỘIVIỆN ĐIỆN TỬ - VIỄN THÔNG
Môn học:
LÝ THUYẾT MẬT MÃ
Giảng viên: PGS.TS. Đỗ Trọng Tuấn
Email: [email protected]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 2
Mục tiêu học phầnCung cấp kiến thức cơ bản về mật mã đảm bảo an toàn và bảo mật
thông tin:
Các phương pháp mật mã khóa đối xứng; Phương pháp mật mã
khóa công khai;
Các hệ mật dòng và vấn đề tạo dãy giả ngẫu nhiên;
Lược đồ chữ ký số Elgamal và chuẩn chữ ký số ECDSA;
Độ phức tạp xử lý và độ phức tạp dữ liệu của một tấn công cụ thể
vào hệ thống mật mã;
Đặc trưng an toàn của phương thức mã hóa;
Thám mã tuyến tính, thám mã vi sai và các vấn đề về xây dựng hệ
mã bảo mật cho các ứng dụng.
2
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 3
Nội Dung
1. Chương 1. Tổng quan
2. Chương 2. Mật mã khóa đối xứng
3. Chương 3. Hệ mật DES
4. Chương 4. Hàm băm và chữ ký số
5. Chương 5. Dãy giả ngẫu nhiên và hệ mật dòng
6. Chương 6. Kỹ thuật quản lý khóa
4/27/2016 3
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 4
Tài liệu tham khảo
1. A. J. Menezes, P. C. Van Oorschot, S. A. Vanstone, Handbookof applied cryptography, CRC Press 1998.
2. B. Schneier, Applied Cryptography. John Wiley Press 1996.
3. M. R. A. Huth, Secure Communicating Systems, CambridgeUniversity Press 2001.
4. W. Stallings, Network Security Essentials, Applications andStandards, Prentice Hall. 2000.
4
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 5
Nhiệm vụ của Sinh viên
1. Chấp hành nội quy lớp học
2. Thực hiện đầy đủ bài tập
3. Nắm vững ngôn ngữ lập trình Matlab
5
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 6
Chương 3. Hệ mật DES
3.1. Giới thiệu sơ lược hệ mật DES
3.2. Cấu trúc hệ mật DES
3.3. Thám mã hệ mật DES
6
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 7
3.1. Sơ lược hệ mật DES
7
The Data Encryption Standard (DES) is a symmetric-key blockcipher published by the National Institute of Standards andTechnology (NIST).
In 1973, NIST published a request for proposals for anational symmetric-key cryptosystem. A proposal fromIBM, a modification of a project called Lucifer, wasaccepted as DES. DES was published in the FederalRegister in March 1975 as a draft of the FederalInformation Processing Standard (FIPS).
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 8
3.2. Cấu trúc hệ mật DES
8
DES is a block cipher
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 9
3.2. Cấu trúc hệ mật DES
9
The encryptionprocess is made oftwo permutations(P-boxes), whichwe call initial andfinal permutations,and sixteen Feistelrounds.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 10
3.2. Cấu trúc hệ mật DES
10
Initial and final permutation steps in DES
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 11
3.2. Cấu trúc hệ mật DES
11
Initial and final permutation steps in DES
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 12
3.2. Cấu trúc hệ mật DES
12
Ví dụ
Find the output of the final permutation box when the input isgiven in hexadecimal as:
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 13
3.2. Cấu trúc hệ mật DES
13
The initial and final permutations are straight P-boxes that are inverses of each other.
They have no cryptography significance in DES.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 14
3.2. Cấu trúc hệ mật DES
14
DES uses 16 rounds. Each round of DES is a Feistel cipher.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 15
3.2. Cấu trúc hệ mật DES
15
The heart of DES is the DES function.The DES function applies a 48-bit keyto the rightmost 32 bits to produce a32-bit output.
DES Function
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 16
3.2. Cấu trúc hệ mật DES
16
Since RI−1 is a 32-bit input and KI is a 48-bit key.
Expansion P-box
It needs to expand RI−1 to 48 bits.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 17
3.2. Cấu trúc hệ mật DES
17
DES uses this table to define this P-box
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 18
3.2. Cấu trúc hệ mật DES
18
Whitener (XOR)
After the expansion permutation, DES uses the XOR operation on
the expanded right section and the round key.
• Note that:
• Both the right section and the key are 48-bits in length.
• The round key is used only in this operation.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 19
3.2. Cấu trúc hệ mật DES
19
S-Boxes
The S-boxes do the real mixing (confusion). DES uses 8
S-boxes, each with a 6-bit input and a 4-bit output.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 20
3.2. Cấu trúc hệ mật DES
20
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 21
3.2. Cấu trúc hệ mật DES
21
S-box 1
S-box 2
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 22
3.2. Cấu trúc hệ mật DES
22
S-box 3
S-box 4
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 23
3.2. Cấu trúc hệ mật DES
23
S-box 5
S-box 6
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 24
3.2. Cấu trúc hệ mật DES
24
S-box 7
S-box 8
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 25
3.2. Cấu trúc hệ mật DES
25
Straight Permutation
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 26
3.2. Cấu trúc hệ mật DES
26
Using mixers and swappers, we can create the cipher andreverse cipher, each having 16 rounds.
First ApproachTo achieve this goal, one approach is to make the lastround (round 16) different from the others; it has only amixer and no swapper.
In the first approach, there is no swapper in the last round.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 27
3.2. Cấu trúc hệ mật DES
27
Using mixers andswappers, we cancreate the cipher andreverse cipher, eachhaving 16 rounds.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 28
3.2. Cấu trúc hệ mật DES
28
Key Generation
The round-key generatorcreates sixteen 48-bit keysout of a 56-bit cipher key.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 29
3.2. Cấu trúc hệ mật DES
29
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 30
3.2. Cấu trúc hệ mật DES
30
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 31
3.2. Cấu trúc hệ mật DES
31
Key-compression table
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 32
3.2. Cấu trúc hệ mật DES
32
Ví dụ
We choose a random plaintext block and a random key, anddetermine what the ciphertext block would be (all inhexadecimal):
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 33
3.2. Cấu trúc hệ mật DES
33
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 34
3.2. Cấu trúc hệ mật DES
34
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 35
3.2. Cấu trúc hệ mật DES
35
At the destination, Bob can decipher the ciphertext received from Alice usingthe same key.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 36
3.3. Thám mã hệ mật DES
36
Two desired properties of a block cipher are theavalanche effect and the completeness.
Completeness effectCompleteness effect means that each bit of the ciphertextneeds to depend on many bits on the plaintext.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 37
3.3. Thám mã hệ mật DES
37
During the last few years critics have found some weaknessesin DES.
Weaknesses in Cipher Design1. Weaknesses in S-boxes2. Weaknesses in P-boxes3. Weaknesses in Key
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 38
3.3. Thám mã hệ mật DES
38
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 39
3.3. Thám mã hệ mật DES
39
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 40
3.3. Thám mã hệ mật DES
40
Trong 2�� trường hợp khóa K có 4 khóa có độ an toàn rất kém đó là các khóa toàn 0 hoặc 1
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 41
3.3. Thám mã hệ mật DES
41
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 42
3.3. Thám mã hệ mật DES
42
Let’s try the first weak key to encrypt a block two times. Aftertwo encryptions with the same key the original plaintext block iscreated. Note that we have used the encryption algorithm twotimes, not one encryption followed by another decryption.
Weak key should be avoided
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 43
3.3. Thám mã hệ mật DES
43
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 44
3.3. Thám mã hệ mật DES
44
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 45
3.3. Thám mã hệ mật DES
45
A pair of semi-weak keys in encryption and decryption
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com
Page 46
3.3. Thám mã hệ mật DES
46
CuuDuongThanCong.com https://fb.com/tailieudientucntt
cuu d
uong
than
cong
. com