SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Downloaden Sie, um offline zu lesen
Information Safe
              Confidentiality
                    Modern cipher
Van Hoang Nguyen
Mail: startnewday85@gmail.com
Department of Computer Science
Faculty of Information Technology – Hanoi University of Agriculture.
Modern Ciphers

Block cipher?

    Stream cipher?
Modern Stream
   cipher?
Stream cipher
• Stream cipher xử lý plaintext theo từng bits hoặc
theo từng nhóm nhỏ(8bits)

• Stream cipher được xây dựng như sau:

      - Khóa đóng vai trò làm input cho bộ sinh số ngẫu
      nhiên(PNG)

      - Output của PNG được gọi là keystream

      - Keystream được tổ hợp với plaintext để tạo
      thành ciphertext

Thường chỉ áp dụng cho symmetric stream cipher!
Stream cipher
Stream cipher gồm hai loại:
    • Symmetric Stream cipher
           - Synchronous

           - UnSynchronous

           - Periodic


    • Asymmetric Stream cipher
           - Blum-Goldwasser probabilistic publickey encryption.
Stream cipher
Khi thiết kế stream cipher ta cần lưu ý
hai yếu tố sau:

      • Tính ngẫu nhiên của PNG


      • Key size
Stream cipher
• Nếu PNG thỏa mãn những yêu cầu đặt ra
trong thiết kế thì tính an toàn của stream
cipher là tương đương với block cipher

• Cài đặt của stream cipher thường đơn giản
và chạy nhanh hơn block cipher

• Stream cipher cần tránh việc sử dụng lại
khóa

• Nếu có được những tính chất của plaintext
thì stream cipher không được an toàn
Stream cipher
Ứng dụng của Stream cipher:

    • Mã hóa các dữ liệu ngẫu nhiên


    • Những ứng dụng tương tác đòi hỏi
    thời gian giải mã và mã hóa phải
    nhanh
RC4
• RC4 được thiết kế bởi Ronald
Rivest vào năm 1987


• Nền tảng của RC4 là phép
hoán vị ngẫu nhiên


• RC4 có cấu trúc đơn giản; dễ
để hiểu và phân tích
                                 Ronald L. Rivest
RC4
• RC4 cho phép khóa K có cỡ từ 1 tới 256
bytes(8-1024 bits)

• RC4 sử dụng hai vector 256 bytes
        T là vector tạm thời và S là vector trạng thái

• RC4 hoạt động như sau:
        1. Khởi tạo vector S
        2. Khóa K được sử dụng để khởi tạo vector T
        3. Vector T được sử dụng để hoán vị S
        4. Thực hiện sinh keystream và mã hóa(giải mã)
RC4
1. Khởi tạo vector S
       For i=0 to 255 do S[i]=i;
2. Khởi tạo vector T
       For i=0 to 255 do T[i]=K[i mode keylen];
3. Vector T được sử dụng để hoán vị S
       j=0;
       For i=0 to 255 do
           Begin
              j=(j+S[i]+T[i]) mode 256;
              swap(S[i],S[j]);
           End
RC4
 4. Sinh keystream(ks) và mã hóa(giải mã):
                 i,j=0;
                 While (true) do
                     Begin
                          i=(i+1) mode 256;
Mã hóa(giải mã) đơn
giản là sử dụng ks để     j=(j+S[i]) mode 256;
xor     với   plaintext
(ciphertext).             swap(S[i],S[j]);
                          t=(S[i]+S[j]) mode 256;
                          ks=S[t];
                      End
Operation mode for
   block cipher
Operation mode for block cipher
 • Một chế độ thi hành là một kỹ thuật nằm nâng cao
 hiệu quả của mật mã khối cho một loại ứng dụng cụ
 thể.
 • Các chế độ thi hành được định nghĩa trong FIPS PUB
 81 gồm có:
             - Electronic Code Book - ECB.

             - Cipher Block Chaining - CBC.

             - Cipher FeedBack - CFB.

             - Outer FeedBack - OFB.
             - Counter - CTR.
Electronic codebook Mode
ECB encryption:




 ECB là chế độ đơn giản nhất – sử dụng cùng một
  khóa để mã hóa tất cả các khối của plaintext.
Electronic codebook Mode
ECB decryption:
Electronic codebook Mode
Nhận xét về ECB mode:
    • ECB về bản chất giống hệt với monoalphabetic
    cipher, chỉ có điều bảng chữ cái của ECB phức tạp
    hơn.

    • ECB dễ dàng bị phá nếu plaintext lớn và có tính cấu
    trúc rõ ràng.


    • Do đó mà ECB thường dùng để mã hóa những
    plaintext ngắn như khóa bí mật.
Cipher Block Chaining Mode
CBC encryption:




  CBC sử dụng IV như một giá trị khởi tạo cho quá
             trình mã hóa và giải mã.
Cipher Block Chaining Mode
CBC decryption:
Counter Mode
 CTR encryption:




 Counter ban đầu được khởi tạo một giá trị nào đó. Sau mỗi
khối được mã hóa counter=counter+1 mod 2b với b là cỡ của
                          block.
Counter Mode
CTR decryption:
Counter Mode
Nhận xét về CTR mode:
  • Hardware effeciency: CTR cho phép mã và giải mã
  các khối một cách song song. CBC không thể thực hiện
  song song!

  • Software effeciency: Do tận dụng được lợi thế xử lý
  song song nên CTR sẽ chạy nhanh hơn.

  • Xử lý: Nếu bộ nhớ cho phép và vẫn đảm bảo được sự
  an toàn thì các output của khối mã hóa có thể được
  tính trước => từ đó mà tốc độ mã hóa sẽ rất nhanh.
Counter Mode
Nhận xét về CTR mode:

   • Cho phép truy nhập ngẫu nhiên các khối.


   • Về tính an toàn CTR không mạnh như các chế độ
   khác.

   • CTR có cài đặt tương đối đơn giản do mã và giải mã là
   như nhau.
Cipher FeedBack Mode
CFB encryption:




CFB sử dụng IV làm giá trị khởi tạo.
Cipher FeedBack Mode
CFB decryption:
Outer FeedBack Mode
OFB encryption:
Outer FeedBack Mode
OFB decryption:
Outer FeedBack Mode
• Về cơ bản OFB giống hệt với CFB.


• Cải tiến của OFB nhằm tránh việc phát triển lỗi
từ một lỗi trong quá trình truyền.

Weitere ähnliche Inhalte

Was ist angesagt?

0.3 arsitektur mikrokontroler
0.3   arsitektur mikrokontroler0.3   arsitektur mikrokontroler
0.3 arsitektur mikrokontrolerAdi Tri Soelistio
 
Android audio system(pcm데이터출력준비-서비스서버)
Android audio system(pcm데이터출력준비-서비스서버)Android audio system(pcm데이터출력준비-서비스서버)
Android audio system(pcm데이터출력준비-서비스서버)fefe7270
 
Homomorphic Encryption
Homomorphic EncryptionHomomorphic Encryption
Homomorphic EncryptionVipin Tejwani
 
L10 assembly-language-programming-of-atmega328 p
L10 assembly-language-programming-of-atmega328 pL10 assembly-language-programming-of-atmega328 p
L10 assembly-language-programming-of-atmega328 prsamurti
 
Telekomunikasi Analog dan Digital - Slide week 7 derau dalam sistem komunikasi
Telekomunikasi Analog dan Digital - Slide week 7   derau dalam sistem komunikasiTelekomunikasi Analog dan Digital - Slide week 7   derau dalam sistem komunikasi
Telekomunikasi Analog dan Digital - Slide week 7 derau dalam sistem komunikasiBeny Nugraha
 
Pengenalan dan perakitan hardware komputer
Pengenalan dan perakitan hardware komputerPengenalan dan perakitan hardware komputer
Pengenalan dan perakitan hardware komputerAhmad Pratama Ramadhan
 
Introduction to Embedded Architecture
Introduction to Embedded Architecture Introduction to Embedded Architecture
Introduction to Embedded Architecture amrutachintawar239
 
Pulse width modulation
Pulse width modulationPulse width modulation
Pulse width modulationSidiq Abdullah
 
Laporan Praktikum Mikrokontroler
Laporan Praktikum MikrokontrolerLaporan Praktikum Mikrokontroler
Laporan Praktikum MikrokontrolerMuhammad Taufik
 
Arduino.ppt
Arduino.pptArduino.ppt
Arduino.pptapri38
 
Dive into ROP - a quick introduction to Return Oriented Programming
Dive into ROP - a quick introduction to Return Oriented ProgrammingDive into ROP - a quick introduction to Return Oriented Programming
Dive into ROP - a quick introduction to Return Oriented ProgrammingSaumil Shah
 
Teknik Enkripsi dan Dekripsi Playfair Cipher
Teknik Enkripsi dan Dekripsi Playfair CipherTeknik Enkripsi dan Dekripsi Playfair Cipher
Teknik Enkripsi dan Dekripsi Playfair CipherRivalri Kristianto Hondro
 
Các thuật toán mã hóa
Các thuật toán mã hóaCác thuật toán mã hóa
Các thuật toán mã hóadlmonline24h
 
Presentasi kerja praktek teknik elektro
Presentasi kerja praktek teknik elektroPresentasi kerja praktek teknik elektro
Presentasi kerja praktek teknik elektroSusanto -
 
Order of instruments.ppt
Order of instruments.pptOrder of instruments.ppt
Order of instruments.pptANURUPAa
 

Was ist angesagt? (20)

0.3 arsitektur mikrokontroler
0.3   arsitektur mikrokontroler0.3   arsitektur mikrokontroler
0.3 arsitektur mikrokontroler
 
Android audio system(pcm데이터출력준비-서비스서버)
Android audio system(pcm데이터출력준비-서비스서버)Android audio system(pcm데이터출력준비-서비스서버)
Android audio system(pcm데이터출력준비-서비스서버)
 
Homomorphic Encryption
Homomorphic EncryptionHomomorphic Encryption
Homomorphic Encryption
 
L10 assembly-language-programming-of-atmega328 p
L10 assembly-language-programming-of-atmega328 pL10 assembly-language-programming-of-atmega328 p
L10 assembly-language-programming-of-atmega328 p
 
RC4&RC5
RC4&RC5RC4&RC5
RC4&RC5
 
Telekomunikasi Analog dan Digital - Slide week 7 derau dalam sistem komunikasi
Telekomunikasi Analog dan Digital - Slide week 7   derau dalam sistem komunikasiTelekomunikasi Analog dan Digital - Slide week 7   derau dalam sistem komunikasi
Telekomunikasi Analog dan Digital - Slide week 7 derau dalam sistem komunikasi
 
Sistem Pakar Certainty factor
Sistem Pakar Certainty factor Sistem Pakar Certainty factor
Sistem Pakar Certainty factor
 
Pengenalan dan perakitan hardware komputer
Pengenalan dan perakitan hardware komputerPengenalan dan perakitan hardware komputer
Pengenalan dan perakitan hardware komputer
 
Introduction to Embedded Architecture
Introduction to Embedded Architecture Introduction to Embedded Architecture
Introduction to Embedded Architecture
 
Kriptografi
KriptografiKriptografi
Kriptografi
 
Pulse width modulation
Pulse width modulationPulse width modulation
Pulse width modulation
 
Laporan Praktikum Mikrokontroler
Laporan Praktikum MikrokontrolerLaporan Praktikum Mikrokontroler
Laporan Praktikum Mikrokontroler
 
Pcd 06 - perbaikan citra
Pcd   06 - perbaikan citraPcd   06 - perbaikan citra
Pcd 06 - perbaikan citra
 
Arduino.ppt
Arduino.pptArduino.ppt
Arduino.ppt
 
Dive into ROP - a quick introduction to Return Oriented Programming
Dive into ROP - a quick introduction to Return Oriented ProgrammingDive into ROP - a quick introduction to Return Oriented Programming
Dive into ROP - a quick introduction to Return Oriented Programming
 
Teknik Enkripsi dan Dekripsi Playfair Cipher
Teknik Enkripsi dan Dekripsi Playfair CipherTeknik Enkripsi dan Dekripsi Playfair Cipher
Teknik Enkripsi dan Dekripsi Playfair Cipher
 
Các thuật toán mã hóa
Các thuật toán mã hóaCác thuật toán mã hóa
Các thuật toán mã hóa
 
Presentasi kerja praktek teknik elektro
Presentasi kerja praktek teknik elektroPresentasi kerja praktek teknik elektro
Presentasi kerja praktek teknik elektro
 
Order of instruments.ppt
Order of instruments.pptOrder of instruments.ppt
Order of instruments.ppt
 
Base64 Encoding
Base64 EncodingBase64 Encoding
Base64 Encoding
 

Ähnlich wie Modern stream cipher

6_XLA6_Nen anh.pdf
6_XLA6_Nen anh.pdf6_XLA6_Nen anh.pdf
6_XLA6_Nen anh.pdfTrnXun28
 
Bảo mật dữ liệu
Bảo mật dữ liệuBảo mật dữ liệu
Bảo mật dữ liệuSon Nguyen
 
Modern block cipher
Modern block cipherModern block cipher
Modern block cipherHoang Nguyen
 
Mã hóa: hash
Mã hóa: hashMã hóa: hash
Mã hóa: hashNam Vu
 
Nhập môn Mạch số, Hà Lê Hoài Trung
Nhập môn Mạch số, Hà Lê Hoài TrungNhập môn Mạch số, Hà Lê Hoài Trung
Nhập môn Mạch số, Hà Lê Hoài TrungMan_Ebook
 
Slide_Chữ ký điện tử của chaum van antwerpen
Slide_Chữ ký điện tử của chaum van antwerpenSlide_Chữ ký điện tử của chaum van antwerpen
Slide_Chữ ký điện tử của chaum van antwerpenTai Tran
 
Công nghệ bảo mật trong thanh toán điện tử-TMĐT
Công nghệ bảo mật trong thanh toán điện tử-TMĐTCông nghệ bảo mật trong thanh toán điện tử-TMĐT
Công nghệ bảo mật trong thanh toán điện tử-TMĐTThuy Na
 
Nghiên cứu xây dựng ứng dụng bảo mật VoIP trên HĐH Android
Nghiên cứu xây dựng ứng dụng bảo mật VoIP trên HĐH AndroidNghiên cứu xây dựng ứng dụng bảo mật VoIP trên HĐH Android
Nghiên cứu xây dựng ứng dụng bảo mật VoIP trên HĐH AndroidNguyễn Tuấn
 
Bảo mật nội bộ và an toàn ip
Bảo mật nội bộ và an toàn ipBảo mật nội bộ và an toàn ip
Bảo mật nội bộ và an toàn ipNgcHng148
 
Chapter_3: tiêu đề: Combination Logic.pptx
Chapter_3: tiêu đề:  Combination Logic.pptxChapter_3: tiêu đề:  Combination Logic.pptx
Chapter_3: tiêu đề: Combination Logic.pptxNguyenVanQuan13
 
Python Beginner Class day-15-networking
Python Beginner Class day-15-networkingPython Beginner Class day-15-networking
Python Beginner Class day-15-networkingKhánh Nguyễn
 
"Thu Vien Sach Co Khi" – Bài giảng điện tử số trong cơ khí
"Thu Vien Sach Co Khi" – Bài giảng điện tử số trong cơ khí  "Thu Vien Sach Co Khi" – Bài giảng điện tử số trong cơ khí
"Thu Vien Sach Co Khi" – Bài giảng điện tử số trong cơ khí Thu Vien Co Khi
 
Tìm hiểu hệ mã hoá RSA và cách triển khai vào hệ thống
Tìm hiểu hệ mã hoá RSA và cách triển khai vào hệ thốngTìm hiểu hệ mã hoá RSA và cách triển khai vào hệ thống
Tìm hiểu hệ mã hoá RSA và cách triển khai vào hệ thốngtNguynMinh11
 
Channel coding chuong 6 ma hoa kenh phan ma chap.ppt
Channel coding chuong 6 ma hoa kenh phan ma chap.pptChannel coding chuong 6 ma hoa kenh phan ma chap.ppt
Channel coding chuong 6 ma hoa kenh phan ma chap.pptnovrain1
 

Ähnlich wie Modern stream cipher (20)

6_XLA6_Nen anh.pdf
6_XLA6_Nen anh.pdf6_XLA6_Nen anh.pdf
6_XLA6_Nen anh.pdf
 
Ipsec_Vietnamese
Ipsec_VietnameseIpsec_Vietnamese
Ipsec_Vietnamese
 
Bảo mật dữ liệu
Bảo mật dữ liệuBảo mật dữ liệu
Bảo mật dữ liệu
 
Ch06
Ch06Ch06
Ch06
 
Ch06
Ch06Ch06
Ch06
 
Modern block cipher
Modern block cipherModern block cipher
Modern block cipher
 
01 ma hoa
01 ma hoa01 ma hoa
01 ma hoa
 
Mã hóa: hash
Mã hóa: hashMã hóa: hash
Mã hóa: hash
 
Nhập môn Mạch số, Hà Lê Hoài Trung
Nhập môn Mạch số, Hà Lê Hoài TrungNhập môn Mạch số, Hà Lê Hoài Trung
Nhập môn Mạch số, Hà Lê Hoài Trung
 
Slide_Chữ ký điện tử của chaum van antwerpen
Slide_Chữ ký điện tử của chaum van antwerpenSlide_Chữ ký điện tử của chaum van antwerpen
Slide_Chữ ký điện tử của chaum van antwerpen
 
Cain & abel
Cain & abelCain & abel
Cain & abel
 
Công nghệ bảo mật trong thanh toán điện tử-TMĐT
Công nghệ bảo mật trong thanh toán điện tử-TMĐTCông nghệ bảo mật trong thanh toán điện tử-TMĐT
Công nghệ bảo mật trong thanh toán điện tử-TMĐT
 
Dsd05 01-rpca
Dsd05 01-rpcaDsd05 01-rpca
Dsd05 01-rpca
 
Nghiên cứu xây dựng ứng dụng bảo mật VoIP trên HĐH Android
Nghiên cứu xây dựng ứng dụng bảo mật VoIP trên HĐH AndroidNghiên cứu xây dựng ứng dụng bảo mật VoIP trên HĐH Android
Nghiên cứu xây dựng ứng dụng bảo mật VoIP trên HĐH Android
 
Bảo mật nội bộ và an toàn ip
Bảo mật nội bộ và an toàn ipBảo mật nội bộ và an toàn ip
Bảo mật nội bộ và an toàn ip
 
Chapter_3: tiêu đề: Combination Logic.pptx
Chapter_3: tiêu đề:  Combination Logic.pptxChapter_3: tiêu đề:  Combination Logic.pptx
Chapter_3: tiêu đề: Combination Logic.pptx
 
Python Beginner Class day-15-networking
Python Beginner Class day-15-networkingPython Beginner Class day-15-networking
Python Beginner Class day-15-networking
 
"Thu Vien Sach Co Khi" – Bài giảng điện tử số trong cơ khí
"Thu Vien Sach Co Khi" – Bài giảng điện tử số trong cơ khí  "Thu Vien Sach Co Khi" – Bài giảng điện tử số trong cơ khí
"Thu Vien Sach Co Khi" – Bài giảng điện tử số trong cơ khí
 
Tìm hiểu hệ mã hoá RSA và cách triển khai vào hệ thống
Tìm hiểu hệ mã hoá RSA và cách triển khai vào hệ thốngTìm hiểu hệ mã hoá RSA và cách triển khai vào hệ thống
Tìm hiểu hệ mã hoá RSA và cách triển khai vào hệ thống
 
Channel coding chuong 6 ma hoa kenh phan ma chap.ppt
Channel coding chuong 6 ma hoa kenh phan ma chap.pptChannel coding chuong 6 ma hoa kenh phan ma chap.ppt
Channel coding chuong 6 ma hoa kenh phan ma chap.ppt
 

Mehr von Hoang Nguyen

GANs and Applications
GANs and ApplicationsGANs and Applications
GANs and ApplicationsHoang Nguyen
 
Scrum - An introduction
Scrum - An introductionScrum - An introduction
Scrum - An introductionHoang Nguyen
 
Introduction to Cross-platform App Development
Introduction to Cross-platform App DevelopmentIntroduction to Cross-platform App Development
Introduction to Cross-platform App DevelopmentHoang Nguyen
 
Conistency of random forests
Conistency of random forestsConistency of random forests
Conistency of random forestsHoang Nguyen
 
Trust - Digital Signature
Trust - Digital SignatureTrust - Digital Signature
Trust - Digital SignatureHoang Nguyen
 
SOME SECURITY CHALLENGES IN CLOUD COMPUTING
SOME SECURITY CHALLENGES  IN CLOUD COMPUTINGSOME SECURITY CHALLENGES  IN CLOUD COMPUTING
SOME SECURITY CHALLENGES IN CLOUD COMPUTINGHoang Nguyen
 
Information, Data and Decision Making
Information, Data and Decision MakingInformation, Data and Decision Making
Information, Data and Decision MakingHoang Nguyen
 
Multiple processor systems
Multiple processor systemsMultiple processor systems
Multiple processor systemsHoang Nguyen
 
Multiprocessor Systems
Multiprocessor SystemsMultiprocessor Systems
Multiprocessor SystemsHoang Nguyen
 
Introduction to AOS course
Introduction to AOS courseIntroduction to AOS course
Introduction to AOS courseHoang Nguyen
 
Background Knowledge
Background KnowledgeBackground Knowledge
Background KnowledgeHoang Nguyen
 
Introduction to Information Security Course
Introduction to Information Security CourseIntroduction to Information Security Course
Introduction to Information Security CourseHoang Nguyen
 
Introduction to CNS Course
Introduction to CNS CourseIntroduction to CNS Course
Introduction to CNS CourseHoang Nguyen
 

Mehr von Hoang Nguyen (20)

GANs and Applications
GANs and ApplicationsGANs and Applications
GANs and Applications
 
Scrum - An introduction
Scrum - An introductionScrum - An introduction
Scrum - An introduction
 
ORM in Django
ORM in DjangoORM in Django
ORM in Django
 
Introduction to Cross-platform App Development
Introduction to Cross-platform App DevelopmentIntroduction to Cross-platform App Development
Introduction to Cross-platform App Development
 
Conistency of random forests
Conistency of random forestsConistency of random forests
Conistency of random forests
 
Trust - Digital Signature
Trust - Digital SignatureTrust - Digital Signature
Trust - Digital Signature
 
Key Exchange
Key ExchangeKey Exchange
Key Exchange
 
SOME SECURITY CHALLENGES IN CLOUD COMPUTING
SOME SECURITY CHALLENGES  IN CLOUD COMPUTINGSOME SECURITY CHALLENGES  IN CLOUD COMPUTING
SOME SECURITY CHALLENGES IN CLOUD COMPUTING
 
Stream ciphers
Stream ciphersStream ciphers
Stream ciphers
 
Classical ciphers
Classical ciphersClassical ciphers
Classical ciphers
 
Confidentiality
ConfidentialityConfidentiality
Confidentiality
 
Information, Data and Decision Making
Information, Data and Decision MakingInformation, Data and Decision Making
Information, Data and Decision Making
 
Multiple processor systems
Multiple processor systemsMultiple processor systems
Multiple processor systems
 
Multiprocessor Systems
Multiprocessor SystemsMultiprocessor Systems
Multiprocessor Systems
 
Introduction to AOS course
Introduction to AOS courseIntroduction to AOS course
Introduction to AOS course
 
Background Knowledge
Background KnowledgeBackground Knowledge
Background Knowledge
 
Introduction to Information Security Course
Introduction to Information Security CourseIntroduction to Information Security Course
Introduction to Information Security Course
 
Introduction to CNS Course
Introduction to CNS CourseIntroduction to CNS Course
Introduction to CNS Course
 
Dynamic Testing
Dynamic TestingDynamic Testing
Dynamic Testing
 
Nosql intro
Nosql introNosql intro
Nosql intro
 

Modern stream cipher

  • 1. Information Safe Confidentiality Modern cipher Van Hoang Nguyen Mail: startnewday85@gmail.com Department of Computer Science Faculty of Information Technology – Hanoi University of Agriculture.
  • 3. Modern Stream cipher?
  • 4. Stream cipher • Stream cipher xử lý plaintext theo từng bits hoặc theo từng nhóm nhỏ(8bits) • Stream cipher được xây dựng như sau: - Khóa đóng vai trò làm input cho bộ sinh số ngẫu nhiên(PNG) - Output của PNG được gọi là keystream - Keystream được tổ hợp với plaintext để tạo thành ciphertext Thường chỉ áp dụng cho symmetric stream cipher!
  • 5. Stream cipher Stream cipher gồm hai loại: • Symmetric Stream cipher - Synchronous - UnSynchronous - Periodic • Asymmetric Stream cipher - Blum-Goldwasser probabilistic publickey encryption.
  • 6. Stream cipher Khi thiết kế stream cipher ta cần lưu ý hai yếu tố sau: • Tính ngẫu nhiên của PNG • Key size
  • 7. Stream cipher • Nếu PNG thỏa mãn những yêu cầu đặt ra trong thiết kế thì tính an toàn của stream cipher là tương đương với block cipher • Cài đặt của stream cipher thường đơn giản và chạy nhanh hơn block cipher • Stream cipher cần tránh việc sử dụng lại khóa • Nếu có được những tính chất của plaintext thì stream cipher không được an toàn
  • 8. Stream cipher Ứng dụng của Stream cipher: • Mã hóa các dữ liệu ngẫu nhiên • Những ứng dụng tương tác đòi hỏi thời gian giải mã và mã hóa phải nhanh
  • 9. RC4 • RC4 được thiết kế bởi Ronald Rivest vào năm 1987 • Nền tảng của RC4 là phép hoán vị ngẫu nhiên • RC4 có cấu trúc đơn giản; dễ để hiểu và phân tích Ronald L. Rivest
  • 10. RC4 • RC4 cho phép khóa K có cỡ từ 1 tới 256 bytes(8-1024 bits) • RC4 sử dụng hai vector 256 bytes T là vector tạm thời và S là vector trạng thái • RC4 hoạt động như sau: 1. Khởi tạo vector S 2. Khóa K được sử dụng để khởi tạo vector T 3. Vector T được sử dụng để hoán vị S 4. Thực hiện sinh keystream và mã hóa(giải mã)
  • 11. RC4 1. Khởi tạo vector S For i=0 to 255 do S[i]=i; 2. Khởi tạo vector T For i=0 to 255 do T[i]=K[i mode keylen]; 3. Vector T được sử dụng để hoán vị S j=0; For i=0 to 255 do Begin j=(j+S[i]+T[i]) mode 256; swap(S[i],S[j]); End
  • 12. RC4 4. Sinh keystream(ks) và mã hóa(giải mã): i,j=0; While (true) do Begin i=(i+1) mode 256; Mã hóa(giải mã) đơn giản là sử dụng ks để j=(j+S[i]) mode 256; xor với plaintext (ciphertext). swap(S[i],S[j]); t=(S[i]+S[j]) mode 256; ks=S[t]; End
  • 13. Operation mode for block cipher
  • 14. Operation mode for block cipher • Một chế độ thi hành là một kỹ thuật nằm nâng cao hiệu quả của mật mã khối cho một loại ứng dụng cụ thể. • Các chế độ thi hành được định nghĩa trong FIPS PUB 81 gồm có: - Electronic Code Book - ECB. - Cipher Block Chaining - CBC. - Cipher FeedBack - CFB. - Outer FeedBack - OFB. - Counter - CTR.
  • 15. Electronic codebook Mode ECB encryption: ECB là chế độ đơn giản nhất – sử dụng cùng một khóa để mã hóa tất cả các khối của plaintext.
  • 17. Electronic codebook Mode Nhận xét về ECB mode: • ECB về bản chất giống hệt với monoalphabetic cipher, chỉ có điều bảng chữ cái của ECB phức tạp hơn. • ECB dễ dàng bị phá nếu plaintext lớn và có tính cấu trúc rõ ràng. • Do đó mà ECB thường dùng để mã hóa những plaintext ngắn như khóa bí mật.
  • 18. Cipher Block Chaining Mode CBC encryption: CBC sử dụng IV như một giá trị khởi tạo cho quá trình mã hóa và giải mã.
  • 19. Cipher Block Chaining Mode CBC decryption:
  • 20. Counter Mode CTR encryption: Counter ban đầu được khởi tạo một giá trị nào đó. Sau mỗi khối được mã hóa counter=counter+1 mod 2b với b là cỡ của block.
  • 22. Counter Mode Nhận xét về CTR mode: • Hardware effeciency: CTR cho phép mã và giải mã các khối một cách song song. CBC không thể thực hiện song song! • Software effeciency: Do tận dụng được lợi thế xử lý song song nên CTR sẽ chạy nhanh hơn. • Xử lý: Nếu bộ nhớ cho phép và vẫn đảm bảo được sự an toàn thì các output của khối mã hóa có thể được tính trước => từ đó mà tốc độ mã hóa sẽ rất nhanh.
  • 23. Counter Mode Nhận xét về CTR mode: • Cho phép truy nhập ngẫu nhiên các khối. • Về tính an toàn CTR không mạnh như các chế độ khác. • CTR có cài đặt tương đối đơn giản do mã và giải mã là như nhau.
  • 24. Cipher FeedBack Mode CFB encryption: CFB sử dụng IV làm giá trị khởi tạo.
  • 26. Outer FeedBack Mode OFB encryption:
  • 27. Outer FeedBack Mode OFB decryption:
  • 28. Outer FeedBack Mode • Về cơ bản OFB giống hệt với CFB. • Cải tiến của OFB nhằm tránh việc phát triển lỗi từ một lỗi trong quá trình truyền.